I’m trying to generate a table from a list of tiddlers using wiki syntax:
|!Tool |!Destinations |
<$list filter="[tag[BackupTool]]">
|{{!!tool-name}} |{{!!destinations}} |
</$list>
The header renders, but the data from <$list> appears squashed, not in rows. It seems the wiki table parser terminates at the first line that doesn’t start with | (the <$list> tag), so the following | data are not in rows.
Switching to HTML table widgets (<$table>, <$tr>, <$td>) works fine. So there’s a workaround.
Is this expected behavior?
Wikitext tables are typically used for output of static content, and don’t really handle embedded widgets that generate parts of the table output.
However, there IS a way to do it, but it’s a bit tricky:
\define myTable()
|!Tool |!Destinations |<br>
<$list filter="[tag[BackupTool]]">|{{!!tool-name}} |{{!!destinations}} |<br>
</$list>
\end
<$wikify name="out" text=<<myTable>>>
<<out>>
</$wikify>
Notes:
- The
myTable() macro generates the needed wikitext table syntax
- The absence of a newline following the opening
<$list ...> syntax, as well as the use of <br> followed by literal newlines for row endings is essential to generating the proper table syntax
- The
$wikify widget captures the <<myTable>> output as plain text into the out variable
- The blank line before
<<out>> is needed to ensure the table output uses “block” mode rendering
enjoy,
-e