[Home]WikiPatches/ForcedLineBreaks

UseModWiki | WikiPatches | RecentChanges | Preferences

The 1.0 release allows the <br> tag to be used, like:


Say you have a list, looking like this:

and you want to insert more text onto bar, but as a new paragraph. You could do something like this:

which is pretty ugly, or you could do something like this (using : prefixes for indenting text)

bar2
bar 3

but that is still ugly, and it doesn't work at all for numbered lists:

  1. foo
  2. bar bar bar
bar2
bar 3
  1. qaaz (Numbering restarts)

Here is a patch that will let you insert a
in between two paragraphs, and cause them two to be joined into one line for further wiki processing, thus putting it all into one chunk.

inside sub WikiToHTML, insert this line:

  $pageText =~ s/\\\\ *\r?\n/<BR>/g;           # double backslash for forced <BR> - comes in handy for <LI>
in front of the line that has "# Join lines with backslash at end"

For an example of this in effect, have a look at http://www.iawiki.net/cgi-bin/wiki.pl?UserPreferences/StylesheetURL


I actually prefer to have it working irrespective of if it's at the end of the line. The advantage is that this way one can use it in tables (WikiPatches/TableSyntax) as well to create multiple line table entries.

For this to work, you have to change the line to:

  $pageText =~ s/\\\\/<BR>/g;           # double backslash for forced <BR> - comes in handy for <LI>

--DavidAndel


David, wouldn't your patch adversely effect Windows documents referring to things like \\DOMAIN\share? -- ChuckDurfee
My preference is to simply allow <br> tags in the wiki markup. I'll probably add a line like:
  $pageText =~ s/\&lt\;[bB][rR]\&gt\;/<BR>/g; 
...to the next release. --CliffordAdams
IMHO the line should be added to CommonMarkup in the else part of if($HtmlTags). In this context it becomes:
  s/\&lt\;br\&gt\;/<br>/gi; 

... this is way I did it anyway. --DavidClaughton.


Question - while making the above change I noticed <br> is one of the tags allowed when $HTMLTags = 1. There is a comment in the code that says scripting is possible with these tags.

Can anyone explain how it is possible to do scripting with the <br> tag (or any of the others enabled by $HTMLTags for that matter)? --DavidClaughton

I think part of the answer lies in the notion that regardless of html being enabled or not, the <br> tag would function to break the line if it is included in the UseMod code. Isolated, it could not be used to create a script. --MatthewSimpson


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited October 31, 2007 6:04 pm by MarkusLude (diff)
Search: