Q: for Mohammad - extract-from-tag macro

70 views
Skip to first unread message

Ray Vermey

unread,
Mar 8, 2021, 4:06:52 PM3/8/21
to TiddlyWiki
Hi Mohammad


I try the extract-from-tag macro but that doesn't seem to work.
I copied it from the page but calling the macro does not seem to work.
Can you shed some light?

Tx

Ray

Mohammad Rahmani

unread,
Mar 8, 2021, 10:43:49 PM3/8/21
to tiddl...@googlegroups.com
Hi Rey,
Examples and description for how use extract by tag can be found here

It is used for HTML tags! and not related to TW tags!

The author of this part is Mark S

In brief you can use this macro to extract contents inside a <htmltag> .... </htmltag>



Best wishes
Mohammad


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/aad64424-5f63-4117-b3b7-b85c2d921daan%40googlegroups.com.

Ray Vermey

unread,
Mar 9, 2021, 2:05:39 AM3/9/21
to Mohammad Rahmani
Yes and doing exactly that does not seem to work.
That is my question :-)

Ray

9 mrt. 2021 04:43:50 Mohammad Rahmani <mohammad...@gmail.com>:

Mohammad Rahmani

unread,
Mar 9, 2021, 2:23:24 AM3/9/21
to tiddl...@googlegroups.com
Rey,
 The example in the description page works. Would you please give me a minimal example to see what the problem is!



Best wishes
Mohammad


Ray Vermey

unread,
Mar 9, 2021, 2:32:57 AM3/9/21
to Mohammad Rahmani
the macro:

\define extract-from-tag(tid, tagname)
<$list filter="""[{$tid$}splitregexp[\n]join[ ]splitregexp[<$tagname$.*?>]butfirst[1]]""" variable=item>
<$list filter="""[<item>splitregexp[</$tagname$>]butlast[1]]""" variable=item2>
<$text text=<<item2>>/><br/>
</$list>
</$list>
\end


The tiddler calling it

<<extract-from-tag ttt russ>>

The tiddler with the data

Morbi non enim facilisis, lacinia odio volutpat, congue arcu. Sed vel ullamcorper
magna, maximus malesuada nulla. Fusce pharetra commodo facilisis. <russ class="fred">---- #1 This is not
 Latin.----</russ> Integer in justo ac diam <russ class="fred">---- #2 This is not Latin either.----</russ>
lobortis eleifend. Nullam vitae sollicitudin risus. Etiam ut aliquet nulla.
Morbi facilisis urna id lacus feugiat suscipit.

Quisque a nulla luctus lacus tincidunt euismod. Duis condimentum luctus leo a tristique.
Donec quis vulputate arcu, non lacinia purus. Nullam sit amet interdum
lorem. <russ class="fred">---- #3 Nor is this Latin.----</russ>

Op di 9 mrt. 2021 om 08:23 schreef Mohammad Rahmani <mohammad...@gmail.com>:

Mohammad Rahmani

unread,
Mar 9, 2021, 2:40:34 AM3/9/21
to tiddl...@googlegroups.com
Rey,
 You have copied the example from http://tw-regexp.tiddlyspot.com/ 
 It works fine! It extracts the content inside <russ> ...</russ> tags correctly!
 So what is wrong here? What do you expect to see as output?


Best wishes
Mohammad


Ray Vermey

unread,
Mar 9, 2021, 2:50:48 AM3/9/21
to Mohammad Rahmani
I expect the same outcome as the example, but i see no result :-)

Op di 9 mrt. 2021 om 08:40 schreef Mohammad Rahmani <mohammad...@gmail.com>:

Mohammad Rahmani

unread,
Mar 9, 2021, 3:24:35 AM3/9/21
to tiddl...@googlegroups.com
On Tue, Mar 9, 2021 at 11:20 AM Ray Vermey <rayv...@gmail.com> wrote:
I expect the same outcome as the example, but i see no result :-)

Ah okay  :-)

I have packaged the example and macro to test on https://tiddlywiki.com/
Simply download the JSON attached to this email and drag and drop on https://tiddlywiki.com/
Open Extract Contents between Html Tags 
and see the example!

Hope this help!

--Mohammad
extract-macro-with-example.json

Ray Vermey

unread,
Mar 9, 2021, 5:00:21 AM3/9/21
to Mohammad Rahmani
This is soooo strange
I tested it on tiddlywikki where it works.
The same 3 files on my own tw5 no go..... #puzzled

Ray

Op di 9 mrt. 2021 om 09:24 schreef Mohammad Rahmani <mohammad...@gmail.com>:
--
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.

Mohammad Rahmani

unread,
Mar 9, 2021, 6:05:12 AM3/9/21
to tiddl...@googlegroups.com
On Tue, Mar 9, 2021 at 1:30 PM Ray Vermey <rayv...@gmail.com> wrote:
This is soooo strange
I tested it on tiddlywikki where it works.
The same 3 files on my own tw5 no go..... #puzzled

;-) 


 

Ray

Op di 9 mrt. 2021 om 09:24 schreef Mohammad Rahmani <mohammad...@gmail.com>:

On Tue, Mar 9, 2021 at 11:20 AM Ray Vermey <rayv...@gmail.com> wrote:
I expect the same outcome as the example, but i see no result :-)

Ah okay  :-)

I have packaged the example and macro to test on https://tiddlywiki.com/
Simply download the JSON attached to this email and drag and drop on https://tiddlywiki.com/
Open Extract Contents between Html Tags 
and see the example!

Hope this help!

--Mohammad

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMA3%2BK4xgWexVt_51gc3YH%2B8C%2BKZCimk0nLbwuSp5_tPrw%40mail.gmail.com.

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

Ray Vermey

unread,
Mar 9, 2021, 6:39:11 AM3/9/21
to Mohammad Rahmani
Hmm the macro does not seem to do anything.
If i replace the macro with: {{{sometiddler}}} then there it displays the tiddler.
If i then call it from a new titddler like <<extract-from-macro>> nothing happens.....

And yes i tagged the macro with $:/tags/Macro ...............

Ray

Op di 9 mrt. 2021 om 12:05 schreef Mohammad Rahmani <mohammad...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages