Tags:
create new tag
, view all tags

Question

I run a perl script which inserts more than 70000 Links from an external Documentation Source to our TWiki System. However, many Links include at least one WikiWord. TWiki now breaks those external Links in pieces displaying the WikiWord and some HTML rumble around it. I tried to disable WikiWord automatic linking by putting <nop> before it, but it does no good. It is gone when TWiki is done formatting the page.

I recently had the idea that if i could recognize a WikiWord by perl pattern matching for 100%, could i put the <nop> before the actual WikiWord and disabling the automatic linking ?

Here's an excerpt from the Perl Script which enters the links on my TWiki pages:

  $linked_data = $indent."<nop><a href=\"".$httppath."\">".$splitted[$i]."</a><br>"; // this one
  $linked_data = $indent."<nop>[[".$httppath."][".$splitted[$i]."]]<br>";            // or this one --> both fail
  $protected_pattern = quotemeta $splitted[$i-1];                                    // prevent error when File includes C++ for instance
  $data=~s/($protected_pattern<br>)/$1\n$linked_data/i;                              // include on TWiki page

If somebody could help me on this, I'd be very grateful. I don't really understand yet why TWiki sometimes just cuts out the <nop> Tag, then sometimes disables it by transforming the Tag into lt;nop>

Greetings, Sven Vowe TWiki Administrator R+V Allgemeine Versicherung

Environment

TWiki version: TWikiRelease01Dec2001
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: AIX 4.3.3.0
Web server: IBM HTTP Server 1.3.6.1 (Apache based)
Perl version: Perl 5.6.0 built for AIX
Client OS: Microsoft Windows 2000 Service Pack 3
Web Browser: Microsoft Internet Explorer 5.50.4731.2200

-- SvenVowe - 04 Sep 2003

Answer

I am not sure I understand what you want to accomplish.

The following detail could affect your algorithm: TWiki expects HTML tags to be on one line. If an HTML tag spans more then one line, TWiki escapes the opening angle bracket, assuming that it is a literal "<". So, make sure that $httppath and $splitted[$i] do not contain new lines.


First, thank for having a look. Unfortunately, I had noticed the newline problem earlier, so newlines don't exist anymore in the http-links because of an s/\n//g Operation before. I'll try to show the effect TWiki produces when the http-link contains a WikiWord:

On the Screen is shown the useless broken link:

TeamSite?.doc" target="_top">Admin User TeamSite?.doc
HTML-Code automatically produced by TWiki states:
<a href="http://doku_sb/doku_sb/beko----Betriebskonzepte/Internet Technik + Betrieb/06--B-Verfahren/01--Verfahren/020--Betrieb/030--bt--Admin--
User/Admin User <span style='background : #FFFFCE;'><font color="#0000FF">TeamSite</font></span><a href="/twiki/bin/edit/Dokuruvtest/TeamSite?
topicparent=Dokuruvtest.InternetTechnikBetriebAdmin--User">?</a>.doc" target="_top">Admin User <span style='background : #FFFFCE;'><font 
color="#0000FF">TeamSite</font></span>
However, I wanted the following Link to be displayed:
<a href="http://doku_sb/doku_sb/beko----Betriebskonzepte/Internet Technik + Betrieb/06--B-Verfahren/01--Verfahren/020--Betrieb/030--bt--Admin--
User/Admin User TeamSite.doc" target="top">TeamSite.doc</a>

I hope it is obvious now that TWiki breaks my http-links if a WikiWord is detected within the Link. I hope you can help me on this.

Greetings,

-- SvenVowe - 05 Sep 2003

Try surrounding your HTML links with <noautolink> and </noautolink> - this prevents WikiWords from being linked.

-- RichardDonkin - 05 Sep 2003

Many thanks for your support, i could finally eliminate all broken links issues. You may set this question to "Answered" smile

-- SvenVowe - 26 Sep 2003

Topic revision: r6 - 2003-09-27 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.