How to retain slashes in tiddler titles when parsed in select?

74 views
Skip to first unread message

Steven Schneider

unread,
Aug 12, 2017, 12:35:19 PM8/12/17
to TiddlyWiki
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:

Any thought?

//steve.


:



Eric Shulman

unread,
Aug 12, 2017, 4:12:12 PM8/12/17
to TiddlyWiki
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,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals


Steven Schneider

unread,
Aug 12, 2017, 6:34:24 PM8/12/17
to TiddlyWiki
Eric, thanks. Your suggestions are, as usual, right on. So I see that my select is creating a [[tiddlerToShow]] with the text field set to the name of a tiddler with "//" in its name.

I get how the <$text text={{tiddlerToShow}}/> works -- so I can see the content with the //....

But, how do I use my new tiddler [[tiddlerToShow]]? I need to be able to do <$link to={{tiddlerToShow}}>{{tiddlerToShow}}</$link> and <$transclude tiddler={{tiddlerToShow}}/>? There must be a magic text cleaning machine that interprets the slashes for what they are, and not as markup...?

//steve.

Mark S.

unread,
Aug 12, 2017, 7:30:34 PM8/12/17
to TiddlyWiki
I'm trying to understand your data flow. What are the contents of the target field, and how do they differ from the title? If you put the title into target, then your scenarios (e.g. <$link to={{tiddlerToShow}}>{{tiddlerToShow}}</$link> and <$transclude tiddler={{tiddlerToShow}}/>) work fine (goes to tiddler and pulls contents respectively). This leads me to think that you have something other than the title in the target field, in which case your problems have nothing to do with the double slash.

Good luck,
Mark

Mark S.

unread,
Aug 12, 2017, 7:41:03 PM8/12/17
to TiddlyWiki
Correction, if you link like this:

<$link to={{tiddlerToShow}}><$view tiddler=tiddlerToShow field=text/></$link>

it will both link and view correctly. However, even if you did it as <$link to={{tiddlerToShow}}>{{tiddlerToShow}}</$link> it would link correctly -- it would look slightly different, but given how long the title is I don't know if that's the biggest issue.

Mark

Eric Shulman

unread,
Aug 13, 2017, 1:25:03 AM8/13/17
to TiddlyWiki
On Saturday, August 12, 2017 at 3:34:24 PM UTC-7, Steven Schneider wrote:
I get how the <$text text={{tiddlerToShow}}/> works -- so I can see the content with the //....

But, how do I use my new tiddler [[tiddlerToShow]]? I need to be able to do <$link to={{tiddlerToShow}}>{{tiddlerToShow}}</$link> and <$transclude tiddler={{tiddlerToShow}}/>? There must be a magic text cleaning machine that interprets the slashes for what they are, and not as markup...?

<$link to={{tiddlerToShow}}><$text text={{tiddlerToShow}}/></$link>

The "to" param of the <$link> widget is not *rendered*... thus, the "//" contained in the value is used as-is, and the <$text> widget within the link displays the tiddler title, with the "//" intact, as previously noted.

Likewise, with <$transclude tiddler={{tiddlerToShow}}/>, the "tiddler" param is not *rendered*... and the "//" is used as-is.

-e

Steven Schneider

unread,
Aug 13, 2017, 3:57:57 PM8/13/17
to TiddlyWiki
Thanks, Eric & Mark. Got it to work as you suggested it would.. Much appreciated. //steve.
Reply all
Reply to author
Forward
0 new messages