2015-01-18 18:39:00 +00:00
created: 20150117152607000
2023-04-04 17:00:04 +00:00
modified: 20230325141733992
2015-01-11 19:04:14 +00:00
tags: $:/tags/Macro
2018-04-24 21:08:20 +00:00
title: $:/editions/tw5.com/doc-macros
type: text/vnd.tiddlywiki
2015-01-11 19:04:14 +00:00
2015-02-24 16:41:16 +00:00
\define .concat(1,2,3,4,5) $1$$2$$3$$4$$5$
2015-01-18 18:39:00 +00:00
\define .def(_) <dfn class="doc-def">$_$</dfn>
\define .em(_) <em class="doc-em">$_$</em>
\define .strong(_) <strong class="doc-strong">$_$</strong>
\define .place(_) <code class="doc-place">$_$</code>
\define .word(_) "$_$"
\define .preamble(_) :.doc-preamble $_$
2015-01-24 21:18:44 +00:00
\define .note(_)
@@.doc-note
;Note
: $_$
@@
\end
2015-01-18 18:39:00 +00:00
\define .tid(_) <code class="doc-tiddler">$_$</code>
\define .tag(_) <code class="doc-tag">$_$</code>
\define .field(_) <code class="doc-field">$_$</code>
\define .value(_) <code class="doc-value">$_$</code>
\define .op(_) <code class="doc-operator">$_$</code>
\define .var(_) <code class="doc-var">$_$</code>
2015-01-24 21:18:44 +00:00
\define .wid(_) <code class="doc-widget">$$_$</code>
\define .attr(_) <code class="doc-attr">$_$</code>
2015-02-24 16:41:16 +00:00
\define .param(_) <code class="doc-param">$_$</code>
2015-01-18 18:39:00 +00:00
2015-02-24 16:41:16 +00:00
\define .mtitle(_) $_$ Macro
2015-01-18 18:39:00 +00:00
\define .otitle(_) $_$ Operator
2015-02-24 16:41:16 +00:00
\define .vtitle(_) $_$ Variable
2015-01-18 18:39:00 +00:00
\define .link(_,to) <$link to="$to$">$_$</$link>
\define .clink(_,to) <span class="doc-clink"><<.link """$_$""" "$to$">></span>
2015-02-24 16:41:16 +00:00
\define .dlink(_,to) <$macrocall $name=".link" _=<<.def "$_$">> to="$to$">/>
2016-05-05 10:49:40 +00:00
\define .dlink-ex(_,to) <a href="$to$" class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer"><<.def "$_$">></a>
2015-02-24 16:41:16 +00:00
\define .flink(to) <$macrocall $name=".link" _=<<.field {{$to$!!caption}}>> to="$to$"/>
\define .mlink(_,to) <$macrocall $name=".link" _=<<.var "$_$">> to=<<.mtitle "$_$">>/>
\define .mlink2(_,to) <$macrocall $name=".link" _=<<.var "$_$">> to="$to$"/>
2015-01-18 18:39:00 +00:00
\define .olink(_) <$macrocall $name=".link" _=<<.op "$_$">> to=<<.otitle "$_$">>/>
\define .olink2(_,to) <$macrocall $name=".link" _=<<.op "$_$">> to=<<.otitle "$to$">>/>
2015-02-24 16:41:16 +00:00
\define .vlink(_,to) <$macrocall $name=".link" _=<<.var "$_$">> to=<<.vtitle "$_$">>/>
\define .vlink2(_,to) <$macrocall $name=".link" _=<<.var "$_$">> to="$to$"/>
\define .wlink(to) <$macrocall $name=".link" _=<<.wid {{$to$!!caption}}>> to="$to$"/>
\define .wlink2(_,to) <$macrocall $name=".link" _="$_$" to="$to$"/>
2015-01-18 18:39:00 +00:00
\define .key(_) <span class="doc-key">$_$</span>
2015-02-24 16:41:16 +00:00
\define .combokey(_) <$macrocall $name=".if" cond="$_$" then=<<.key '$_$'>>/>
2015-01-18 18:39:00 +00:00
\define .keycombo(1,2,3,4) <<.combokey "$1$">><<.if "$2$" +>><<.combokey "$2$">><<.if "$3$" +>><<.combokey "$3$">><<.if "$4$" +>><<.combokey "$4$">>
\define .tab(_) <span class="doc-tab">{{$_$!!caption}}</span>
\define .sidebar-tab(_) <<.tab "$:/core/ui/SideBar/$_$">>
\define .more-tab(_) <<.tab "$:/core/ui/MoreSideBar/$_$">>
\define .info-tab(_) <<.tab "$:/core/ui/TiddlerInfo/$_$">>
\define .controlpanel-tab(_) <<.tab "$:/core/ui/ControlPanel/$_$">>
\define .advancedsearch-tab(_) <<.tab "$:/core/ui/AdvancedSearch/$_$">>
\define .toc-tab() <<.tab "TableOfContents">>
\define .example-tab(_) <span class="doc-tab">$_$</span>
2023-04-04 17:00:04 +00:00
\define .doc-tabs()
<$macrocall $name="tabs"
tabsList="[tag<currentTiddler>description[tab]]"
default={{{ [tag<currentTiddler>first[]] }}}
explicitState={{{ [<currentTiddler>addprefix[$:/state/tab/]] }}}
class={{{ [[doc-tabs]] [<currentTiddler>encodeuricomponent[]escapecss[]addprefix[doc-tabs-]] +[join[ ]] }}} />
\end
\define .doc-tab-link(text, target, tooltip:"", class:"")
<!-- figure out where the addressed doc-tabs are -->
<$tiddler tiddler={{{ [<currentTiddler>search:text[.doc-tabs]] :else[<currentTiddler>tags[]search:text[.doc-tabs]first[]] :else[<currentTiddler>] }}} >
<$button class={{{ [[tc-btn-invisible tc-tiddlylink]] [<__class__>] +[join[ ]] }}}
set={{{ [<currentTiddler>addprefix[$:/state/tab/]] }}}
setTo=<<__target__>>
tooltip=<<__tooltip__>>>
<<__text__>>
<!-- if tiddler with tabs is open, scroll to tabs, otherwise open that tiddler (relevant from within tab subtiddlers) -->
<$list filter="[[$:/StoryList]contains<currentTiddler>]" variable="ignore" emptyMessage="<$action-navigate />">
<$action-sendmessage $message="tm-scroll" selector={{{ [<currentTiddler>encodeuricomponent[]addprefix[.doc-tabs-]] }}} />
</$list>
<$action-sendmessage $message="tm-scroll" selector={{{ [<currentTiddler>encodeuricomponent[]escapecss[]addprefix[.doc-tabs-]] }}} />
</$button>
</$tiddler>
\end
\define .widget-attr-link(text, target)
<$macrocall $name=".doc-tab-link"
text={{{ [[<code class="doc-attr">]] [<__text__>] [[</code>]] +[join[]] }}}
class="doc-tab-link"
target=<<__target__>>
tooltip={{{ [[Show more information about the ']] [<__text__>] [[' attribute]] +[join[]] }}} />
\end
2015-01-18 18:39:00 +00:00
\define .button(_) <span class="doc-button">{{$:/core/ui/Buttons/$_$!!caption}}</span>
2019-10-13 14:35:36 +00:00
\define .icon(_) <span class="doc-icon">{{$_$}}</span>
2015-02-26 16:32:00 +00:00
\define .tip(_) <div class="doc-icon-block"><div class="doc-block-icon">{{$:/core/images/tip}}</div> $_$</div>
\define .warning(_) <div class="doc-icon-block"><div class="doc-block-icon">{{$:/core/images/warning}}</div> $_$</div>
2015-01-18 18:39:00 +00:00
\define .state-prefix() $:/state/editions/tw5.com/
2015-02-24 16:41:16 +00:00
\define .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
\define .toc-lorem()
This is an example tiddler. See [[Table-of-Contents Macros (Examples)]].
<<.lorem>>
\end
\define .example(n,eg,egvar:NO-SUCH-VAR)
<div class="doc-example">
<$reveal default="$egvar$" type="match" text="NO-SUCH-VAR">
2017-12-16 10:58:33 +00:00
<$macrocall $name="copy-to-clipboard-above-right" src="""$eg$"""/>
2015-02-24 16:41:16 +00:00
<$codeblock code="""$eg$"""/>
</$reveal>
<$reveal default="$egvar$" type="nomatch" text="NO-SUCH-VAR">
<!-- allow an example to contain """ -->
2017-12-16 10:58:33 +00:00
<$macrocall $name="copy-to-clipboard-above-right" src=<<$egvar$>>/>
2015-02-24 16:41:16 +00:00
<$codeblock code=<<$egvar$>>/>
</$reveal>
<$list filter="[title<.state-prefix>addsuffix{!!title}addsuffix[/]addsuffix[$n$]]" variable=".state">
<$reveal state=<<.state>> type="nomatch" text="show">
<dl>
<dd><$button set=<<.state>> setTo="show">Try it</$button></dd>
</dl>
</$reveal>
<$reveal state=<<.state>> type="match" text="show">
<dl>
<dd><$button set=<<.state>> setTo="">Hide</$button></dd>
</dl>
<blockquote class="doc-example-result">
<$reveal default="$egvar$" type="match" text="NO-SUCH-VAR">
2023-05-06 10:40:22 +00:00
$$$text/vnd.tiddlywiki
$eg$
$$$
2015-02-24 16:41:16 +00:00
</$reveal>
<$reveal default="$egvar$" type="nomatch" text="NO-SUCH-VAR">
<<$egvar$>>
</$reveal>
</blockquote>
</$reveal>
</$list>
2018-04-24 21:08:20 +00:00
\end
2022-01-09 14:30:22 +00:00
\define .bad-example(eg)
<table class="doc-bad-example">
<tbody>
<tr class="evenRow">
2022-10-16 16:28:36 +00:00
<td><span style="font-size:1.5em;">⚠</span> Warning:<br> Don't do it this way!</td>
2022-01-09 14:30:22 +00:00
<td>
$eg$
</td>
</tr>
</tbody>
</table>
\end
2020-12-24 11:47:36 +00:00
\define .link-badge(text,link,colour)
<a href=<<__link__>> class="doc-link-badge" style="background-color:$colour$;" target="_blank" rel="noopener noreferrer"><$text text=<<__text__>>/></a>
\end
\define .link-badge-added(link,colour:#ffe246) <<.link-badge "added" """$link$""" """$colour$""">>
\define .link-badge-addendum(link,colour:#fcc84a) <<.link-badge "addendum" """$link$""" """$colour$""">>
\define .link-badge-extended(link,colour:#f9a344) <<.link-badge "extended" """$link$""" """$colour$""">>
2020-12-24 13:10:44 +00:00
\define .link-badge-fixed(link,colour:#ffa86d) <<.link-badge "fixed" """$link$""" """$colour$""">>
2020-12-24 11:47:36 +00:00
\define .link-badge-here(link,colour:#d88e63) <<.link-badge "here" """$link$""" """$colour$""">>
\define .link-badge-hide(link,colour:#9d959f) <<.link-badge "hide" """$link$""" """$colour$""">>
\define .link-badge-improved(link,colour:#7593c7) <<.link-badge "improved" """$link$""" """$colour$""">>
\define .link-badge-modified(link,colour:#7f99c9) <<.link-badge "modified" """$link$""" """$colour$""">>
\define .link-badge-removed(link,colour:#a9aabc) <<.link-badge "removed" """$link$""" """$colour$""">>
\define .link-badge-renamed(link,colour:#b4b995) <<.link-badge "renamed" """$link$""" """$colour$""">>
\define .link-badge-updated(link,colour:#91ba66) <<.link-badge "updated" """$link$""" """$colour$""">>
2021-12-06 16:59:07 +00:00
\define .tiddler-fields(tiddler)
<$tiddler tiddler=<<__tiddler__>>>
<div class="doc-tiddler-fields">
<h2>
<$link>
<span class="tc-tiddler-title-icon">{{||$:/core/ui/TiddlerIcon}}</span><$text text=<<currentTiddler>>/>
</$link>
</h2>
<table class="tc-view-field-table">
<tbody>
<$list filter="[all[current]fields[]sort[title]] -title" template="$:/core/ui/TiddlerFieldTemplate" variable="listItem"/>
</tbody>
</table>
</div>
</$tiddler>
\end
2021-12-09 11:56:31 +00:00
\define .banner-credits(credit,url)
<img src=<<__url__>> width="140" style="float:left;margin-right:0.5em;"/>
$credit$
<div style="clear:both;">
</div>
\end
2022-07-14 12:49:23 +00:00
\define .contributors(usernames)
<ol class="doc-github-contributors">
<$list filter="[enlist<__usernames__>sort[]]" variable="username">
<li>
2022-07-15 17:20:40 +00:00
<a href={{{ [[https://github.com/]addsuffix<username>] }}} class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer"><img src={{{ [[https://github.com/]addsuffix<username>addsuffix[.png?size=64]] }}} width="64" height="64"/><span class="doc-github-contributor-username">@<$text text=<<username>>/></span></a>
2022-07-14 12:49:23 +00:00
</li>
</$list>
</ol>
\end
2023-04-04 17:00:04 +00:00
<pre><$view field="text"/></pre>