Preventing line breaks in tiddler paragraphs from rendering as line breaks

12 views
Skip to first unread message

rouilj

unread,
Dec 1, 2008, 12:00:50 AM12/1/08
to TiddlyWiki
Hi all:

I really like tiddlywiki and am looking forward to using it for a few
purposes including documentation.

But one thing is killing me. I am copying a lot of text from another
wiki (TWiki) and from other
documents. Thse have embedded newlines, and tiddlywiki is displaying
these newlines rather then wrapping
the text and breaking lines only on paragraph boundaries (or explict
embedded newlines).

Is there any way to get:

line1 of text.[newline]
line2 of text and[newline]
line3 of text
[empty line]
line 4 of text

to render as:


line1 of text. line2 of text and line3 of text
[line break]
line 4 of text

because editing paragraphs of text that span 10 or more lines is
really a pain in the .....

I have seen:

http://www.samrowe.com/tiddley/

PatchForTheRegExp which seem to indicate that it is doable:

<pre>
PatchForTheRegExp

Substitute the relevant fragment in the original code by:

if(theMatch[1] ) createTiddlyLink(parent,theMatch[0],true);
else if(theMatch[2] ) createExternalLink(parent,theMatch[0]);
else if(theMatch[3] ) parent.appendChild(document.createElement
("br")); }

i.e . kill the '!= ""' part.

I also changed the pattern for breaks to "\\n\\n" to need double
LF for a br, more wiki-like
</pre>

but I'll be darned if I can make heads or tails of that for the
version 2.4 tiddlywiki I am running.

Thanks in advance for any ideas/fixes.

-- rouilj
John Rouillard

FND

unread,
Dec 3, 2008, 2:00:22 PM12/3/08
to Tiddl...@googlegroups.com
> tiddlywiki is displaying these newlines rather then wrapping
> the text and breaking lines only on paragraph boundaries

Try the ParagraphFormatter I've just committed:
http://tinyurl.com/6erqyt
(http://svn.tiddlywiki.org/Trunk/contributors/FND/formatters/ParagraphFormatter.js)

Copy the contents into a tiddler, tag it with "systemConfig" and reload
the document.

However, note that this might have unexpected consequences - e.g.
putting all entries in MainMenu on the same line...

HTH.


-- F.

rouilj

unread,
Dec 8, 2008, 10:39:13 AM12/8/08
to TiddlyWiki
On Dec 3, 2:00 pm, FND <F...@gmx.net> wrote:
> > tiddlywiki is displaying these newlines rather then wrapping
> > the text and breaking lines only on paragraph boundaries
>
> Try the ParagraphFormatter I've just committed:
>      http://tinyurl.com/6erqyt
> (http://svn.tiddlywiki.org/Trunk/contributors/FND/formatters/Paragraph...)
>
> Copy the contents into a tiddler, tag it with "systemConfig" and reload
> the document.
>
> However, note that this might have unexpected consequences - e.g.
> putting all entries in MainMenu on the same line...

Cool. I'll hopefully get to try this out later today.

One idea I had was to tag the tiddler where I want this with
"IgnoreLineBreaks"
or some such tag so that the formatter wouldn't apply to things like
MainMenu,
and thus could be selectively applied. E.G. the twiki formatter

http://martinswiki.com/#TWikiFormatterPlugin

seems to be activated only by setting certain attributes or tags on
the tidler.

-- rouilj

FND

unread,
Dec 9, 2008, 4:36:04 AM12/9/08
to Tiddl...@googlegroups.com
> One idea I had was to tag the tiddler where I want this with
> "IgnoreLineBreaks" or some such tag so that the formatter [...]
> could be selectively applied.

I've thought of that, but haven't implemented it yet.
Not sure when I'll get around to that - but if anyone wants to give it a
shot, I'd be happy to accept patches.


-- F.

Reply all
Reply to author
Forward
0 new messages