Confused about mode of transclusion by the Page Template

Hi all,

I’m having a hangup about transclusion of tiddlers tagged $:/tags/PageTemplate.

Certain tiddlers like the story and the sidebar don’t have paragraph tags around them, but others like the drafts list and menubar do. An arbitrary tiddler I tag with $:/tags/PageTemplate does. I have not found the mechanism for this difference.

It seems not to be due to presence or absence of \whitespace trim within the tiddler.

Does somebody have the key to this at the top of their mind?

Best,
Chris

I remember being frustrated by this when I was new to TW5 and worked on the Stories setup.

IIRC what I discovered was that if your tiddler that you are tagging $:/tags/PageTemplate has the content:

Hello there

It will get wrapped in a paragraph tag.

However if your tiddler starts with a block element:

<div>

Hello there

</div>

will not get wrapped in paragraphs. If I remember correctly the line breaks inside the div are needed as well.

Edit: it has been a couple of years though so if that isn’t correct, apologies!

1 Like

Wow, thank you @saqimtiaz. It’s the line breaks inside the div that made it happen.

If I go directly into $:/core/ui/PageTemplate and add

<div>Test</div>

before the vars widget, the div is naked. If I put it after the vars, it gets <p> tags. If I then add the line breaks as you showed, the div is naked again. The line breaks do result in <p> tags around the text inside the div, of course.

Thanks again,
Chris

Is this basically the same as the other block / inline behaviours we see throughout tiddlywiki which does a good job of hiding these differences from users? eg: ListWidget
content.

The internal plugin and its html preview is a great way to see the consequences of your wiki text as html tags.

@TW_Tones Whoa, thanks. I had been meaning to check out the Internals plugin. It sure is a clean way to see how basic my issue was, albeit I might not have thought to check in this instance, because I was thrown off by being inside the page template.

It didn’t occur to me that it was as simple as parse rules I didn’t know – that didn’t matter to me before this. I understood about the list widget, but I guess I never had a show-stopping paragraph tag before?

1 Like

Yea, this is a bit of the downside of the automatic paragraph detection. There are 2 competing pending pull requests at GitHub. … But implementing fixes in a backwards compatible way at this basic level needs a lot of thinking and tinkering.