Here’s a simple example of using the wikify widget:

<$set name="text" value="This is ''bold'' and this is //italic//">
<$wikify name="html" text=<<text>> output="html">
<$text text=<<html>>/>
</$wikify>
</$set>

And here’s the same example with the addition of adding the prefix:

\define rules()
\rules except italic

\end

<$set name="text" value="This is ''bold'' and this is //italic//">
<$set name="text" value={{{ [<text>addprefix<rules>] }}}>
<$wikify name="html" text=<<text>> output="html">
<$text text=<<html>>/>
</$wikify>
</$set>
</$set>

Best wishes

Jeremy


> On 10 Mar 2020, at 00:26, TonyM <[email protected]> wrote:
> 
> Jeremy, Stobot,
> 
> Any method that can make wikify behave better would be appreciated. 
> 
> Jeremy, can you give an example of this please
> One tip is to prepend the \rules pragma to the start of the text to be 
> wikified and thus restrict the wikitext rules that will be recognised.
> 
> Stobot, 
> I think your pattern could be of great use, pending a better method if you 
> could publish your code pattern with some examples It would be a good 
> contribution and others may also show alternative ways to achieve the same 
> thing. 
> There are a few cases where construction of filters before use would get 
> around other limitations or the need for nested filters. 
> I am also starting to configure some longer filters as global macros such as 
> standard-fields so they can be excluded from the result of the fields[] 
> operator.
> Share Share Share
> 
> Regards
> Tony
> 
> On Tuesday, March 10, 2020 at 7:51:47 AM UTC+11, Jeremy Ruston wrote:
> Hi Stobot
> 
>> I don't know if anyone else builds things like I do - with a ton of dynamic 
>> tables and branched lookups, but I use this pattern all the time:
>> 
>> \define macrotobuildfilter() ...
>> 
>> <$wikify name="macrotobuildfilterwiki" text=<<macrotobuildfilter>>>
>> <table>
>> <$list filter=<<macrotobuildfilterwiki>>>
>> ...
>> </$list>
>> </table>
>> </$wikfiy>
>> 
>> That's just with one, but usually I have a few nested ones. In fact I'll go 
>> so far as to say that more than half of the time I use a macro, I have to 
>> wikify it before use as it's being used as a parameter for something else.
> 
> The pattern you’re using here is a subtle one: to use the wikification 
> process to create filter strings. As you’ve probably gathered, it can be 
> quite brittle. For example, there can be problems if titles included in your 
> filter strings include wikitext markup (e.g. HTTP links contain an embedded 
> //). One tip is to prepend the \rules pragma to the start of the text to be 
> wikified and thus restrict the wikitext rules that will be recognised.
> 
>> I've often thought of how great it would be to have that wikification done 
>> in the same step - maybe with triple brackets like <<<wikified macro>>> ? 
>> Similarities to the {{{...}}} notation in a way. 
> 
> Yes, it’s somewhat anomalous that there isn’t a quoted attribute syntax that 
> returns the wikified value of the argument. Part of the reason is that as Mat 
> points out, wikification is a relatively slow process (unlike wikifying the 
> page we can’t do any selective refreshing, we have to process the entire text 
> on each refresh cycle).
> 
>> Is this possible? I see some other threads on additional parser rules, so 
>> thought it might be a good time to bring up. 
> 
> It might be worth experimenting with it, but I’d be concerned about 
> performance.
> 
> An alternative approach that might be a bit easier would be to create a 
> pragma that’s a shortcut for the wikify widget. Something like:
> 
> \define-with-wikification macrotobuildfilter() ...
> 
> <table>
> <$list filter=<<macrotobuildfilterwiki>>>
> ...
> </$list>
> </table>
> 
> An ordinary \define pragma generates a single <$set> widget; this new pragma 
> would generate a <$set> widget with a nested <$wikify> widget.
> 
> https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/parsers/wikiparser/rules/macrodef.js
>  
> <https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/parsers/wikiparser/rules/macrodef.js>
> 
> Best wishes
> 
> Jeremy
> 
>> 
>> -- 
>> 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 tiddl...@ <>googlegroups.com <http://googlegroups.com/>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/tiddlywiki/a0aff5bb-2aa3-4bc0-8094-72cf07c550a8%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/tiddlywiki/a0aff5bb-2aa3-4bc0-8094-72cf07c550a8%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywiki/d16dfbae-0bb9-403b-abf7-129918ba3ea1%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/d16dfbae-0bb9-403b-abf7-129918ba3ea1%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/B506EA94-7A16-4B94-A200-2EF35DDA3348%40gmail.com.

Reply via email to