[tw] Re: [TWC] how to get a tiddder's alias with $1
Hi all Thank you for your help WikifyPlugin Not knowing when I will migrate to TW5 I prefer not rely too much on plugins tiddler ADU with: {{store.getValue(SomeTitle,alias)}} would be fine but - it does not take account of changes made to SomeTiddler until page is refresher. - if there are alias duplicates there is a problem I had the same problem using tiddler ADU with: SomeTiddlerAlias Then I will use this one : tiddler ADU with: SomeTitle {{store.getValue(SomeTitle,alias)}} slightly modified : [[$2|$1]] (=tiddler [[$1::defaultValue]]tiddler [[$1::valueUnit]]) to be more robust against alias duplicates Thank all Le mercredi 4 décembre 2013 22:24:05 UTC+1, Eric Shulman a écrit : On Wednesday, December 4, 2013 9:47:46 AM UTC-8, julien23 wrote: [[ADU]] with this code inside : [[$1|$1]] (=tiddler [[$1::defaultValue]]tiddler [[$1::valueUnit]]) and I call it in other tiddlers using : tiddler ADU with: theTidlerThatHaveValuesInside What code should à use in [[ADU]] to fetch the tiddler's alias ? I made some try around store.getValue(tiddler,alias) but haven't found the correct syntax yet... Tiddler aliases are not a standard TWCore tiddler field, so I assume you are using a plugin to add 'alias' as a custom field to your tiddlers. Using store.getValue(tiddler,alias) lets you programmatically access the custom field value from javascript code. However, there is no TWCore native method for *directly* inserting a custom field value into the rendered tiddler display. However, if you don't mind installing another plugin, there is an approach that may close to what you have in mind. http://www.TiddlyTools.com/#WikifyPlugin provides a simple macro that constructs and renders formatted output based on specified macro parameter values. Using this macro, you can insert the custom field value directly into the displayed content in [[ADU]], like this: wikify [[%0|%0]] alias@$1 (=tiddler [[$1::defaultValue]]tiddler [[$1::valueUnit]]) The first param of the wikify macro is the output format using %0 as a substitution marker. In this example, it constructs a PrettyLink ([[...|...]]) from the value specified by the second param, which it retrieves from the indicated fieldname@tiddlername (in this example, using $1 to insert the tiddler name passed to [[ADU]]). If you prefer not to add WikifyPlugin to your document, you can use *evaluated parameters* to invoke the necessary javascript code from the calling tiddler macro... like this: tiddler ADU with: {{store.getValue(SomeTitle,alias)}} which will pass in the alias instead of the real tiddler title. However... for your specific use case, you may need to pass *both* the real tiddler title and the alias... so that the slice references inside the [[ADU]] tiddler will still work: tiddler ADU with: SomeTitle {{store.getValue(SomeTitle,alias)}} where [[ADU]] is modified to use $1 and $2 substitution markers: [[$2|$2]] (=tiddler [[$1::defaultValue]]tiddler [[$1::valueUnit]]) (this allows the alias to be displayed as the link, while still using the actual tiddler title to retrieve slice values). enjoy, -e Eric Shulman TiddlyTools / ELS Design Studios EVERY DONATION IS IMPORTANT! HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY TIP JAR... http://TiddlyTools.github.com/fundraising.html#MakeADonation Professional TiddlyWiki Consulting Services... Analysis, Design, and Custom Solutions: http://www.TiddlyTools.com/#Contact -- 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 tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/groups/opt_out.
[tw] Re: [TWC] how to get a tiddder's alias with $1
Hi Julien, It looks to me as though your tiddler macro does what you've asked about in your subject line (that is, it gets another tiddler's alias), but I don't quite understand the question What code should à use in [[ADU]] to fetch the tiddler's alias ? Can you explain a bit more about what you're looking for? cmari On Wednesday, December 4, 2013 9:47:46 AM UTC-8, julien23 wrote: Hi all Some of my tiddlers have values stored in table : |~|value||h |defaultValue|4| |valueUnit|newtons| |valueType|...| |valueByteNumber|...| I would like to write alias (=defaultValuevalueUnit) in another tiddler. I made for this a tiddler : [[ADU]] with this code inside : [[$1|$1]] (=tiddler [[$1::defaultValue]]tiddler [[$1::valueUnit]]) and I call it in other tiddlers using : tiddler ADU with: theTidlerThatHaveValuesInside What code should à use in [[ADU]] to fetch the tiddler's alias ? I made some try around store.getValue(tiddler,alias) but haven't found the correct syntax yet... Looking forward to read from you Julien -- 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 tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/groups/opt_out.
[tw] Re: [TWC] how to get a tiddder's alias with $1
On Wednesday, December 4, 2013 9:47:46 AM UTC-8, julien23 wrote: [[ADU]] with this code inside : [[$1|$1]] (=tiddler [[$1::defaultValue]]tiddler [[$1::valueUnit]]) and I call it in other tiddlers using : tiddler ADU with: theTidlerThatHaveValuesInside What code should à use in [[ADU]] to fetch the tiddler's alias ? I made some try around store.getValue(tiddler,alias) but haven't found the correct syntax yet... Tiddler aliases are not a standard TWCore tiddler field, so I assume you are using a plugin to add 'alias' as a custom field to your tiddlers. Using store.getValue(tiddler,alias) lets you programmatically access the custom field value from javascript code. However, there is no TWCore native method for *directly* inserting a custom field value into the rendered tiddler display. However, if you don't mind installing another plugin, there is an approach that may close to what you have in mind. http://www.TiddlyTools.com/#WikifyPlugin provides a simple macro that constructs and renders formatted output based on specified macro parameter values. Using this macro, you can insert the custom field value directly into the displayed content in [[ADU]], like this: wikify [[%0|%0]] alias@$1 (=tiddler [[$1::defaultValue]]tiddler [[$1::valueUnit]]) The first param of the wikify macro is the output format using %0 as a substitution marker. In this example, it constructs a PrettyLink ([[...|...]]) from the value specified by the second param, which it retrieves from the indicated fieldname@tiddlername (in this example, using $1 to insert the tiddler name passed to [[ADU]]). If you prefer not to add WikifyPlugin to your document, you can use *evaluated parameters* to invoke the necessary javascript code from the calling tiddler macro... like this: tiddler ADU with: {{store.getValue(SomeTitle,alias)}} which will pass in the alias instead of the real tiddler title. However... for your specific use case, you may need to pass *both* the real tiddler title and the alias... so that the slice references inside the [[ADU]] tiddler will still work: tiddler ADU with: SomeTitle {{store.getValue(SomeTitle,alias)}} where [[ADU]] is modified to use $1 and $2 substitution markers: [[$2|$2]] (=tiddler [[$1::defaultValue]]tiddler [[$1::valueUnit]]) (this allows the alias to be displayed as the link, while still using the actual tiddler title to retrieve slice values). enjoy, -e Eric Shulman TiddlyTools / ELS Design Studios EVERY DONATION IS IMPORTANT! HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY TIP JAR... http://TiddlyTools.github.com/fundraising.html#MakeADonation Professional TiddlyWiki Consulting Services... Analysis, Design, and Custom Solutions: http://www.TiddlyTools.com/#Contact -- 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 tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/groups/opt_out.