How to get current tiddler title string and then encodeuri it?

69 views
Skip to first unread message

Dunstan Hume

unread,
May 21, 2019, 9:40:14 PM5/21/19
to TiddlyWiki
Hello, I've been trying for hours and I can't seem to get my macro working

\define encodeTitleString(text)
[[$(currentTiddler)$]] +[encodeuri[]]
\end

How do I get it to get the title of the current tiddler, then spit out the encoded string?

Mark S.

unread,
May 21, 2019, 10:46:48 PM5/21/19
to TiddlyWiki


You can display the title like this:

{{{ [<currentTiddler>] +[encodeuri[]] }}}

"encodeuri" has to be invoked inside a filter. Triple {{{ }}} brackets are one way of doing that. But you may have had something else in mind.

Good luck!

Dunstan Hume

unread,
May 22, 2019, 2:28:56 AM5/22/19
to tiddl...@googlegroups.com
Thank you, that helped me a bit to understand. I still couldn't make it work anywhere in any of my codes. Is it possible to put it in $vars?

<$vars titleName={{{ [<currentTiddler>] +[encodeuri[]] }}}>
<a href="$titleName$">Link</a>
</$vars>

Can't seem to get it right.

TonyM

unread,
May 22, 2019, 6:25:05 AM5/22/19
to TiddlyWiki
Dustan,

Use the variable you created with the vars?

<$vars titleName={{{ [<currentTiddler>] +[encodeuri[]] }}}>

<a href=<<titleName>> >Link</a>
</$vars>


Tony

Dunstan Hume

unread,
May 22, 2019, 9:43:36 AM5/22/19
to TiddlyWiki
Thank you! I managed to get it to work, then had to abandon it. I was adding it to CSS classnames and ids.
The output didn't encode single quotes, which broke CSS naming or something.

I would still like to know though, is there a way to force the single-quotes to be encoded?
Escaping them doesn't seem to work for CSS too.

TonyM

unread,
May 22, 2019, 6:11:03 PM5/22/19
to TiddlyWiki
Dunstan

We need more info to help fully. Like where are you using the result.

The view widget also offers encoding.

Regards
Tony

Reply all
Reply to author
Forward
0 new messages