WOW! - Eric, you rock. --- The only thing I had understood was the
mimicing with single-quotes or hex \x22.
Your approach of "compound macros" sounds very interesting, but I'am
not sure if I get the clue. Am' I correct that you use tiddler
sections and referencing to combine the different clauses on the fly
at run time?

I tried a simple example with the tiddler called "myvideo":
---------------------------------------------------------------------
<<forEachTiddler
   where {{store.getTiddlerText("myvideo##where")}}
   sortBy {{store.getTiddlerText("myvideo##sortBy")}}
   write {{store.getTiddlerText("myvideo##write")}}
   begin {{store.getTiddlerText("myvideo##begin")}}
   end {{store.getTiddlerText("myvideo##end")}}
   none {{store.getTiddlerText("myvideo##none")}}
>>/%

!where
tiddler.tags.contains("video")&& !tiddler.tags.contains
("excludeLists")
!sortBy
(tiddler.title.toLowerCase())
!script
enter script code here
!write
"|[["+tiddler.title+"]] |"VIDEO" |\n"
!begin
"|sortable|k\n|!Name|!Video|h\n"
!end
"!!!"+count+" items listed\n"
!none
"!!!No items listed\n"
!STOP (terminates last section)
%/
---------------------------------------------------------------------------------------
but I got the syntax error message:

"Missing ; before statement"

Michael

On Mar 7, 5:46 pm, Eric Shulman <[email protected]> wrote:
> > I use Udo's ForEachTiddlerPlugin. In <<foreachtidder>-syntax double
> > quotes are text string terminators. How can I mask double quotes when
> > used in text string?
>
> Because the parameters of <forEachTiddler>> are already enclosed by
> double-quotes and the whole macro is, of course, surrounded by "<<"
> and ">>", using those delimiters within the parameter values can be
> very difficult, as you've discovered.
>
> The usual workaround is to substitute some kind of alternative
> sequence, such as a backslash-quote (\") or the equivalent hex-code
> (\x22).  You can also use the single-quote to surround the parameter,
> so that the double-quotes can be used within (but then you can't use
> the single-quote within the parameters... it's one or the other... :-
> (  In any event, this approach typically produces hard-to-read code
> that is prone to typo-induced errors due to improper quoting.
>
> Fortunately, I've come up with a completely different approach that
> offers a way out...  I call them "compound macros":
>
> Instead of wrestling with special character sequences to mimic the
> embedded quotes and other delimiters, use *computed parameters* that
> retrieve the needed values from separately defined, *hidden tiddler
> sections* with the same tiddler to assemble and invoke the macro.
> This allows you to use virtually any variety of TW syntax within the
> sections (except for "!" of course, which is used to define the
> section headings), including single and double quotes, TW formatting
> and macros, multiple content lines with whitespace, etc.
>
> For example, create a tiddler called [[ShowStuff]], containing:
> ------------------------
> <<forEachTiddler
>    where {{store.getTiddlerText("ShowStuff##where")}}
>    sortBy {{store.getTiddlerText("ShowStuff##sortBy")}}
>    script {{store.getTiddlerText("ShowStuff##script")}}
>    write {{store.getTiddlerText("ShowStuff##write")}}
>    begin {{store.getTiddlerText("ShowStuff##begin")}}
>    end {{store.getTiddlerText("ShowStuff##end")}}
>    none {{store.getTiddlerText("ShowStuff##none")}}>>/%
>
> !where
> enter where clause here
> !sortBy
> enter sort expression here
> !script
> enter script code here
> !write
> enter text here
> !begin
> enter text here
> !end
> enter text here
> !none
> enter text here
> !STOP (terminates last section)
> %/
> ------------------------
>
> To easily embed this compound macro in other tiddler content, simply
> use:
>    <<tiddler ShowStuff>>
> or even
>    <<tiddler ShowStuff with: foo bar baz>>
> where the content in ShowStuff has embedded $1, $2 and $3 as
> substitution markers where foo, bar and baz will be automatically
> inserted before invoking the compound forEachTiddler macro itself.
>
> 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