Tags:
create new tag
, view all tags

Patch Proposal:

External URL's don't wordwrap when the TWiki text is displayed inside a table. This probably doesn't affect the standard install of TWiki, but it is a problem for KoalaSkin users. The attached patch simply inserts <WBR> tags throughout the URL giving the browser the opportunity to split the URL as needed. The href itself is unaffected, so this will not break the link. This patch may have already been implemented; I'm using the Beijing release.

Note: Patch is attached as url_linebreaks_patch.txt. The patch is against the Beijing release.


Discussion:

It works, and is very useful in the VoidSkin. I'd like it to not break the first "//" in "http://" but that's just a small cosmetic issue. Changing one line in the patch corrects it:

<     $url_with_breaks =~ s!([&?/])!<WBR>$1!go;
>     $url_with_breaks =~ s!([^/]+[&?/])!<WBR>$1!go;

-- CarlPatten - 21 Jun 2004

ooo, excellent. thanks smile I'll look at this soonish. I'm guessing that we don't need any documentation for this - am I right?

-- SvenDowideit - 04 Jul 2004

I've gone for

$url_with_breaks =~ s!([a-zA-Z0-9][&?/])!$1<WBR>!go;

commited to svn smile

-- SvenDowideit - 06 Jul 2004

This needs to be reviewed: There is no <wbr /> tag in XHTML, http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Transitional

-- PeterThoeny - 08 Jul 2004

Indeed, this tag is not recognised by Konquerer and causes it to ignore the following </a> tag so the rest of the page becomes anchor text. So twiki.org is currently unviewable in Konquerer.

-- SamHasler - 29 Jul 2004

I removed the patch since it is not valid XHTML and imposes issues as reported. Hopefully there is a valid way to do line breaks in long URLs.

-- PeterThoeny - 29 Jul 2004

fair cop too - defered to Dakar as its not life threatening

-- SvenDowideit - 30 Jul 2004

http://www.cs.tut.fi/~jkorpela/html/nobr.html has an excellent discussion related to this subject, but unfortunately it lacks a conclusive answer to the problem frown

-- SteffenPoulsen - 30 Jul 2004

You can simply put <span></span> inside the <a> tag.

Example 1: (text inside span)

Example 2: (text outside span)

At least this validates. I haven't done cross browser testing though.

I have done this test for my WebLeftBar to find a solution for long WikiWords: http://www.dekko.nl/cgi-bin/twiki/view/TWiki/WebLeftBar. I think this method could be combined with SpacedWikiWordPlugin, perhaps as WrapWikiWordPlugin.

Update: no, doesn't work on IE.

-- ArthurClemens - 04 Aug 2004

Test case for patches


There is always still a way to break off the text with ellipsis: http://www.blakems.com/archives/000077.html.

-- ArthurClemens - 04 Aug 2004

low tech solution that I'm using at the moment - replace long URL's with http://host/ ... /filename

--- lib/TWiki/Render.pm (revision 9203)
+++ lib/TWiki/Render.pm (working copy)
@@ -726,6 +726,12 @@
         $opt = ' target="_top"';
     }
     $text ||= $url;
+    if (length($text) > 50) {
+        #split protocol, host, path, file
+        $text =~ m|($TWiki::regex{linkProtocolPattern}://[^/]*)(.*)/(.*)|o;
+        $text = "$1/ ... /$4";
+        # and then replace with "$protocol$host ... $file"
+    }

-- SvenDowideit - 06 Feb 2006

Edit | Attach | Watch | Print version | History: r15 < r14 < r13 < r12 < r11 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r15 - 2006-02-06 - SvenDowideit
 
  • 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.