Subject: [tw] Re: How to retain slashes in tiddler titles
when parsed in select?



On Saturday, August 12, 2017 at 9:35:19 AM UTC-7, Steven Schneider wrote:I am using the <select> widget to allow users to make a selection.The select field is  are choosing among tiddlers listed in the list field of my 
<$select tiddler="tiddlerToShow" default='Cover'><$list filter='[list<currentTiddler>]'><$vars target={{!!target}}><option value=<<target>>><$view field='caption'/></option></$vars></$list></$select>The values of {{!!target}} have slashes in them, like this:
American Government and Politics in the Information Age//OEBPS/part-001-chapter-1-communication-in-the-information-age.xhtml
and thus [[tiddlerToShow]] gets this value instead:
American Government and Politics in the Information AgeOEBPS/part-001-chapter-1-communication-in-the-information-age.xhtml
1) There is no need to use <$vars>...</$vars> here... just write:   <option value={{!!target}}>...</option>
2) I recommend using 'fallback' display within the <option>...</option>, so that if the "caption" field is not defined, the "target" field is shown.... and if "target" is not defined, the "title" field is shown, like this:<option value=...

{{!!target}}><$view field='caption'><$view field='target'><$view field='title'/></$view></$view></option>
3) I did a quick test on tiddlywiki.com, and the *contents* of [[tiddlerToShow]] DO have the double slash characters intact.  However, when you *view* that tiddler's content directly, the "//" is *parsed and rendered* (correctly) as TW syntax for "start italics"... and, because there is no matching "//" to "end italics", that formatting continues to the end of the text that is shown.
4) You can show the *unparsed* content by using (in some other tiddler)   <$text text={{tiddlerToShow}}/>
enjoy,-eEric ShulmanTiddlyTools.com: "Small Tools for Big Ideas!" (tm)InsideTiddlyWiki: The Missing Manuals

--
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/34f27777-2963-4cbd-a67b-1c632ea2eb66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



Programming list archiving by: Enterprise Git Hosting