Hi Andrew

Here's a reworked version of your code:

\define body()
<$list filter="[is[current]fields[]sort[]] -draft.of -draft.title
-show-field -text -title -modified $(showfield)$" variable="listItem">
<tr class="tc-view-field">
<td class="tc-view-field-name">''<<listItem>>'':</td>
<td class="tc-view-field-value"><$transclude field=<<listItem>>/></td>
</tr>
</$list>
\end

<$list filter="[all[current]has[show-field]]">
<table class="tc-view-field-table">
<tbody>
<$set name="showfield" value={{!!show-field}}>
<<body>>
</$set>
</tbody>
</table>
</$list>

The major changes were:

* Moving the body of the table into a macro so that the $()$ syntax works -
textual substitutions only occur when macros are parsed
* Using the "has" filter operator to detect presence of a field
* Removing the double quotes around the "value" attribute of the set
widget; they cause their content to be treated as a literal string, so that
the {{}} syntax isn't parsed as a transclusion
* Using line-breaks to make the code a bit easier to read

Best wishes

Jeremy.


On Mon, Sep 28, 2015 at 11:15 PM, Andrew <[email protected]>
wrote:

> This template causes tiddlers to display the field(s) and value(s) and
> suppressing the display of system fields if the tiddler has the show-fields
> field. It has some problems like the show-field has to have something in
> the value to work and I can't seem to pass more than one field name to the
> filter. It is tagged $:/tags/ViewTemplate and uses a list filter that I
> don't understand. I got it mostly working but I want to be able to add or
> remove displayed fields by passing the field value of my show-field. Any
> suggestions? Here <http://t5a.tiddlyspot.com/#Show-fields>is my work in
> progress.
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/tiddlywikidev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywikidev/7fea2836-3b87-4067-a39b-013a507fdb0c%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywikidev/7fea2836-3b87-4067-a39b-013a507fdb0c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/CAPKKYJZS60-s4rWCK2%3Dx3eEfCtad15Jx6AWQMP-%2ByjS3aRdNqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to