code-body: yes
created: 20150117152607000
modified: 20240317091700545
tags: $:/tags/Macro
title: $:/editions/tw5.com/doc-macros
type: text/vnd.tiddlywiki
\whitespace trim
\function .concat(1,2,3,4,5) [[$(1)$$(2)$$(3)$$(4)$$(5)$]substitute[]]
\function .word(_) [["]] [<_>] =[["]] +[join[]]
\procedure .def(_) <<_>>
\procedure .em(_) <<_>>
\procedure .strong(_) <<_>>
\procedure .place(_) <<_>>
\procedure .preamble(_)
<<_>>
\procedure .tid(_) <<_>>
\procedure .tag(_) <<_>>
\procedure .field(_) <<_>>
\procedure .value(_) <<_>>
\procedure .op(_) <<_>>
\procedure .var(_) <<_>>
\procedure .wid(_) <$macrocall $name=".concat" 1="$" 2=<<_>>/>
\procedure .attr(_) <<_>>
\procedure .param(_) <<_>>
\procedure .tiddler-fields(tiddler)
<$tiddler tiddler=<>>
<$link>
{{||$:/core/ui/TiddlerIcon}} <$text text=<>/>
$link>
<$list filter="[all[current]fields[]sort[title]] -title" template="$:/core/ui/TiddlerFieldTemplate" variable="listItem"/>
$tiddler>
\end
\function .mtitle(_) [<_>] Macro +[join[ ]]
\function .otitle(_) [<_>] Operator +[join[ ]]
\function .vtitle(_) [<_>] Variable +[join[ ]]
\procedure .link(_,to) <$link to=<> ><<_>>$link>
\procedure .clink(_,to) <$link to=<>><<_>>$link>
\procedure .dlink(_,to) <$link to=<>><$macrocall $name=".def" _=<<_>>/>$link>
\procedure .dlink-ex(_,to) > class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer"><$macrocall $name=".def" _=<<_>>/>
\procedure .flink(to) <$macrocall $name=".link" _=`<<.field {{$(to)$!!caption}}>>` to=<>/>
\procedure .mlink(_) <$link to={{{ [.mtitle<_>] }}}><$macrocall $name=".var" _=<<_>>/> $link>
\procedure .mlink2(_,to) <$link to=<>><$macrocall $name=".var" _=<<_>>/> $link>
\procedure .olink(_) <$link to={{{ [.otitle<_>] }}}><$macrocall $name=".op" _=<<_>>/> $link>
\procedure .olink2(_,to) <$link to={{{ [.otitle] }}}><$macrocall $name=".op" _=<<_>>/> $link>
\procedure .vlink(_) <$link to={{{ [.vtitle<_>] }}}><$macrocall $name=".var" _=<<_>>/> $link>
\procedure .vlink2(_,to) <$link to=<>><$macrocall $name=".var" _=<<_>>/>$link>
\procedure .wlink(to) <$link to=<> > <$macrocall $name=".wid" _={{{ [get[caption]] }}}> $link>
\procedure .wlink2(_,to) <$link to=<> ><<_>>$link>
\procedure .key(_) <<_>>
\procedure .keys(_) <<_>>
\procedure .tab(_) <$transclude $tiddler=<<_>> $field=caption ><<_>>$transclude>
\procedure .sidebar-tab(_) <$macrocall $name=".tab" _=`$:/core/ui/SideBar/$(_)$`/>
\procedure .more-tab(_) <$macrocall $name=".tab" _=`$:/core/ui/MoreSideBar/$(_)$`/>
\procedure .info-tab(_) <$macrocall $name=".tab" _=`$:/core/ui/TiddlerInfo/$(_)$`/>
\procedure .controlpanel-tab(_) <$macrocall $name=".tab" _=`$:/core/ui/ControlPanel/$(_)$`/>
\procedure .advancedsearch-tab(_) <$macrocall $name=".tab" _=`$:/core/ui/AdvancedSearch/$(_)$`/>
\procedure .toc-tab() <$macrocall $name=".tab" _="TableOfContents"/>
\procedure .example-tab(_) <<_>>
\procedure .doc-tabs()
<$macrocall $name="tabs"
tabsList="[tagdescription[tab]]"
default={{{ [tagfirst[]] }}}
explicitState={{{ [addprefix[$:/state/tab/]] }}}
class={{{ [[doc-tabs]] [encodeuricomponent[]escapecss[]addprefix[doc-tabs-]] +[join[ ]] }}} />
\end
\procedure .doc-tab-link(text, target, tooltip:"", class:"")
<$tiddler tiddler={{{ [search:text[.doc-tabs]] :else[tags[]search:text[.doc-tabs]first[]] :else[] }}} >
<$button class={{{ [[tc-btn-invisible tc-tiddlylink]] [] +[join[ ]] }}}
set={{{ [addprefix[$:/state/tab/]] }}}
setTo=<>
tooltip=<>>
<>
<$list filter="[[$:/StoryList]contains]" variable="ignore" emptyMessage="<$action-navigate />">
<$action-sendmessage $message="tm-scroll" selector={{{ [encodeuricomponent[]addprefix[.doc-tabs-]] }}} />
$list>
<$action-sendmessage $message="tm-scroll" selector={{{ [encodeuricomponent[]escapecss[]addprefix[.doc-tabs-]] }}} />
$button>
$tiddler>
\end
\procedure .widget-attr-link(text, target)
<$macrocall $name=".doc-tab-link"
text={{{ [[]] [] [[
]] +[join[]] }}}
class="doc-tab-link"
target=<>
tooltip={{{ [[Show more information about the ']] [] [[' attribute]] +[join[]] }}} />
\end
\procedure .button(_) <$transclude $tiddler=`$:/core/ui/Buttons/$(_)$` $field="caption" ><<_>>$transclude>
\procedure .icon(_) <$transclude $tiddler=<<_>>/>
\procedure .infoBox(text:"", title, icon:"$:/core/images/info-button", class, iconSize:"1.4rem")
\function _f.tipClass() [[doc-icon-block]] [!is[blank]then] +[join[ ]]
>>
<%if [
!is[blank]] %>''<
>'' <% endif %>
<$transclude $tiddler=<> size=<>/>
<>
\end
\procedure .note(_:"", title:"Note", icon:"$:/core/images/info-button", class:"doc-note", iconSize:"22pt")
<$macrocall $name=".infoBox" text=<<_>> title=<> icon=<> class=<> iconSize=<>/>
\end
\procedure .tip(_:"", title:"Tip" , icon:"$:/core/images/tip", class:"doc-tip", iconSize:"22pt")
<$macrocall $name=".infoBox" text=<<_>> title=<> icon=<> class=<> iconSize=<>/>
\end
\procedure .warning(_:"", title:"Warning", icon:"$:/core/images/warning", class:"doc-warning", iconSize:"22pt")
<$macrocall $name=".infoBox" text=<<_>> title=<> icon=<> class=<> iconSize=<>/>
\end
\procedure .state-prefix() $:/state/editions/tw5.com/
\procedure .lorem()
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end
\procedure .toc-lorem()
This is an example tiddler. See [[Table-of-Contents Macros (Examples)]].
<<.lorem>>
\end
\procedure .example(n,eg,egvar)
<$let eg={{{ [!is[blank]getvariable[]] :else[] }}}>
<$macrocall $name="copy-to-clipboard-above-right" src=<
>/>
<$codeblock code=<>/>
<$list filter=`[title<.state-prefix>addsuffix{!!title}addsuffix[/]addsuffix[$(n)$]]` variable=".state">
<$reveal state=<<.state>> type="nomatch" text="show">
<$button set=<<.state>> setTo="show">Try it$button>
$reveal>
<$reveal state=<<.state>> type="match" text="show">
<$button set=<<.state>> setTo="">Hide$button>
<$transclude $variable="eg" $mode="block"/>
$reveal>
$list>
$let>
\end
\procedure .bad-example(eg)
⚠
Warning: Don't do it this way!
<$transclude $variable="eg" $mode="block"/>
\end
\procedure .link-badge(text,link,colour)
> class="doc-link-badge" style.background-color=<> target="_blank" rel="noopener noreferrer">
<$text text=<>/>
\end
\procedure .link-badge-added(link,colour:#ffe246) <$macrocall $name=".link-badge" text="added" link=< > colour=<>/>
\procedure .link-badge-addendum(link,colour:#fcc84a) <$macrocall $name=".link-badge" text="addendum" link=< > colour=<>/>
\procedure .link-badge-extended(link,colour:#f9a344) <$macrocall $name=".link-badge" text="extended" link=< > colour=<>/>
\procedure .link-badge-fixed(link,colour:#ffa86d) <$macrocall $name=".link-badge" text="fixed" link=< > colour=<>/>
\procedure .link-badge-here(link,colour:#d88e63) <$macrocall $name=".link-badge" text="here" link=< > colour=<>/>
\procedure .link-badge-hide(link,colour:#9d959f) <$macrocall $name=".link-badge" text="hide" link=< > colour=<>/>
\procedure .link-badge-improved(link,colour:#7593c7) <$macrocall $name=".link-badge" text="improved" link=< > colour=<>/>
\procedure .link-badge-modified(link,colour:#7f99c9) <$macrocall $name=".link-badge" text="modified" link=< > colour=<>/>
\procedure .link-badge-removed(link,colour:#a9aabc) <$macrocall $name=".link-badge" text="removed" link=< > colour=<>/>
\procedure .link-badge-renamed(link,colour:#b4b995) <$macrocall $name=".link-badge" text="renamed" link=< > colour=<>/>
\procedure .link-badge-updated(link,colour:#91ba66) <$macrocall $name=".link-badge" text="updated" link=< > colour=<>/>
\procedure .banner-credits(credit,url)
> width="140" style="float:left;margin-right:0.5em;"/>
<>
\end
\procedure .contributors(usernames)
<$list filter="[enlistsort[]]" variable="username">
] }}} class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">
addsuffix[.png?size=64]] }}} width="64" height="64"/>
@<$text text=<>/>
$list>
\end