So I've been working on integrating the EJS templating language into 
TiddlyWiki. Initial tests seem to be good:  
http://funkyeah.tiddlyspace.com/#EJS

I've come into an issue in the architecture of  how everything will fits 
together. Because there is no data hash to be passed to the renderer it has 
to be created beforehand when it is required. 
The nice thing about TiddlyWiki html macros and specifically the embedded 
the ListboxPlugin macro from tiddlytools.com is that the referenced data is 
inherent maintained by the plugin so no data hash has to be constructed for 
the individual data.

Now if you look at the code for the "Form In Template" section of 
http://funkyeah.tiddlyspace.com/#EJS you'll see my template iterates over a 
the length of a hash object that is just a placeholder for what it should 
actually be. The actual length should be the number of fields applicable to 
the ListBox macro being iterated over (the fields: styles0, styles1, 
styles2)

It seems to me that to get the correct length parameter in a generic way 
I'd have to capture the field name of the macro being iterated over, but 
this wouldn't be available until after it passes through the EJS and HTML 
formatters, at which point its too late. 

An alternative is that the number of iterations for the given template 
iterator is kept in a separate field, defaulted to one, and 
incremented/decremented by some other means.

This also brings up the larger question (mostly because I'm relatively new) 
of what the typical TiddlyWiki data structures are that you might want to 
iterate over in a template.... Tags, Tiddler Titles, and Fields are what 
immediately come to mind.

Thoughts on implementing the above or doing it in a better way? Am I 
remaking something that is already available? (It looks like you can 
partially get there with the HideWhenPlugin...)

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/tiddlywiki/-/aSJBCkbgBFYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to