Variable as HTML Element Tags

38 views
Skip to first unread message

TJ Walker

unread,
Jan 31, 2019, 6:41:34 PM1/31/19
to TiddlyWiki
Just trying to wrap my head around affordances and syntax, here; as a trivial example, I thought I'd be able to:
<$set name=el value=div>
    <<
<el>> class="stuff">
        content
    </<
<el>>>
</$set>

That, though, doesn't work as I expected. Why doesn't `<<el>>` become `div` where it appears as the opening and closing tag of the HTML element and how would this be done properly?

TonyM

unread,
Jan 31, 2019, 7:41:38 PM1/31/19
to TiddlyWiki
TJ

You are mixing syntax here so it is not working. 
  1. Why not just hard code <div class="stuff">Content</div> ?
  2. Otherwise perhaps use \define macroname()  to build the string you want to use later
  3. If you want to introduce variable values into HTML tags, the only way I know of is Evans Formulas plugin (but 2 may make this unnecessary)
Regards
Tony

TonyM

unread,
Jan 31, 2019, 7:53:21 PM1/31/19
to TiddlyWiki

TJ Walker

unread,
Jan 31, 2019, 8:08:15 PM1/31/19
to TiddlyWiki
Thanks, Tony.

  1. With that particular example, I would hard code the tag. As I mentioned, though, I'm more so trying to get me head around where certain syntax is available and where it isn't. Based on what I read in the docs, I thought that that sort of thing should've worked in that context regardless of how useful it've been for it to. I needed some example to illustrate what I was talking about and the effectiveness of the example in terms of that objective is not affected by whether or not one would ever want to use it specifically.
  2. This seems to be the solution.
  3. Interesting; I'll keep that resource in mind.

TonyM

unread,
Jan 31, 2019, 8:31:14 PM1/31/19
to TiddlyWiki
TJ

Along with Filters this is one of the key areas in which to understand tiddlywiki fully., we are working on documentation improvements.

It does need further update

Perhaps also this http://pv5.tiddlyspot.com/

Regards
Tony
Reply all
Reply to author
Forward
0 new messages