List widget templating

63 views
Skip to first unread message

Tristan Kohl

unread,
Oct 30, 2018, 8:05:53 AM10/30/18
to TiddlyWiki
One problem solved, the next arises...

I have a list widget which gets passed a template tiddler to apply. However for some reason all TW markup in that tiddler gets just output as plain text and not parsed as one would expect.

Template tiddler:
! Activity
<$select field="activity-id">
   
<$list filter="[crm-type[activity]]">
       
<option value={{!!title}}>{{!!name}}</option>
   
</$list>
</
$select>

! Date
<$edit-text field="date" type="date" />

! Description
<$edit-text class="tc-edit-texteditor" field="description" size="40" />

Calling tiddler:
<$wikify name="target" text="$:/temp/<<currentTiddler>>/activity">
    <$set name="contact-id" value={{!!title}}>
        <$list filter="[title
<target>is[tiddler]]" template="activity" />
    </$set>
</$wikify>

Output:
! Activity: <evaluated widget> ! Date: <evaluated widget> ! Description: <evaluated widget>

I would expect to have three <h1> elements followed by those widgets. What am I missing?

Eric Shulman

unread,
Oct 30, 2018, 8:53:42 AM10/30/18
to TiddlyWiki
On Tuesday, October 30, 2018 at 5:05:53 AM UTC-7, Tristan Kohl wrote:
One problem solved, the next arises...
I have a list widget which gets passed a template tiddler to apply. However for some reason all TW markup in that tiddler gets just output as plain text and not parsed as one would expect.
... 
I would expect to have three <h1> elements followed by those widgets. What am I missing?

The problem is that the template content is being parsed "inline" instead of "block mode".  One way to force the template content to be shown in block mode is to add a surrounding <div>...</div> in the template.  One very important detail: there MUST be a blank line before the first "!" (heading) syntax or it still will be rendered inline as a literal "!" instead of an <Hn> element.  Thus, your template should look like this:

<div>

! Activity
<$select field="activity-id">
    <$list filter="[crm-type[activity]]">
        <option value={{!!title}}>{{!!name}}</option>
    </$list>
</$select>

! Date
<$edit-text field="date" type="date" />

! Description
<$edit-text class="tc-edit-texteditor" field="description" size="40" />
</div>

That should do it.  Let me know how it goes.

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals
 

Tristan Kohl

unread,
Oct 30, 2018, 10:05:08 AM10/30/18
to TiddlyWiki
Thank you, that was the solution. Feels weird to put a div inside my template but at least it works.

Tristan Kohl

unread,
Oct 30, 2018, 10:10:18 AM10/30/18
to TiddlyWiki
Your hint using a block element brought me to remember reading something about block mode somewhere and I found it in the transclude widget. By setting mode="block" there I could skip that additional div. Thank you again for your help :)
Reply all
Reply to author
Forward
0 new messages