Hi Mark, Andreas,
On Thursday, September 4, 2014 12:55:43 AM UTC+2, Andreas Hahn wrote:
>
> P.S.: Maybe someone can explain why that works and whether there is a
> better way or not :D
>
The TranscludeWidget docs has some info, but I think some experiments can
make it clearer.
*Some definitions first*
1) Widgets are wikitext.
2) The TW parser has 2 modes
- inline mode
- block mode
inline mode is needed to identify text formatting, like: bold, italic ...
eg: There is some ''bold text''.
block mode is used to identify blocks of text, like: paragraphs, headings,
lists ...
eg:
* //element a//
* ''element b''
* list c
Above we have a unorderd list (block) but inside the list we need to
identify bold and italic. So the parser identifies the unordered list
elements and then switches to inline mode.
---------------------
Experiments
a) create a tiddler named: bold with the following content
''some bold text''
b) create a tiddler named: paragraphs with the following content:
paragraph 1
paragraph 2
c) create a test tiddler with:
I want to see <$transclude tiddler=bold/>
* //element a//
* <$transclude tiddler=bold/>
* list c
which will result in:
I want to *see some bold text*
- *element a*
- *some bold text*
- list c
--> We are good here, since the transclusion widget is wikitext, it
inherits the parser mode, which is "inline" in both examples.
--> You are still with me? (I hope :)
now try:
* //element a//
* <$transclude tiddler=paragraphs/>
* list c
it results in
- *element a*
- paragraph 1 paragraph 2
- list c
--> The mechanism is the same, as with the first experiment. The parser is
in inline mode, because it has to. ... But that's not what we want. ... So
we need to tell the parser that our transclusion should be block mode.
* //element a//
* <$transclude tiddler=paragraphs mode=block/>
* list c
which gives us:
- *element a*
- paragraph 1
paragraph 2
- list c
-------------
@Andreas
I think there is no "better" easier way to do this. Many times you can use
{{ bold }} and {{paragraphs}} instead of <$transclude tiddler=bold/> which
is less typing.
But if you hit special cases, than the widgets have more possibilities .
hope that helps :)
have fun!
mario
[1] http://tiddlywiki.com/#TranscludeWidget
--
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 http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.