Tags:
create new tag
, view all tags

Bug: TWiki::makeTopicSummary Truncates <nop> Tags

A string passed to makeTopicSummary that contains a <nop> tag straddling the cutoff point (162 characters in the TWiki 20010803 beta) will be returned with the <nop> tag truncated, resulting in a rendering error when viewed by the Amaya browser.

Test case

Suppose you have a string that looks like this:

    Name: Peter Thoeny, author of the TWIKIWEB.TWikiWeb (and therefore a TWIKIWEB.TWikiContributor) Work: Peter.Thoeny@WindRiver.com Home: Peter@Thoeny.com.

To prevent linking of internal and external links, makeTopicSummary will interpolate <nop> tags after the @ characters so that it looks like this:

    Name: Peter Thoeny, author of the TWIKIWEB.TWikiWeb (and therefore a TWIKIWEB.TWikiContributor) Work: Peter.Thoeny@<nop>WindRiver.com Home: Peter@<nop>Thoeny.com.

If a <nop> tag happens to straddle the 162 character cutoff, the function will return this:

    Name: Peter Thoeny, author of the TWIKIWEB.TWikiWeb (and therefore a TWIKIWEB.TWikiContributor) Work: Peter.Thoeny@<nop>WindRiver.com Home: Peter@<nop ...

Note how the <nop> has been truncated into a tag fragment. Netscape, Mozilla, and IE will ignore this, but Amaya complains.

(This example came out of the Main Index page in the release.)

As a workaround, I patched my TWiki.pm as follows:

   # limit to 162 chars
   $htext =~ s/(.{162})([a-zA-Z0-9]*)(.*?)$/$1$2/go;
   $htext =~ s[\</*(n|no|nop|nop)?/*$][]go;
   $htext .= ' ...'; 

This seems to work ok, but I'm sure there's a single regex that could do it.

Fix record

Simple solution was to move the truncation of string above the <nop> tag processing. In TWikiAlphaRelease.

Environment

TWiki version: Beta 20010803
TWiki plugins: DefaultPlugin
CalendarPlugin
InterwikiPluginEarlyDev
LocalCityTimePlugin
SpreadsheetPlugin
Server OS: Solaris 2.6
Web server: Apache 1.3.12
Perl version: 5.6.1
Client OS: MS Windows 95
MS Windows 2000 Pro
Web Browser: Netscape 4.77
Netscape 6.1
Mozilla 0.9.3
Internet Explorer 5.5 sp 2
Amaya 5.1

-- MikeOwens - 23 Aug 2001

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2001-11-16 - PeterThoeny
 
  • 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-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.