> Often help is needed in the editTempate at the stage when a tiddler is being
> produced with specific tags from a custom newTiddler macro.
> A tiddler produced with a <<newTiddler tag:'foo'>> might need help specific
> for that class of tiddler.

> The 'context sensitive with fallback'  is working well.
> Skye, asked  "is it possible use tiddler.tags instead of tiddler.title in
> this code" : I think that it would be really useful.

Try this:

<span class='toolbar' macro='tiddler ShowPopup with:
   {{
   var helptitle="Help";
   var title=story.findContainingTiddler(place).getAttribute
("tiddler");
   var field=story.getTiddlerField(title,"tags");
   if (field) {
           var tags=field.value.readBracketedList();
           for (var i=0; i<tags.length; i++)
              if (store.tiddlerExists(tags[i]+"Help"))
                 helptitle=tags[i]+"Help";
   }
   helptitle;
   }}
   help "show help" button'></span>

Translation:
1) get the current tiddler's title.  note: because a new tiddler is
being edited, no tiddler *object* exists yet, so we have to fetch the
*tentative* tiddler title from the tiddler editor's containing DOM
element.

2) get the tags for this new tiddler.  Since no tiddler *object*
exists, we can't use 'tiddler.isTagged(...)' to test for tags, and
have to read the value from the tags input field.  One problem: the
macro is using story.getTiddlerField(title,"tags"), which needs to
occur *after* the tags input field itself is rendered.  To make this
work, the 'help' toolbar item would have to be displayed at the bottom
of the tiddler :-(...

3) loop over the tags to find a tiddler called 'sometagHelp'.  If it
exists, use that title for the help content, otherwise, use the
default 'Help' tiddler.

This might not be a 100% solution (yet), but it should be close.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
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