Tags:
create new tag
, view all tags

Question

I'm importing lots of old documents into TWiki. I've got several places where I list addresses or other items where I want a block of text, one line after the next. If I enter the items as-is, they are concatenated together on one line. If I add line breaks, they are separated by a line as different paragraphs.

For example:

Mike Boone
123 Main St.
South Carolina, USA

After reading the TWikiShorthand (and the similar TextFormattingRules), I saw no obvious way of using single line breaks in the TWiki text. Should I use HTML <BR> tags or <verbatim> or is there something easier/more correct?

-- MikeBoone - 17 Aug 2002

Answer

The current spec is to ignore white space, e.g. to join lines unless there is an empty line. The latest TWiki version has a %BR% variable defined in the TWikiPreferences, it resolves to a line break.

Alternatively you could write a LineBreakPlugin (or add a regex in the DefaultPlugin) that scans for exactly one new line and replaces that with a line break. Something like this in sub startRenderingHandler (not tested) :

    $_[0] =~ s/([^\s\|])(\n\r?)([^\s\|].)/$1 <br \/>$2$3/gos;

-- PeterThoeny - 18 Aug 2002

Topic revision: r2 - 2002-08-18 - 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.