Text field Carriage Returns ignored when being Included

44 views
Skip to first unread message

David

unread,
Apr 24, 2020, 10:14:16 AM4/24/20
to TiddlyWiki
The "item" variable is a tiddler in question iterator because we're in a listWidget loop.  Above this, I"m using similar code to output fields, and this one is for me to output the stuff in the text field.  And it only shows it in the view when it has content.  That's working well.

But, with some tiddlers, the text content has some lines of text that are double-spaced.  And outputting the text like below was not honoring the returns (e.g. an emtpy line between two lines of text), and perhaps even not honoring line breaks at all.

<$list filter="[<item>has[text]]" >
<dd class="twText">
<$view tiddler=<
<item>> field="text" />
</dd>
</$list>

So I tried using the format attribute with several different values found in the documentation.  None of them worked for what I'm trying to do.

When I'm viewing the tiddler individually, the hard returns are preserved.  But when I bring in the text field into the template tiddler inside a loop, all the lines are concatenated.

I tried using this syntax instead, but it displayed the same concatenated lines....

{{!!text}}

Practical example: my text in the tiddler text body looks like this:
Some text on the first line.

Some text on the third line.

And it displays properly when viewing the individual tiddler.  But when I output the text field's content in the template tiddler, it concatenates the lines, like so...

Some text on the first line. Some text on the third line.

Now, I think if I were to put <br> tags in the individual tiddler, it would all work out.  But surely including text in this way is so often done that I wouldn't need to, eh?

Thanks so much!

Mat

unread,
Apr 24, 2020, 11:07:05 AM4/24/20
to TiddlyWiki
Instead of the ViewWidget, try the trancludewidget with mode=block parameter.

<:-)

Eric Shulman

unread,
Apr 24, 2020, 11:07:57 AM4/24/20
to TiddlyWiki
On Friday, April 24, 2020 at 7:14:16 AM UTC-7, David wrote:
with some tiddlers, the text content has some lines of text that are double-spaced.  And outputting the text like below was not honoring the returns (e.g. an emtpy line between two lines of text), and perhaps even not honoring line breaks at all. 
<$list filter="[<item>has[text]]" >
<dd class="twText">
<$view tiddler=<
<item>> field="text" />
</dd>
</$list>

Use the <$transclude> widget instead of the <$view> widget, like this:
<$transclude tiddler=<<item>> mode="block"/>

Let me know how it goes...

enjoy,
-e
 

David

unread,
Apr 24, 2020, 12:46:38 PM4/24/20
to TiddlyWiki
Yep.  That was it!
Reply all
Reply to author
Forward
0 new messages