Question
Hi, all. I'm wanting to disable the automatic linking of
WikiWords. My users are finding that the yellow highlight and linked question mark are confusing for words that are not meant to be
WikiLink-ized, and since my site uses so many words that are like
WikiWords but not, I'd like to disable the automatic linking. In order to create
all links in my TWiki, I'd like to only use the bracket style of linking [[Like this]]. This would also be the way that links to new pages are created, as well, so the normal yellow highlight and question mark link can work with the bracketed links, that's fine.
Any ideas? Thanks.
- TWiki version:
- Perl version:
- Web server & version:
- Server OS:
- Web browser & version:
- Client OS:
--
AdamTheo - 29 Dec 2002
Answer
You could try putting
<noautolink> and
</noautolink> around the whole page in your templates. Not sure if this works, but it may do. Or you could just get people to set <nop> suitably, or perhaps turn off the code that generates the '?' links and highlighting - having
WikiWords autolink is quite useful if the page exists.
One idea might be to redefine the
WikiWord regex in
TWikiAlphaRelease to something that never matches anything (e.g. uses the \000\001 character sequence), and the Abbrev regex to be as for
WikiWords - that way you should autolink to existing
WikiWord topics but not create the '?' links. Horrible hack but may work.
--
RichardDonkin - 29 Dec 2002
I've tracked the bit of code I want to change down to approx. line 2381 (may be different since I've modified my script) in my 10 Dec 2002 beta TWiki.pm script. This is the text:
} elsif( $doLink ) {
$text .= ""
. "$theLinkText"
. "?";
return $text;
If I comment this out, It successfully removes any highlighting and question mark linking, but it does it for both "bare"
WikiWords as well as bracketed links to topics that do not exist. I would like to keep the highlighting and question marks on bracketed links, because that's how I and my users create new pages.
Is there any way I can add a check to the
elsif that will only proceed if the link is a bracketed one? I imagine not easily, from looking at the code, but any suggestions for hacking that in? Perhaps create a variable that is created at the bracketed links location, and that is passed to
internalLinks?
This is why I really want
BetterLinks
BTW, the noautolink tags around the text in the templates didn't work.
--
AdamTheo - 31 Dec 2002
This is now implemented, see
Codev.DisablingWikiWordLinks and the NOAUTOLINK setting in
TWiki.TWikiPreferences.
--
PeterThoeny - 31 Dec 2002