Le samedi 12 septembre 2015 14:12:17 UTC+2, Bob Flandard a écrit :
>
> For the TW5 code above to work (for me), I needed to delete the macro 
> argument and replace $$PROP$$ with !!summary, having first defined a 
> field in each tiddler called summary. This is really inconvenient because I 
> don't want to define a field, it doubles the amount of data entered for the 
> summary and would require care if I forgot to update the field value after 
> changing the summary text.
>

Sections no longer exists in TW5.
If you don't want to duplicate your summary text, but still have it both in 
the field and in the text, you can transclude the summary field in the 
tiddler's text:

!!! Summary
{{!!summary}}

 

> Also the first column now lists the tiddlers, but not as links.
>
 
So replace the transclusion of the title by a link to it:
<$link to={{!!title}}><$view field="title"/></$link>
(a macro or a template for this is useful, it ends to be often used; a 
template already exists but with a class that we don"t always want: $:/
core/ui/ListItemTemplate)

 

> Hats off to TW2 for being so succinct and powerful. I can't see how TW5  
> "ends 
> up being *a lot* more flexible"
>
 
I don't remember this get macro from TWC, but I can imagine that there is 
also a whole logic and code behind it to have it work. Only its call is 
succinct. So to reproduce a macro someone else defined in TWC and that 
don't exist identically in TW5, you have to define it yourself, and so the 
illusion of being less succinct.

The macro definition could also be changed to be less hard-coded and take 
more parameters.

This code...
>
> \define property_table(PROP)
> <table><$list filter="[tag[apdl]tag[help]]+[sort[title]]">
> <tr>
> <td>{{!!title}}</td>
> <td>{{$$PROP$$}}</td>
> </tr>
> </$list>
> </table>
> \end
>
>
> ... didn't do the same thing as this code from TW2
>
> <<get ##Summary filter:"[tag[apdl AND help]][sort[title]]" table 
> category:"Macro 
> Name">>
>
>
>
> The TW2 code creates a two column table with column headers "Macro Name" 
> and "Summary"
> The first column then contains links to each tiddler in the list and the 
> second column takes its content from a part of the column1 tiddler that has 
> a heading "Summary" e.g: "Does this then the other"
>
> !!!Summary
> Does this then the other
>
> !!!Main Body
> More Stuff
>
>
> For the TW5 code above to work (for me), I needed to delete the macro 
> argument and replace $$PROP$$ with !!summary, having first defined a 
> field in each tiddler called summary.


 The headers of the table can be added.

<thead><tr>
<td>Macro name</td>
<td>Summary</td>
</tr></thead>




So you should end with something like that for the macro definition:

\define property_table(section_field, filter, list_header)
<table><thead><tr>
<td>$list_header$</td>
<td>$section_field$</td>
</tr></thead>
<$list filter="$filter$">
<tr>
<td><$link to={{!!title}}><$view field="title"/></$link></td>
<td>{{!!$section_field$}}</td>
</tr></$list>
</table>
\end

It would the be called with parameters :

<<property_table summary "[tag[apdl]tag[help]]+[sort[title]]" "Macro name">>

And yours tiddlers will look like that:

!!!Summary
{{!!summary}}

!!!Main Body
More Stuff

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" 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/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/dbdafc14-de55-4369-9244-ec2dcf2976cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to