Applying ReplacePragma to all Tiddlers of a certain type

69 views
Skip to first unread message

Jan

unread,
Sep 3, 2017, 7:49:54 PM9/3/17
to tiddlywiki
Hi everybody.
On the topic of creating new markup parsers (especially creating a parser for screenplays)Mat suggested to use Skeeve's  ReplacePragma.
I found out that it does a great job if the replacement-code is marked on top of the tiddler.

\replace /\n!/\n\n!/
\replace /\n:/\n\n:/
\replace /\n{{/\n\n:{{/ would fix the problem that the lists I want to use for formatting could easily be broken by a missing blank line.

This is great, but of course I do not want to insert these lines into every tiddler.
Is there a way to apply it to multiple Tiddlers by type or by filter?
I think it would be a great feature also for other usecases and shorthands in TW.

Yours Jan




@TiddlyTweeter

unread,
Sep 4, 2017, 6:11:29 AM9/4/17
to TiddlyWiki
Ciao Jan

Jan wrote:
... use Skeeve's  ReplacePragma. I found out that it does a great job if the replacement-code is marked on top of the tiddler.
 
... Is there a way to apply it to multiple Tiddlers by type or by filter? I think it would be a great feature also for other usecases

I can't help you program it.

Am I right in thinking that you only want the ReplacePragma activated when a Tiddler is of ONE "content type"? I think that can be done inside a "Save" button.

I do know its possible to limit contained macros going active under a save button to certain content types or under specified tags. That was what Mark S. did to help me with the "hashtag2tag" thing (see https://groups.google.com/forum/#!topic/tiddlywiki/4hE3-KUOqkY for a worked through example).

I also am looking at the ReplacePragma. There was slightly depressing discussion of it in the past https://groups.google.com/forum/#!searchin/tiddlywiki/replacepragma%7Csort:relevance/tiddlywiki/52Hwa_oCLRk/gLLzQrmG87oJ.

I am unclear IF you avoid potential issues with the ReplacePragma using a new "content type"? It seems important to answer that question. We don't want to be working on something that then trips us up.

Certainly for what we both want a new content-type might be merited? What would you call it to be compliant with content descriptions? How would you create it?

One thing that is a lot clearer to me than it was is that some of the questions on formatting Screenplays raise are pertinent to all types of markup. It would help, I think, if the whole procedure were easier and "closer to the surface"--so that you could create new markup schema in a simpler way.

Still largely-in-the-dark
Josiah

Jan

unread,
Sep 4, 2017, 7:47:28 AM9/4/17
to tiddl...@googlegroups.com
Hi Josiah,
In thinking to apply the pragma to a contenttype I just thought this would be the easiest (and safest) way to filter where to use this pragma. If this was possible I would also like to have a filter applying it to all Tiddlers tagged Scene for example. I would not use it for the entire wiki because it could mash-up the markup of existing tiddlers.

What is your Idea about the Save-button? This seems to be interesting but I do not understand it yet.

I will take a look at the examples you mentioned where the replacepragma (or something similar) is in use. Thanks for bringing this into my attention, the hashtag-problem seems to be similar.


Yours Jan
--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/bde5c484-ac63-41fa-976d-05d5bd813565%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

@TiddlyTweeter

unread,
Sep 4, 2017, 8:28:38 AM9/4/17
to tiddl...@googlegroups.com
Jan asked ...
What is your Idea about the Save-button? This seems to be interesting but I do not understand it yet.

Limiting the action on a Save-button to specific criteria is a lot easier than you might think ...

The Save behaviour can have SUB-ROUTINES wrapped like this that only apply to certain cases ... Put that FIRST. For OTHER cases it continues as normal.

<$list filter="[all[current]tag[Tweet]type[text/plain]]">

<$set name=test value="" filter="
[
<currentTiddler>get[text]regexps[(?g)#\w+\b]tolower[]]
">
   [... all sorts of code to do changes ...]
   [... saves & exits ...]
</$list>

   [... normal saving for other cases where the first filter does not apply ...]

I need underline I don't really know HOW this works, just that it does.

Josiah

Jan

unread,
Sep 4, 2017, 8:59:25 AM9/4/17
to tiddl...@googlegroups.com
Hi Josiah,
do I understand correctly that your proposition will repair the text permanently?
The replacePragma would leave it untouched and just change the way it is displayed by doing the replacements during parsing...And I would very much prefer this
On the one hand because the risks are lower.
On the other hand this makes it possible to find a markup that also look good in the EditingMode.

I think having such a tool would really advance us a great deal.

Yours Jan





Am 04.09.2017 um 14:28 schrieb @TiddlyTweeter:
Jan asked ...
What is your Idea about the Save-button? This seems to be interesting but I do not understand it yet.

Limiting the action on a Save-button to specific criteria is a lot easier than you might think ...

The Save behaviour can have SUB-ROUTINES wrapped like this that only apply to certain cases ... Put that FIRST. For OTHER cases it continues as normal.

<$list filter="[all[current]tag[Tweet]type[text/plain]]">

<$set name=test value="" filter="
[
<currentTiddler>
get[text]regexps[(?g)#\w+\b]tolower[]]
">
   [... all sorts of code to execute it ...]

</$list>

   [... then normal saving for other cases ...]

I need underline I don't really know HOW this works, just that it does.

Josiah
--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

@TiddlyTweeter

unread,
Sep 4, 2017, 9:19:25 AM9/4/17
to TiddlyWiki
Ciao Jan

Jan wrote: ... do I understand correctly that your proposition will repair the text permanently?

Duh! me.
You are absolutely right. It is NOT the solution. You don't want the coded text changed. You just need a VISUAL REPRESENTATION. So its to do with how TW shows content AFTER a regex has run BUT without changing the underlying text.

The hastag2tag way is suggestive but we not talking about a save on screenplays, which should stay just as written.

We talking about an HTML render? Right. A View Template?

I don't know enough about how that works.

Josiah

Jan

unread,
Sep 4, 2017, 10:11:56 AM9/4/17
to tiddl...@googlegroups.com
Hi Josiah!
So far the pragma looks for the rules in the TiddlerText and as I understand, at that level transcluding won't work.
I see no way of getting the replacePragma to work on other Tiddlers without changing directly the .js and perhaps making it configurable.

Perhaps you could use your range in poining out the importance of this for markup...

Yours Jan
--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
Reply all
Reply to author
Forward
0 new messages