See
Support.WikiWordForSingleWord
A single word, such as "Ontology" that you want to be a
WikiWord.
In the support context I proposed that such a word get written as
.Ontology as this is a natural extension of writing
Codev.Ontology.
In fact, in forced square brackets .Ontology already works. It just needs making so that you can write it without the square brackets.
--
MartinCleaver - 26 Mar 2001
This is how I hacked it on my sites.
s/([\*\s][\(\-\*\s]*)([A-Z]+[a-z]*)\.([A-Z]+[a-z]+(?:[A-Z]+[a-zA-Z0-9]*))/&internalLink($2,$3,"$TranslationToken$3$TranslationToken",$1,1)/geo;
s/([\*\s][\(\-\*\s]*)([A-Z]+[a-z]+(?:[A-Z]+[a-zA-Z0-9]*))/&internalLink($theWeb,$2,$2,$1,1)/geo;
s/[\s]\.([A-Z]+[a-z]*)/&internalLink($theWeb,$1,$1,"", 1)/geo; # MRJC - WikiWord for single word, only works within same web.
s/$TranslationToken(\S.*?)$TranslationToken/$1/go;
(Revised,
MartinCleaver, 18 June 01 to fix bug of the regexp eating all whitespace before reference to
SingletonWikiWord)
--
MartinCleaver - 04 May 2001
I think this might be a bad idea, but....how about we reverse the lookup of wikinames a bit. If a topic exists, any use of it will be rendered as a link. therefore
this is a topic name with spaces in it.txt will cause any instance of that text to link to that page. It might be possible to optimise this funtionality rather than looking for all page names...
--
SvenDowideit - 04 May 2001
I think you might be talking about a different thing, but let's check.
I was wanting to permit the use of single words for topics, for example a topic called "Scope" which using the hack above has to be written as
.Scope; it has minimal performance hit as Scope written without the dot is not linked.
I think what you are talking about is being able to have Wiki Words with spaces in, for example, for a topic called "Topic Name With Spaces" and have any occurance of that text automatically turned into a link to that topic. I solved this in a different way, my page would be called "TopicNameWithSpaces" but would get rendered as "Topic Name With Spaces". I've got to go now, but I'll add a link to the page in which I described how I did this later.
--
MartinCleaver - 05 May 2001
Yes, and no

, I was talking about the same thing, but i did choose a confusing example. on
MoreArbitraryTextForWikiWordLinks I realised that if we discard the notion that getting all the exisiting topicnames is a performance hit, then we could use this list to render both
SingletonWikiWords and
WikiPhrases without needing the dot, or squarebrackets or any special markup.
Esentially, if a topic exisits, regardless of the format of the name, a link is made.
--
SvenDowideit - 05 May 2001
Okay, I see. Well, first off, see
WikiWordsWithSpacesBreakPredictability for why I dislike spaces in the markup.
To answer your question I am cautious about rendering
SingletonWikiWords as links without some indication from the author that that was what was wanted simply because single words have many meanings (IMHO the dictionary definitions). Only those to which I give special meaning would I want rendered as such.
That said, once the meta data stuff is in place there is nothing to say that we couldn't have a table on each topic to list which words should be linked. Indeed, we could also add a table to import
WikiWords from other webs such that they don't need explicit prefixing with the other webs webname.
--
MartinCleaver - 10 Jun 2001
Refactored and moved
Babel of Wikis discussion to
BabelOfWikis.
--
PeterThoeny - 18 Jun 2001
Can someone tell me either:
- how to code this as a plug-in, or
- can we incorporate this into the core
I'd like to have this ready for the next release.
--
MartinCleaver - 18 Jul 2001
Martin, I use the following code in a plugin to allow Singleton words in two Webs (Products and Morpheus). Note that this can break some things e.g. the url in an href can suddenly get a link. Performance is also affected, but I haven't had any problems.
sub outsidePREHandler
{
### my ( $text ) = @_; # do not uncomment, use $_[0] instead
&TWiki::Func::writeDebug( "- DefaultPlugin::outsidePREHandler( $renderingWeb.$topic )" ) if $debug;
# This handler is called by getRenderedVersion, in loop outside of <PRE> tag
# This is the place to define customized rendering rules
# Special linking for Products Web - name can have only initial capital e.g. Fidessa
# 'Web.TopicName' link:
$_[0] =~ s/(^|[\*\s][\(\-\*\s]*)(Products|Morpheus)\.([A-Z][A-Za-z]{2,}[0-9]*)(?!\.[^\s])/&TWiki::internalLink($1,$2,$3,"$3","",0)/geo;
if( $web eq "Products" || $web eq "Morpheus" ) {
# 'TopicName' link:
$_[0] =~ s/([\*\s][\(\-\*\s]*)([A-Z][A-Za-z]{2,}[0-9]*(?!\.[^\s]))/&TWiki::internalLink($1,$web,$2,$2,"",0)/geo;
}
}
--
JohnTalintyre - 18 Jul 2001
Interesting - we already support some singleton wiki words, of course, just try creating a page called
TLA and then mentioning
TLA. However, auto-linking all singleton wiki word pages that exist may not be a great idea, particularly in acronym-heavy pages where a huge number of words would be linked. This over-linking issue also applies to singleton wiki words, unless all pages are very short (e.g. a glossary web, where this would be very useful).
This is one reason why
Wiki:WardsWiki
specified that you had to have two pages in a
WikiWord, as a way of avoiding over-linking.
BTW, I just had to remove the <PRE> from John's code excerpt, as both PRE and VERBATIM didn't manage to escape this. This area really needs improving, it shouldn't be possible to have a PRE starting within a VERBATIM section!
--
RichardDonkin - 18 Jul 2001
Specificity (i.e. I really mean this is a page) and performance are two reasons why I would be happy to always write this with a preceding '.'
In fact, in forced square brackets .Ontology already works. It just needs making so that you can write it without the square brackets.
--
MartinCleaver - 18 Jul 2001
It's worth remembering that only
WikiName entries get the ? mark to suggest creating a linked topic.
TLAs and the code I gave above only give a link if the topic has been created.
I'm afraid I don't understand your comments Martin. Square brackets tell you when to start and stop processing, it is more complicated and expensive to try various start and end combination (although relatively efficient algorithms do exist).
--
JohnTalintyre - 18 Jul 2001
Oh, sorry. I meant that as [[.Ontology]] already links to a topic 'Ontology'. I want to make it so that I can write it without the brackets, as .Ontology.
Is that clear?
--
MartinCleaver - 19 Jul 2001
(bounce)
--
MartinCleaver - 17 Nov 2001
All done. See
SingletonWikiWordPlugin.
--
MartinCleaver - 28 Nov 2001
Many thanks for the hacking suggestion at the top of this page and the plugin!
(One of the things I think I am going to start adding to the part of my Wiki presentations where I say why I chose TWiki is the incredible resources available through its Support and Codev webs.)
I just ran into an important special case of this problem that either approach solves, and which I probably wouldn't have attempted without them. Our problem is that our\ standard course nomenclature is
[A-Z]{3,4}[0-9]{3}, e.g,
COMP100, and people naturally want to use topic names with that pattern, or with that pattern as a prefix (e.g.,
COMP100Syllabus).
I ended up loading the plugin but also hacking the
WikiWord regexps. (I do think the plugin will be useful, and I have always disliked the contortions needed on other Wikis for singleton names, especially for languages such as Python, Java, etc.) I decided to hack the code too because we will have hundreds of relatively naive users frequently using course numbers as topic names or the prefixes of topic names, and it would be entirely unrealistic to hope to train them to routinely use the initial period.
By the way, I think it's worth mentioning for the benefit of other people who might want to hack their TWiki's WikiWord definition, that the code is in sub
getRenderedVersion in
lib/TWiki.pm. Also, I hacked
isWikiName in
lib/TWiki.pm similarly so that users wouldn't get
WebTopicNonWikiTemplate's warning about not using course numbers as topic names if they used Go to name a new page.
--
MitchellModel, Wesleyan University - 04 Nov 2002
Has the objective of using single words a wiki word been accomplished since I wrote about it 7 years ago? Thanks.
--
MartinCleaver - 03 Oct 2008
Yes Martin, it clearly has - someone wrote
All done. See SingletonWikiWordPlugin. -- MartinCleaver - 28 Nov 2001
--
SvenDowideit - 04 Oct 2008
Gosh. Look at that. :P
No really. Perhaps we can make this a standard way of automatically linking single wiki words?
Three questions:
- Does anyone deny the need?
- Does anyone have a better suggestion of how to do this?
- Would this be better in the core (or core distro) than in a plugin?
--
MartinCleaver - 07 Oct 2008
How about every TopicName/WikiWord goes into a db together with its occurrence. That way WikiWords don't need to adhere to some special markup as everything in the WikiWords table is associated with its TopicName anyway. (and we would get easy backlinking and sorting pages by relevance using the info from WikiWord occurrences).
--
MichaelDaum - 07 Oct 2008
For what it's worth, I deny the need. The syntax
[[Ontology]] works just fine, is pretty similar to what you have in other wiki engines, and is needed anyway to link to single word topics in other webs, or if you want link labels to be different from topic texts. It isn't just link rendering what is affected if another syntax is allowed. TOC creation, moving topics across webs,
HTML2TML translation, backlinks, Interwiki links (would you want to write Bugs:.Item5555 ?) and other places might be affected.
--
HaraldJoerg - 07 Oct 2008
To Michael: It is obvious that all existing topics must be in a DB when we implement the DB storage for 5.0. For many other good reasons than this one.
To Harald: I agree with you 100%. I would not want to introduce a new dot syntax. I will get a scream from users when their documents with words starting by a dot suddenly become links to non existing topics. It is also a geeky syntax. And besides a few less key presses the [[singleton]] syntax does not really impose a terrible syntax. On the contrary it is consistant with other uses of the same syntax.
As a plugin - fine. We can all chose which plugins to install. But I would not want the dot syntax added to the core.
--
KennethLavrsen - 08 Oct 2008
Couldn't the Interwiki functionality (syntax) be somehow extended to support singleton words?
:Item5555 would link to
Item5555 (singleton word) in the current web on the current server.
Webname:Item5555 would link to
Item5555 in the web
Webname on the current server (autogenerate Interwiki links for all local webs).
Wikiserver:Webname.Item5555 would link to topics on a foreign wiki server named
Wikiserver. Or change
TWiki:Plugins.SingletonWikiWordPlugin
to support this kind of links.
--
FranzJosefGigler - 23 Oct 2008