How to transclude field containing HTML-Markup but disable certain wikirules?

106 views
Skip to first unread message

compa...@gmail.com

unread,
May 14, 2021, 5:49:46 AM5/14/21
to TiddlyWiki

Hi,

i have a tiddler containing fields with HTML-Markup (i import from elsewhere) that i want to have rendered as is but without applying all the wikirules AND i don't want to add a \rules-pragma to all the fields. I can't get my desired output (played a lot with {{-Translusion, <$transclude>, <$wikify>, <$viewwidget>, <$textwidget> and nesting combinations of them. To make it clearer i attached two tiddlers showcasing my problem:
  • my-case-with-corrupted-output.json containing the data as i receive them from the input with just a simple {{-Translusion and showing how it should NOT be rendered (markups '' and // are interpreted, what i don't want)
  • expected-output-but-with-with-rules-pragma-inside-field-values.json containing the same data but with the \rules-pragma added (as i mentioned above: i don't want to pollute the fields with that) => actually just a showcase to understand better how i want the two fields to be rendered in the output
Regarding these two files the final question is fairly simple: how whould i need to change my-case-with-corrupted-output.json to output html1 and html2 like it can be seen in expected-output-but-with-with-rules-pragma-inside-field-values.json below the <hr>-Element but WITHOUT changing the values inside the fields?

Thanks a lot,
Mirko




my-case-with-corrupted-output.json
expected-output-but-with-with-rules-pragma-inside-field-values.json

compa...@gmail.com

unread,
May 14, 2021, 6:02:13 AM5/14/21
to TiddlyWiki
Ob02ZYA6ks.png

PMario

unread,
May 14, 2021, 10:57:05 AM5/14/21
to TiddlyWiki
Hi Mirko,

There is no easy way to do what you want atm.

The only thing I can do is make your \rule easier: You can use \rules only html 

For all of your fields. So you can have a simple "copy / paste", which is easier than your "except" adjustments.

-mario

PMario

unread,
May 14, 2021, 11:04:30 AM5/14/21
to TiddlyWiki
Hi,
It's probably worth a "feature request at github". ... The internal function is $tw.wiki.parseText() ... which probably should have an option to define wiki-rules, that are predefined an not part of the text.
-mario

PMario

unread,
May 14, 2021, 11:47:46 AM5/14/21
to TiddlyWiki
Hi
I did find something, but don't know if it fits your needs.

\define template()
<$fields include=<<field>> template="\rules only html

$value$"/>
\end

<$list filter="html1 html2" variable=field>
<$wikify name=xx text=<<template>>>
<<xx>>
</$wikify>
</$list>


A second / different version is in the attachment. It uses a template tiddler instead of the \define.

have fun!
mario

expected-output-wit-template-tiddler.json

compa...@gmail.com

unread,
May 14, 2021, 3:00:52 PM5/14/21
to TiddlyWiki
Hi Mario,

thanks, that's great and perfectly works for my case!
Creating a template by outputting the \rules-pragma and the content of the fields and than wikify the result, was an approach i was also after, but couldn't get it to work with Wikify, ViewWidget and the like. I wasn't aware of the FieldsWidget, thanks a lot!

Had fun,
Mirko

PMario

unread,
May 15, 2021, 1:35:49 AM5/15/21
to TiddlyWiki
So there is a chance, that we can make it easier to get your usecase covered.

As you can see from my posts, I first thought, it can't be done at all. Then i did think about to use the fields widget, which has its own template parameter, that is handled internally.

So the resulting "code" is a bit clunky, but it should work as a workaround. There may be better ways, but I couldn't find them. ... And I did try for about an hour, as the timestamps of my posts show.

-mario

Reply all
Reply to author
Forward
0 new messages