Here is how I do custom view templates. This is from memory, as I cannot
refer to my tiddlywiki right now, so allow for the possibilty of syntax
errors.
a) create a new viewtemplate as follows:
\define folded-state()
$:/state/folded/$(currentTiddler)$
\end
<$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify
"$:/state/popup/tiddler-info">>>
<div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{
tc-tiddler-frame tc-tiddler-view-frame
[<currentTiddler>is[tiddler]then[tc-tiddler-exists]]
[<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]]
[<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]]
[<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}]
[<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[
]] }}}>
<$set name="_viewtemplate-tag"
filter="[all[current]get[sq-viewtemplate]else[$:/tags/ViewTemplate]]">
<$list filter="[all[shadows+tiddlers]tag<_viewtemplate-tag>!has[draft.of]]
[enlist{!sq-viewtemplate-add}]
-[enlist{!!sq-viewtemplate-remove}]" variable="listItem">
<$transclude tiddler=<<listItem>>/>
</$list>
</$set>
</div>
</$vars>
b) edit $:/config/ui/ViewTemplate to point to the above tiddler you just
created.
c) You can specify an entirely different view template tag (instead of
$:/tags/ViewTemplate) for a given tiddler by giving it the field
sq-viewtemplate
AND/OR you can specify template tiddlers to add or remove in the fields
sq-viewtemplate-add and sq-view-template-remove,
eg $:/core/ui/ViewTemplate/subtitle
The latter is an quick way to hide a specific template, eg subtitle, on a
tiddler. Note also that adding a template like subtitle to the
sq-viewtemplate-add field changes the order of the view template tiddlers,
moving it to the end.
On my list of future improvements is the ability to just specifiy a filter
that modifies the existing viewtemplate list. This was a super quick hack
some time back, so there is surely room for further refinement. The same
logic can be applied to the EditTemplate. Also note that I did most of this
before the $:/config/ui/ViewTemplate tiddler was introduced, so there might
be room for using it to streamline the logic for choosing templates.
Hope this helps.
Saq
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywikidev/ec8ea4f2-b758-46e8-ba81-eaf7a5a30450%40googlegroups.com.