Hi Stephan

On Sun, Nov 17, 2013 at 9:05 PM, Stephan Hradek <stephan.hra...@gmail.com>wrote:

> Did you see the "Another try?" tiddler? I think I'll stick to that
> solution.
>

Ah, no I didn't, and it's a much, much better solution. Thank you.


> The only thing I didn't get was: Why do the macros not simply generate
> wikitext-source, but something else? I mean, when in
>

Macros are actually implemented as a widget called <$macrocall>. Like all
widgets, they are updated dynamically when any underlying data changes. To
make this process efficient it's important to be able to update an
individual widget without disturbing the widgets around it. This allows TW5
to efficiently render lists of thousands of tiddlers, and selectively
update just the bits that have changed. In terms of macro calls, that means
that we need to be able to parse the text of the macro when it changes
without having to reparse the surrounding text.

A different implementation might expand the text of all macros before
wikifying the entire tiddler but that makes it harder to efficiently do
that selective updating of the DOM without adding a great deal more
complexity.


\define macro()
# element
\end

<<macro>>
<<macro>>
<<macro>>
<<macro>>


<<macro>> would simply return "# element", wouldn't we simply wikify

# element
# element
# element
# element


The substitution of macro parameters does happen as you are imagining here:
all the macro parameters are replaced, and the entire text of the macro is
parsed.

So, if you want to build up bits of wikitext syntax bit by bit, you'll
probably want to do the crucial bits within a macro definition.

And I also don't get why
<<macro>><<macro>><<macro>><<macro>>
doesn't work.

That's a bug, will be fixed in alpha.15.

Best wishes

Jeremy.





-- 
Jeremy Ruston
mailto:jeremy.rus...@gmail.com

-- 
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.

Reply via email to