\rules only

156 views
Skip to first unread message

S. S.

unread,
Jan 9, 2019, 7:25:56 PM1/9/19
to TiddlyWiki
In this GoogleGroups post: W5 plugin: escapecss[] filter 

BurningTreeC uses: \rules only at one point inside a macro

On tiddywiki.com I read the tiddler: Pragma but I didn't really understand what \rules could do.
In the tiddler: Using Stylesheets it has this:
\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline html

Is there a place that explains:
1) What are all the different \rules.
2) How are they used (what do they do)?

If not, it would be useful to know.

Thanks!

S. S.

unread,
Jan 9, 2019, 7:35:24 PM1/9/19
to TiddlyWiki
This is where I reached:

In the tiddler: $:/core/modules/parsers/wikiparser/rules/ it says:

Wiki pragma rule for rules specifications

\rules except ruleone ruletwo rulethree
\rules only ruleone ruletwo rulethree

In Advanced Search , on the Shadows tab , I searched for: $:/core/modules/parsers/wikiparser/rules/

There are a little over 35 rules - perhaps these are all the rules availbale!

So, now, why do we use them, and where is this useful?

BurningTreeC

unread,
Jan 9, 2019, 7:42:18 PM1/9/19
to TiddlyWiki
Hi S.S.,

that's a very good question and I'm glad you're opening a discussion about it

these pragmas are very under-documented (is that english?)
I don't have a good overview neither. It would be very useful if we can create one and finally create documentation on tiddlywiki.com

the \rules pragma defines the rules for the wiki-parser that should be applied for the following block/for the macro/for the tiddler - that's how I understand it
I'm using "\rules only" - note: without specifying rules - to switch OFF processing within that macro, so that text doesn't get wikified whatever that means - the text produced within that macro should look exactly like its input, parser please don't change it

TonyM

unread,
Jan 9, 2019, 7:48:48 PM1/9/19
to TiddlyWiki
Folks,

I would be keen to know more as well but as I understand it these are the parsing rules applied to the wikification of a tiddlers content as found in control panel > info > advanced > parsing (bit which applies to the whole wiki)

Do be carful and backup because some of these could damage the user interface and leave your wiki broken.

Regards
Tony

BurningTreeC

unread,
Jan 9, 2019, 7:54:31 PM1/9/19
to TiddlyWiki
Yes, very good point! Don't use them if you don't know why
such a rule can be used on top of a macro - then it gets applied to that macro-body only, like:

\define mymacro()
\rules only somerule anotherrule
macro, do your work here
\end

this rules pragma is only "active" for whatever is between \define and \end

I'd add that such experiments should be done in dedicated throwaway-wikies and one should expect them to break from time to time
Message has been deleted

Ton Gerner

unread,
Jan 10, 2019, 8:06:26 AM1/10/19
to TiddlyWiki
Hi all,

Control panel > Info > Advanced > Parsing shows the list of wiki parser rules.

Cheers,

Ton

BurningTreeC

unread,
Jan 10, 2019, 10:08:11 AM1/10/19
to TiddlyWiki

Hi all,

Control panel > Info > Advanced > Parsing shows the list of wiki parser rules.

Thanks Ton, I think this simple line should be on top of the doc tiddler on tidd.com
Cheers,

Ton

 

S. S.

unread,
Jan 10, 2019, 8:33:21 PM1/10/19
to TiddlyWiki
Thanks everyone for explaining. The fog is clearing.

One case I have where it is immediately useful - when CamelCase is turned on and I don't want CamelCase linking to apply. This can cause mayhem when working with variables that contain text in CamelCase. I only realised this when, for testing, I moved a perfectly working macro (where CamelCase was off) into tiddlywiki.com (where CamelCase is on). I found it extremely difficult to fix!

Abbreviated example: In tiddlywiki.com try the below with and without the \rules line.

\define makeLink(site link)
\rules except wikilink
<a href="$link$" target="_blank">$site$</a>
\end

<<makeLink TiddlyWiki https:/
/tiddlywiki.com/>>

With \rules except wikilink - the link created is correct: TiddlyWiki : https://tiddlywiki.com/
Without \rules - the link is wrong:
TiddlyWiki : https://tiddlywiki.com/#TiddlyWiki

Cheers


On Thursday, January 10, 2019 at 6:01:25 PM UTC+7, @TiddlyTweeter wrote:
The "pragma" can be switched off or switched on selectively as others have indicated. This can be done inside macros or applied to a single tiddler on its own via \rules.

TonyM also pointed out that you can also globally selectively toggle many of the pragma in settings.

I agree it can be helpful to understand what is going on with them. A major purpose is many (most?) do the basic parsing of raw content of Tiddlers into rendered HTML.

They have been of much interest to me because I do a lot of work using TW to process and auto-convert non-standard text formats. 

It is in fact possible to access the TW process prior to the standard pragma. This can give you amazing flexibility in combining ad-hoc text changes for "pre-conversion" of non-standard text formats that then are further processed using the standard parsers.

I mention this because its given me quite a lot understanding of pragma in TW. Note that Content Types can define which pragma to run and offer ways you can make new pragma. Its possible to make new Content Types.

The best resources I know about this are from BJ's work ...



Here are discussions that may shed a bit of light on this largely undocumented topic ...



Best wishes
Josiah

S. S.

unread,
Jan 12, 2019, 8:43:50 AM1/12/19
to TiddlyWiki
The full working macro where I used: \rules except wikilink
Here: Dictionary - lookup macro

Cheers!

Ste Wilson

unread,
Jan 13, 2019, 7:35:34 AM1/13/19
to TiddlyWiki
Oooh! That's quite cool!
Reply all
Reply to author
Forward
0 new messages