G'day,
This is just one of my practices to fully take advantage of relink to
protect my code from me and my continuous tweaking of tiddler titles.
*Some sample code*:
<$vars DataTid={{{ [<currentTiddler>addsuffix[ Data]] }}}
*EditorName={{Sheet Designer!!title}}*>
<$vars selectedSheet={{{ [<DataTid>getindex[selected_sheet]]
[<currentTiddler>!match<EditorName>] +[last[]] }}}
bViewOnly={{{[<currentTiddler>!match*<EditorName>*
then[yes]else[no]]}}}>
*About that sample code*:
In the "TiddlySheets" project I've got going on, my "Sheet Designer" (or
"Sheet Editor"; I am on the fence) is the tiddler in charge of creating and
editing sheets (like "TreeSheets <http://strlen.com/treesheets/>", not like
spreadsheets). The tiddler also serves a second function: as a
transclusion template, so that if I want to "publish" a sheet in some
tiddler, I transclude the sheet (a data tiddler) using the "Sheet
Designer" as transclusion template.
The code above says: hey, if this code (or "TiddlyWiki scripting") is
happening for current tiddler = "Sheet Designer", then behave for that
context (i.e. allow editng of the sheet); if this code is happening for
current tiddler = something other than "Sheet Designer" then behave for
that context (i.e. show the view-only sheet.)
*Back to discussion*:
Originally, my code was as follows:
<$vars DataTid={{{ [<currentTiddler>addsuffix[ Data]] }}}>
<$vars selectedSheet={{{ [<DataTid>getindex[selected_sheet]]
[<currentTiddler>!match*[SheetEditor]*] +[last[]] }}}
bViewOnly={{{[<currentTiddler>!match*[SheetEditor]*
then[yes]else[no]]}}}>
Then I changed the tiddler's name from "SheetEditor" to "SheetDesigner".
And then my tiddler stopped working correctly. And it took me a while to
realize: the Relink plugin could not catch the "hard-coded" reference to
"Sheet Editor" inside my code's filter.
Once bitten, twice shy. I changed my code as per way above.
Pretty much wherever I refer to a tiddler, instead of referring to that
tiddler by title, I refer to the tiddler by transclusion of the title,
which the Relnk plugin never misses.
So "{{ThisTiddler!!title}}" instead of "ThisTiddler".
I am a tweaker by nature, and that will never change.
So I code as per my nature. Or I quickly refactor my code when I
momentarily forget about my nature.
Anyways, all of that in case any other tweakers out there want to max out
the benefits of relink.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/1db7e2a9-86b7-47d1-b4c7-706e77484ddfn%40googlegroups.com.