TW macro and reveal widget: div inside span

67 views
Skip to first unread message

Mohammad

unread,
Nov 29, 2018, 3:25:27 AM11/29/18
to TiddlyWiki
I have a card macro to create a crad with several optional parameters. If an optional parameter is missing OR not given, then the macro ignore that part!

\define card(header:"Empty", title:"Empty" text:"Empty",footer:"Empty", width:"" class:"")

<div class="card mb-3 $class$" style="width:$width$;">
<$reveal type="nomatch" default="Empty" text=$header$ >
   
<div class="card-header">$header$</div>
</
$reveal>

<div class="card-body">
 
<$reveal type="nomatch" default="Empty" text=$title$ >
   
<div class="h5 card-title">$title$</div>
 </
$reveal>

 
<$reveal type="nomatch" default="Empty" text=<<__text__>> >
   
<div class="card-text"><<__text__>></div>
 
</$reveal>
</
div>

<$reveal type="nomatch" default="Empty" text=<<__footer__>> >
   
<div class="card-footer text-muted">$footer$</div>
</
$reveal>
</div>
\end


This macro use reveal widget! If you look the raw html produced by TW you will see div generated inside span tag.
Is this a good practice in TW and html5? Is it valid? 

p.s: It is important for me to have a clean code, easy to understand and follow standards (like html5 here)


Mohammad

Mohammad

unread,
Nov 29, 2018, 3:27:25 AM11/29/18
to TiddlyWiki
Note: This is kind of if-then logic! Thanks to Eric Shulman for his very useful post on using reveal widget!

-Mohammad

Mark S.

unread,
Nov 29, 2018, 11:41:55 AM11/29/18
to TiddlyWiki
The reveal widget has the "tag" option which you can use to make it use <div> instead of <span>.

-- Mark

Mohammad

unread,
Nov 29, 2018, 1:07:40 PM11/29/18
to TiddlyWiki
Thank you Mark!

Cheers
Mohammad
Reply all
Reply to author
Forward
0 new messages