Hi Andreas

> I ran into the problem, that widgets and HTML fall into the same wiki
parsing rule (as far as I know). So there is no good way to generate HTML
USING widgets. So my question is: Is there another option (when you can't
do 1. for some reason)

The approach that the core uses in the templates that general HTML output
is to have the HTML tags that you want in the output to be plain text,
leaving the "invisible" widgets for list widgets etc.

So, you're first example could be done like this:

<$list filter="1 2 3">
`<h1 class="`<$text text=<<currentTiddler>>/>`">`<$text
text=<<currentTiddler>>/>`</h1>`
</$list>

It would get quite hairy to do too much of that, so the core makes
extensive use of the template "$:/core/templates/html-tiddler" which uses
the view widget to render a tiddler as wikified HTML.

For example:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core%2Ftemplates%2Fstatic.tiddler.html.tid

This example takes a different approach; it disables widget/html rule
parsing, causing html tags to be passed through wikification untouched, and
relies on the wikitext transclusion syntax to bring in constituent content:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core%2Ftemplates%2Ftiddlywiki5.html.tid

Best wishes

Jeremy





On Fri, Dec 12, 2014 at 10:51 AM, Andreas Hahn <[email protected]>
wrote:
>
>  Am 12.12.2014 07:04, schrieb Stephan Hradek:
>
> Maybe this helps, putting it at the top of each tiddler:
>
>  \rules only html
>
>
> Thanks Stephan, I tried that, but I failed. Here is an example of what I
> mean: When using TW as a template engine, you might want to do something
> like this:
>
> \rules only html
>
> <$list filter="1 2 3">
> <h1 class="<$text text=<<currentTiddler>>/>"><$text 
> text=<<currentTiddler>>/></h1>
> </$list>
>
> Notice that "\rule only html" also parses the widgets. (Which is because
> internally HTML tags are treated as widgets). Thus the output here is:
>
> 1
> 2
> 3
>
> = with this underlying html code in the DOM =
>
> <h1 class="<$text text=<<currentTiddler>>/>">1</h1>
> <h1 class="<$text text=<<currentTiddler>>/>">2</h1>
> <h1 class="<$text text=<<currentTiddler>>/>">3</h1>
>
> But ideally it would be like this:
>
> \rules only widgets
>
> <$list filter="1 2 3">
> <h1 class="<$text text=<<currentTiddler>>/>"><$text 
> text=<<currentTiddler>>/></h1>
> </$list>
>
> = Output =
>
> <h1 class="1">1</h1>
> <h1 class="2">2</h1>
> <h1 class="3">3</h1>
>
> But from what I have gathered thats not possible.
>
> /Andreas
>
> P.S: You might say: Hey wait a moment Andreas, you can do this:
>
> \rules only html macrocallblock macrocallinline
>
> <$list filter="1 2 3">
> <h1 class=<<currentTiddler>>> <<currentTiddler>> </h1>
> </$list>
>
> And then get to your target HTML by using
>
> <$view tiddler="targetTiddler" format="htmlwikified"/>
>
> which will actually work for this instance, but will fail when HTML tags
> like <script> or more complicated widgets are involved. (Which they will
> be if you are trying to use TW's mechanisms to generate the source code of
> a website for example.)
>
> Due to this, it is much better to build the content you want to generate
> with TW and later try to get a good source code out of it, rather than
> building the desired source code directly. But in my opinion, it should be
> possible to generate XML based formats from TW (think XSLT, RSS) and using
> the full potential of the TW widgets.
>
> --
> 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.
>


-- 
Jeremy Ruston
mailto:[email protected]

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

Reply via email to