1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Docs - wikitext-macros new v5.3.x syntaxWikitext macros (#8059)

* docs - wikitext-macros new v5.3.x syntax

* fix flexcard macro wrong link
This commit is contained in:
Mario Pietsch 2024-03-13 23:02:56 +01:00 committed by GitHub
parent 21a5841aab
commit 32bf9fd7a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,104 +1,96 @@
code-body: yes code-body: yes
created: 20150117184156000 created: 20150117184156000
modified: 20220617122915793 modified: 20240229155641000
tags: $:/tags/Macro tags: $:/tags/Macro
title: $:/editions/tw5.com/wikitext-macros title: $:/editions/tw5.com/wikitext-macros
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
\define activatePluginTab() \whitespace trim
\procedure activatePluginTab()
<$action-setfield $tiddler="$:/state/tab-1749438307" text="$:/core/ui/ControlPanel/Plugins"/> <$action-setfield $tiddler="$:/state/tab-1749438307" text="$:/core/ui/ControlPanel/Plugins"/>
<$action-navigate $to="$:/ControlPanel"/> <$action-navigate $to="$:/ControlPanel"/>
\end \end
\define activateTiddlerWindow() \procedure activateTiddlerWindow()
<$action-sendmessage $message="tm-open-window" <$action-sendmessage $message="tm-open-window" $param=<<currentTiddler>> windowTitle="Side by Side View" width="800" height="600" />
$param=<<currentTiddler>> windowTitle="Side by Side View"
width="800" height="600" />
\end \end
\define controlPanel-plugin-link() \procedure controlPanel-plugin-link()
<$button actions=<<activatePluginTab>> class="tc-btn-invisible tc-tiddlylink"> <$button actions=<<activatePluginTab>> class="tc-btn-invisible tc-tiddlylink">
{{$:/core/images/options-button}} ~ControlPanel {{$:/core/images/options-button}} ~ControlPanel
</$button> </$button>
\end \end
\define open-tiddler-in-window() \procedure open-tiddler-in-window()
\whitespace notrim
<$button actions=<<activateTiddlerWindow>> class="tc-btn-invisible tc-tiddlylink"> <$button actions=<<activateTiddlerWindow>> class="tc-btn-invisible tc-tiddlylink">
open ''this'' tiddler in a new window open ''this'' tiddler in a new window
</$button> </$button>
\end \end
\define activateEditionWindow(url) \procedure activateEditionWindow(url)
<$action-sendmessage $message="tm-open-external-window" <$action-sendmessage $message="tm-open-external-window" $param=<<url>> windowName="_edition" windowFeatures="width=800 height=600" />
$param="""$url$""" windowName="_edition"
windowFeatures="width=800 height=600" />
\end \end
\define open-external-window(url) \procedure open-external-window(url)
<$button actions=<<activateEditionWindow """$url$""">> class="tc-btn-invisible tc-tiddlylink"> \whitespace notrim
open the ''example edition'' in a new window <$button actions=<<activateEditionWindow <<url>> class="tc-btn-invisible tc-tiddlylink">
open the ''example edition'' in a new window
</$button> </$button>
\end \end
\define wikitext-example(src) \procedure wikitext-example(src)
<div class="doc-example"> <div class="doc-example">
<$macrocall $name="copy-to-clipboard-above-right" src=<<src>>/>
<$macrocall $name="copy-to-clipboard-above-right" src=<<__src__>>/> <$codeblock code=<<src>>/>
<p>
<$codeblock code=<<__src__>>/> That renders as:
</p>
That renders as: <$transclude $variable="src" $mode="block"/>
<p>
<$macrocall $name="__src__"/> ... and the underlying HTML is:
</p>
... and the underlying HTML is: <$wikify name="html" text=<<src>> output="html">
<$codeblock code=<<html>>/>
<$wikify name="html" text=<<__src__>> output="html"> </$wikify>
<$codeblock code=<<html>>/>
</$wikify>
</div> </div>
\end \end
\define wikitext-example-without-html(src) \procedure wikitext-example-without-html(src)
<div class="doc-example"> <div class="doc-example">
<$macrocall $name="copy-to-clipboard-above-right" src=<<src>>/>
<$macrocall $name="copy-to-clipboard-above-right" src=<<__src__>>/> <$codeblock code=<<src>>/>
<p>
<$codeblock code=<<__src__>>/> That renders as:
</p>
That renders as: <$macrocall $name="src"/>
<$macrocall $name="__src__"/>
</div> </div>
\end \end
\define wikitext-example-table-header() <thead><tr><th/><th>wiki text</th><th>renders as</th></tr></thead> \procedure wikitext-example-table-header() <thead><tr><th/><th>wiki text</th><th>renders as</th></tr></thead>
\define wikitext-example-table-row(id, code) \procedure wikitext-example-table-row(id, code)
<tr> <tr>
<th><<__id__>></th><td><$codeblock code=<<__code__>>/></td><td> <th><<id>></th>
<td><$codeblock code=<<code>>/></td>
<<__code__>> <td><<code>></td>
</td>
</tr> </tr>
\end \end
\define tw-code(tiddler) \procedure tw-code(tiddler)
<$codeblock language={{$tiddler$!!type}} code={{$tiddler$}}/> <$codeblock language={{$tiddler$!!type}} code={{$tiddler$}}/>
\end \end
\define tw-code-link(tiddler) \procedure tw-code-link(tiddler)
[[$tiddler$]]: [[$tiddler$]]:
<<tw-code $tiddler$>> <<tw-code $tiddler$>>
\end \end
\define flex-card(class,bordercolor:"",backgroundcolor:"",textcolor:"",imageField:"image",captionField:"caption",subtitle:"",descriptionField:"description",linkField:"link") \procedure flex-card(class,bordercolor:"",backgroundcolor:"",textcolor:"",imageField:"image",captionField:"caption",subtitle:"",descriptionField:"description",linkField:"link")
\whitespace trim <$link class={{{ [<class>addprefix[tc-card ]] }}} to={{{ [<currentTiddler>get<linkField>else<currentTiddler>] }}}>
<$link class={{{ [<__class__>addprefix[tc-card ]] }}} to={{{ [<currentTiddler>get<__linkField__>else<currentTiddler>] }}}> <div class="tc-card-accent" style.borderTop={{{ [<bordercolor>!is[blank]addprefix[5px solid ]] }}} style.background={{!!background}} style.backgroundColor=<<backgroundcolor>> style.color=<<textcolor>> style.fill=<<textcolor>>>
<div class="tc-card-accent" style.borderTop={{{ [<__bordercolor__>!is[blank]addprefix[5px solid ]] }}} style.background={{!!background}} style.backgroundColor=<<__backgroundcolor__>> style.color=<<__textcolor__>> style.fill=<<__textcolor__>>>
<$list filter="[<currentTiddler>has[ribbon-text]]" variable="ignore"> <$list filter="[<currentTiddler>has[ribbon-text]]" variable="ignore">
<div class="tc-card-ribbon-wrapper"> <div class="tc-card-ribbon-wrapper">
<div class="tc-card-ribbon" style.backgroundColor={{{ [<currentTiddler>get[ribbon-color]else[red]] }}}> <div class="tc-card-ribbon" style.backgroundColor={{{ [<currentTiddler>get[ribbon-color]else[red]] }}}>
@ -108,21 +100,21 @@ That renders as:
</div> </div>
</div> </div>
</$list> </$list>
<$list filter="[<currentTiddler>has<__imageField__>]" variable="ignore"> <$list filter="[<currentTiddler>has<imageField>]" variable="ignore">
<div class="tc-card-image"> <div class="tc-card-image">
<$image source={{{ [<currentTiddler>get<__imageField__>] }}}/> <$image source={{{ [<currentTiddler>get<imageField>] }}}/>
</div> </div>
</$list> </$list>
<div class="tc-card-title"><$transclude field=<<__captionField__>>><$view field="title"/></$transclude></div> <div class="tc-card-title"><$transclude field=<<captionField>>><$view field="title"/></$transclude></div>
<$list filter="[<__subtitle__>!is[blank]]" variable="ignore"> <$list filter="[<subtitle>!is[blank]]" variable="ignore">
<div class="tc-card-subtitle"> <div class="tc-card-subtitle">
<$text text=<<__subtitle__>>/> <$text text=<<subtitle>>/>
</div> </div>
</$list> </$list>
<div class="tc-card-icon"><$transclude tiddler={{!!icon}}/></div> <div class="tc-card-icon"><$transclude tiddler={{!!icon}}/></div>
<div class="tc-card-body-wrapper"> <div class="tc-card-body-wrapper">
<div class="tc-card-body"> <div class="tc-card-body">
<$transclude field=<<__descriptionField__>> mode="block"/> <$transclude field=<<descriptionField>> mode="block"/>
</div> </div>
<div class="tc-card-body-clear"> <div class="tc-card-body-clear">
</div> </div>