Tags:
create new tag
view all tags

SID-01556: WikiWord Links with underscore

Status: Answered 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

      Change status to:
ALERT! 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.
SupportForm
Status Answered
Title WikiWord Links with underscore
SupportCategory CategoryEditing
TWiki version 5.1.2
Server OS FreeBSD 5
Web server Apache
Perl version 5.1
Browser & version Firefox 15
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2012-10-16 - SteveDiBartolomeo
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.