Macro's not working (anymore?)

100 views
Skip to first unread message

Ray Vermey

unread,
Mar 9, 2021, 8:26:38 AM3/9/21
to TiddlyWiki
Hi all

i have a strange phenonemon.....

I put a macro definition in a tiddler.
I give it the correct macro tag.

I have a new tiddler where i call this macro with << .. >>
And nothing happens.....

I do exactly the same in a new wiki from tiddlywiki.com and it works!!

How can it have happend that all of a sudden my macro's are not working anymore??
This is soo strange cause i also have some plugins that work fine.....

Thanks for helping...

Ray

Mark S.

unread,
Mar 9, 2021, 9:15:14 AM3/9/21
to TiddlyWiki
We really need to see a screenshot of your work. Or, ideally the work itself. It's really easy to make a small spelling mistakes with those tags. Esp. check if you've added any spaces by accident.

Ray Vermey

unread,
Mar 9, 2021, 9:25:45 AM3/9/21
to Mohammad Rahmani
Well i copy pasted it... but if you want i can send you my TW file?

Tx

Ray

Op di 9 mrt. 2021 om 15:15 schreef 'Mark S.' via TiddlyWiki <tiddl...@googlegroups.com>:
--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/d0kNmyz--Wc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/5d93334a-8f77-4037-bad9-1ccb1addf949n%40googlegroups.com.

Mark S.

unread,
Mar 9, 2021, 9:44:00 AM3/9/21
to TiddlyWiki
We don't even know what the macro does. So, seeing the contents of the macro might help. You can export the tiddler with the definition and the tiddler where it is invoked but fails as JSON and post them here.

Ray Vermey

unread,
Mar 9, 2021, 10:11:22 AM3/9/21
to Mohammad Rahmani
It is straight taken from this page:


1 for the Macro call

\define sayhi(name:"Bugs Bunny" address:"Rabbit Hole Hill")
Hi, I'm $name$ and I live in $address$.
\end
1 for calling the macro with << .. >>

<<sayhi>>

On my wiki html standalone google drive saved file the macro returns nothing (while other plugins for instance work fine)

Exactly the same procedure on an empty Tiddlywiki.com site it works....

So i am totally confused.... (again :-) )

Ray



Op di 9 mrt. 2021 om 15:44 schreef 'Mark S.' via TiddlyWiki <tiddl...@googlegroups.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/e9f3633e-482e-49a3-a9b8-5123383c7240n%40googlegroups.com.

Mark S.

unread,
Mar 9, 2021, 11:04:27 AM3/9/21
to TiddlyWiki
But, without seeing your actual tiddler definition, we can't be sure that you haven't mis-tagged it. 

Ray Vermey

unread,
Mar 9, 2021, 11:45:38 AM3/9/21
to Mohammad Rahmani
Ok is this what you mean?

2 json files attached..

Tx

Ray

Op di 9 mrt. 2021 om 15:44 schreef 'Mark S.' via TiddlyWiki <tiddl...@googlegroups.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/e9f3633e-482e-49a3-a9b8-5123383c7240n%40googlegroups.com.
New Tiddler.json
sayhi.json

Mohammad Rahmani

unread,
Mar 9, 2021, 12:14:02 PM3/9/21
to tiddl...@googlegroups.com, Jeremy Ruston
Rey,
 Your tag is wrong! tag the macro tiddler as "$:/tags/Macro"  NOT " $:/tags/Macro"   NOTE TO EXTRA SPACE in front of tag
 I put the tag intentionally inside " " to explain the issue! They are not required and should be removed!

Could you tell us why you add extra space in front of the tag?


I think this is an issue! TW shall trim the leading and trailing spaces in tags!


Best wishes
Mohammad


Ray Vermey

unread,
Mar 9, 2021, 1:27:08 PM3/9/21
to Mohammad Rahmani
Stange, i deleted the tag, re-entered it, still the problem.
Put the tag for the second time, behind the 1st, it worked.
Now all is fine.
Thanks for investigating this friends!

Ray

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

Ray Vermey

unread,
Mar 9, 2021, 4:01:43 PM3/9/21
to Mohammad Rahmani
OK, so now i have the macro's working. Thanks to you forum members!
I have the following:

Macro extract-from-tag:

\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

Then i call it like so in a new tiddler:

<<extract-from-tag [[naamOfTiddler] "9 Mar 21">>

And in that tiddler i start the log of today with:

<9 Mar 21>
..
--
log.
..
..
</9 Mar 21>

The macro returns the logtext between the two 9 Ma tags, great!
Now i have two questions:

1) The text is one lone line, no linebreaks (in the log i use <br> at the end of the lines)
    Also tiddlerreferences like [[otherTiddler]] are not evaluated or clickable... i would like to be able to click on them

2) Now i run the macro on 1 specific tiddler. Can i run the macro on ALL tiddlers containing the 9 Mar 21 string??

If someone has an idea i'd be happy to learn..

Thanks

Ray

Op di 9 mrt. 2021 om 19:26 schreef Ray Vermey <rayv...@gmail.com>:

Mohammad Rahmani

unread,
Mar 9, 2021, 11:01:56 PM3/9/21
to tiddl...@googlegroups.com
On Wed, Mar 10, 2021 at 12:31 AM Ray Vermey <rayv...@gmail.com> wrote:
OK, so now i have the macro's working. Thanks to you forum members!
I have the following:

Macro extract-from-tag:

\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

Then i call it like so in a new tiddler:

<<extract-from-tag [[naamOfTiddler] "9 Mar 21">>

You call the macro wrongly
- the [[ is imbalanced
- there is no need to wrap the macro name inside [[ ]]
- the tag passed is not correct! html tags have no space in name

Correct example
<<extract-from-tag "naamOfTiddler" "div">>  
or 
<<extract-from-tag "naamOfTiddler" "section">>    

 

Mohammad Rahmani

unread,
Mar 9, 2021, 11:09:59 PM3/9/21
to tiddl...@googlegroups.com
On Wed, Mar 10, 2021 at 12:31 AM Ray Vermey <rayv...@gmail.com> wrote:
YES! But the above macro does not work on "9 Mar 21" as a delimiter (html tag!


 
Reply all
Reply to author
Forward
0 new messages