SID-01556: WikiWord Links with underscore
| Status: |
Answered |
TWiki version: |
5.1.2 |
Perl version: |
5.1 |
| Category: |
CategoryEditing |
Server OS: |
FreeBSD 5 |
Last update: |
13 years ago |
I am writing API documentation for a library our company developed called
QisLib using TWiki.
Our programmers have used an underscore for each of the function names i.e.
QisLib_InitLib and
QisLib_Close (too late to get them to change anything, of course)
When I take their "dump" I had hoped that each function name would generate a topic i.e.
QisLib_Init would generate a topic. However it appears that once the underscore is encountered _ that the TWiki preprocessor/parser decides the link should be
QisLib and ignores everything after the underscore. So my table of contents:
QisLib_Init
QisLib_Close
QisLib_GetWindow
QisLib_SetWindow
.
.
.
generates links only to
QisLib and to nothing else.
If I can't override this behavior I will be forced to manually create hundreds of links. Is there any easy way to have TWiki treat the underscore as yet another character when creating the automatic links/topics?
--
SteveDiBartolomeo - 2012-10-15
Discussion and Answer
You could hack the regexes that define
WikiWords in the TWiki code. However, I do not recommend this because it will make future TWiki upgrades painful.
I recommend you create a
TWiki plugin that links these special rules for you automatically. The
commonTagsHandler could do something like this untested thing:
$_[0] =~ s/(^|[\s\(])(QisLib[a-zA-Z0-9_]+)/$1[[$2]]/go;
This will create a forced link with double square brackets for words that start with QisLib if preceded by whitespace or parenthesis.
--
PeterThoeny - 2012-10-16
Thanks Peter. This is quite interesting - I will try to get one of my guys to help out here as I am not a programmer - just an applications engineer guy who is also responsible for documentation.
--
SteveDiBartolomeo - 2012-10-16
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.