Question if it can be done: a special kind of stamp

168 views
Skip to first unread message

David Gifford

unread,
Nov 17, 2019, 1:30:25 PM11/17/19
to TiddlyWiki
Hi all

Is it possible to create a stamp that

1) grabs the title of the current tiddler, and
2) stamps it as text?

Use case: I take notes on reading in chapters of books, and in webpages, and would like to more quickly stamp their sources after the note or snippet in question. If the title of the tiddler is "https://..." or "Book (Author), ch 1", then by clicking on a button in the edittoolbar I could quickly add the source.

Mark S.

unread,
Nov 17, 2019, 2:34:55 PM11/17/19
to tiddl...@googlegroups.com
I've been thinking for awhile that it would be neat to have a "dynamic" stamp, that doesn't just paste text, but renders it first.

Here's a first step towards that. Drag and drop the attached into your backed-up TW. Reload.

This will put a second stamp symbol in your editor. This stamp will attempt to render your stamp snippets. I've provided two
stamps. One generates the current time. The other generates the current title IF this is the only tiddler being edited
at the moment. I didn't have a way to grab the current title. Possibly it's in the code somewhere. So ... first stab.

A better approach would be to have snippets that could be tagged as "dynamic". Then there would be only one stamp tool
in the toolbar. But that would require changing core code, so this will have to do for now.

Hope this is what you were looking for!

-- Mark
tiddlers-dynamic-stamp.json

Mark S.

unread,
Nov 17, 2019, 2:35:39 PM11/17/19
to TiddlyWiki
It would be really helpful if I actually attached the file ...
tiddlers-dynamic-stamp.json

David Gifford

unread,
Nov 17, 2019, 2:52:36 PM11/17/19
to TiddlyWiki
Wow, Mark, this is great! Thank you!

Okay, next question: would there be a way for me to edit this so that the title gets wrapped in a span class? I tried editing

"Snippet - Title of draft tiddler",

but while it stamped regular text I had added, it did not stamp the span class.


Mark S.

unread,
Nov 17, 2019, 3:38:56 PM11/17/19
to TiddlyWiki
This seemed to work in the title snippet:

<$vars myspan="<span class='gifford'>" myspanx="</span>" >
{{{ [all[tiddlers]removeprefix[Draft of ']removesuffix[']addprefix<myspan>addsuffix<myspanx>] }}}
</$vars>

You can see where to change the class name as needed.

David Gifford

unread,
Nov 17, 2019, 4:05:31 PM11/17/19
to TiddlyWiki
Mark, if I were to have more kids I would name one after you! Thank you so much!

David Gifford

unread,
Nov 21, 2019, 8:19:12 AM11/21/19
to TiddlyWiki
Hi Mark (and anyone else who happens to see this)

Would there be a way to create a stamp for the following?

[[sources| + datetimestamp of now + ]]

My use case is taking a note, then having a link to another tiddler, with the current date and time as its title, containing links to sources. I would stamp the above in my notes tiddler, save the notes tiddler, then click on the link to create the datetimestamp tiddler and add sources.

Mark S.

unread,
Nov 21, 2019, 9:40:46 AM11/21/19
to TiddlyWiki
<$vars now=<<now>> lb="[[" pipe="|" rb="]]">
{{{ [[sources]addprefix<lb>addsuffix<pipe>addsuffix<now>addsuffix<rb>] }}}
</$vars>

David Gifford

unread,
Nov 21, 2019, 6:12:42 PM11/21/19
to TiddlyWiki
Thanks Mark! I am going to give this a go! Blessings

Dave

David Gifford

unread,
Jan 6, 2020, 8:27:35 AM1/6/20
to TiddlyWiki
Delayed reaction, I stepped away from this and came back to it. Works awesome. Thank you Mark!


On Thursday, November 21, 2019 at 8:40:46 AM UTC-6, Mark S. wrote:
Reply all
Reply to author
Forward
0 new messages