mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
Standardise whitespace in conditional shortcut syntax (#8583)
This commit is contained in:
parent
842605d28e
commit
69637640d2
@ -6,7 +6,7 @@ module-type: wikirule
|
|||||||
Conditional shortcut syntax
|
Conditional shortcut syntax
|
||||||
|
|
||||||
```
|
```
|
||||||
This is a <% if [{something}] %>Elephant<% elseif [{else}] %>Pelican<% else %>Crocodile<% endif %>
|
This is a <%if [{something}] %>Elephant<%elseif [{else}] %>Pelican<%else%>Crocodile<%endif%>
|
||||||
```
|
```
|
||||||
|
|
||||||
\*/
|
\*/
|
||||||
@ -27,7 +27,7 @@ exports.init = function(parser) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.findNextMatch = function(startPos) {
|
exports.findNextMatch = function(startPos) {
|
||||||
// Look for the next <% if shortcut
|
// Look for the next <%if shortcut
|
||||||
this.matchRegExp.lastIndex = startPos;
|
this.matchRegExp.lastIndex = startPos;
|
||||||
this.match = this.matchRegExp.exec(this.parser.source);
|
this.match = this.matchRegExp.exec(this.parser.source);
|
||||||
// If not found then return no match
|
// If not found then return no match
|
||||||
|
@ -83,11 +83,11 @@ first-search-filter: [all[shadows]search<userInput>sort[title]limit[250]] -[[$:/
|
|||||||
|
|
||||||
<div class="tc-search-results">
|
<div class="tc-search-results">
|
||||||
|
|
||||||
<% if [<resultCount>match[0]] %>
|
<%if [<resultCount>match[0]] %>
|
||||||
{{$:/language/Search/Matches/NoMatch}}
|
{{$:/language/Search/Matches/NoMatch}}
|
||||||
<% else %>
|
<%else%>
|
||||||
<<lingo Shadows/Matches>>
|
<<lingo Shadows/Matches>>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
|
|
||||||
<$list filter="[all[shadows]search{$:/temp/advancedsearch}sort[title]limit[250]] -[[$:/temp/advancedsearch]] -[[$:/temp/advancedsearch/input]]">
|
<$list filter="[all[shadows]search{$:/temp/advancedsearch}sort[title]limit[250]] -[[$:/temp/advancedsearch]] -[[$:/temp/advancedsearch/input]]">
|
||||||
<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[[$:/temp/advancedsearch/selected-item]get[text]] +[then[]else[tc-list-item-selected]] }}}>
|
<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[[$:/temp/advancedsearch/selected-item]get[text]] +[then[]else[tc-list-item-selected]] }}}>
|
||||||
|
@ -82,11 +82,11 @@ first-search-filter: [is[system]search<userInput>sort[title]limit[250]] -[[$:/te
|
|||||||
|
|
||||||
<div class="tc-search-results">
|
<div class="tc-search-results">
|
||||||
|
|
||||||
<% if [<resultCount>match[0]] %>
|
<%if [<resultCount>match[0]] %>
|
||||||
{{$:/language/Search/Matches/NoMatch}}
|
{{$:/language/Search/Matches/NoMatch}}
|
||||||
<% else %>
|
<%else%>
|
||||||
<<lingo System/Matches>>
|
<<lingo System/Matches>>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
|
|
||||||
<$list filter="[is[system]search{$:/temp/advancedsearch}sort[title]limit[250]] -[[$:/temp/advancedsearch]] -[[$:/temp/advancedsearch/input]] -[[$:/temp/advancedsearch/selected-item]]">
|
<$list filter="[is[system]search{$:/temp/advancedsearch}sort[title]limit[250]] -[[$:/temp/advancedsearch]] -[[$:/temp/advancedsearch/input]] -[[$:/temp/advancedsearch/selected-item]]">
|
||||||
<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[[$:/temp/advancedsearch/selected-item]get[text]] +[then[]else[tc-list-item-selected]] }}}>
|
<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[[$:/temp/advancedsearch/selected-item]get[text]] +[then[]else[tc-list-item-selected]] }}}>
|
||||||
|
@ -31,11 +31,11 @@ second-search-filter: [subfilter<tagListFilter>is[system]search:title<userInput>
|
|||||||
\procedure add-tag-actions()
|
\procedure add-tag-actions()
|
||||||
<$let tag=<<_tf.getTag>> >
|
<$let tag=<<_tf.getTag>> >
|
||||||
<$action-listops $tiddler=<<saveTiddler>> $field=<<tagField>> $subfilter='+[toggle<tag>trim[]]'/>
|
<$action-listops $tiddler=<<saveTiddler>> $field=<<tagField>> $subfilter='+[toggle<tag>trim[]]'/>
|
||||||
<% if [<tag>] :intersection[<saveTiddler>get<tagField>enlist-input[]] %>
|
<%if [<tag>] :intersection[<saveTiddler>get<tagField>enlist-input[]] %>
|
||||||
<!-- tag has been removed - do nothing -->
|
<!-- tag has been removed - do nothing -->
|
||||||
<% else %>
|
<%else%>
|
||||||
<<actions>>
|
<<actions>>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
<<delete-tag-state-tiddlers>>
|
<<delete-tag-state-tiddlers>>
|
||||||
<$action-setfield $tiddler=<<refreshTitle>> text="yes"/>
|
<$action-setfield $tiddler=<<refreshTitle>> text="yes"/>
|
||||||
</$let>
|
</$let>
|
||||||
@ -46,11 +46,11 @@ second-search-filter: [subfilter<tagListFilter>is[system]search:title<userInput>
|
|||||||
The second ESC tries to close the "draft tiddler"
|
The second ESC tries to close the "draft tiddler"
|
||||||
-->
|
-->
|
||||||
\procedure clear-tags-actions-inner()
|
\procedure clear-tags-actions-inner()
|
||||||
<% if [<storeTitle>has[text]] ~[<newTagNameTiddler>has[text]] %>
|
<%if [<storeTitle>has[text]] ~[<newTagNameTiddler>has[text]] %>
|
||||||
<<delete-tag-state-tiddlers>>
|
<<delete-tag-state-tiddlers>>
|
||||||
<% else %>
|
<%else%>
|
||||||
<<cancel-delete-tiddler-actions "cancel">>
|
<<cancel-delete-tiddler-actions "cancel">>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
<!-- triggered by keyboard only -->
|
<!-- triggered by keyboard only -->
|
||||||
@ -128,13 +128,13 @@ The second ESC tries to close the "draft tiddler"
|
|||||||
>
|
>
|
||||||
{{$:/core/images/down-arrow}}
|
{{$:/core/images/down-arrow}}
|
||||||
</$button>
|
</$button>
|
||||||
<% if [<storeTitle>has[text]] %>
|
<%if [<storeTitle>has[text]] %>
|
||||||
<$button actions=<<delete-tag-state-tiddlers>> class="tc-btn-invisible tc-small-gap tc-btn-dropdown"
|
<$button actions=<<delete-tag-state-tiddlers>> class="tc-btn-invisible tc-small-gap tc-btn-dropdown"
|
||||||
tooltip={{$:/language/EditTemplate/Tags/ClearInput/Hint}} aria-label={{$:/language/EditTemplate/Tags/ClearInput/Caption}}
|
tooltip={{$:/language/EditTemplate/Tags/ClearInput/Hint}} aria-label={{$:/language/EditTemplate/Tags/ClearInput/Caption}}
|
||||||
>
|
>
|
||||||
{{$:/core/images/close-button}}
|
{{$:/core/images/close-button}}
|
||||||
</$button>
|
</$button>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
<span class="tc-add-tag-button tc-small-gap-left">
|
<span class="tc-add-tag-button tc-small-gap-left">
|
||||||
<$let tag=<<_tf.getTag>>>
|
<$let tag=<<_tf.getTag>>>
|
||||||
<$button set=<<newTagNameTiddler>> actions=<<add-button-actions>> >
|
<$button set=<<newTagNameTiddler>> actions=<<add-button-actions>> >
|
||||||
@ -144,13 +144,13 @@ The second ESC tries to close the "draft tiddler"
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="tc-block-dropdown-wrapper">
|
<div class="tc-block-dropdown-wrapper">
|
||||||
<% if [<tf.tagpicker-dropdown-id>has[text]] %>
|
<%if [<tf.tagpicker-dropdown-id>has[text]] %>
|
||||||
<div class="tc-block-dropdown tc-block-tags-dropdown">
|
<div class="tc-block-dropdown tc-block-tags-dropdown">
|
||||||
<$macrocall $name="tag-picker-listTags" filter=<<nonSystemTagsFilter>> suffix="-primaryList" />
|
<$macrocall $name="tag-picker-listTags" filter=<<nonSystemTagsFilter>> suffix="-primaryList" />
|
||||||
<hr>
|
<hr>
|
||||||
<$macrocall $name="tag-picker-listTags" filter=<<systemTagsFilter>> suffix="-secondaryList" />
|
<$macrocall $name="tag-picker-listTags" filter=<<systemTagsFilter>> suffix="-secondaryList" />
|
||||||
</div>
|
</div>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
\end
|
\end
|
||||||
|
@ -5,7 +5,7 @@ tags: [[$:/tags/wiki-test-spec]]
|
|||||||
|
|
||||||
title: Text
|
title: Text
|
||||||
|
|
||||||
This is a <% if [<something>match[one]] %>Elephant<% endif %>, I think.
|
This is a <%if [<something>match[one]] %>Elephant<%endif%>, I think.
|
||||||
+
|
+
|
||||||
title: Output
|
title: Output
|
||||||
|
|
||||||
|
@ -6,23 +6,23 @@ tags: [[$:/tags/wiki-test-spec]]
|
|||||||
title: Output
|
title: Output
|
||||||
|
|
||||||
\procedure test(animal)
|
\procedure test(animal)
|
||||||
<% if [<animal>match[Elephant]] %>
|
<%if [<animal>match[Elephant]] %>
|
||||||
|
|
||||||
! It is an elephant
|
! It is an elephant
|
||||||
|
|
||||||
<% else %>
|
<%else%>
|
||||||
|
|
||||||
<% if [<animal>match[Giraffe]] %>
|
<%if [<animal>match[Giraffe]] %>
|
||||||
|
|
||||||
! It is a giraffe
|
! It is a giraffe
|
||||||
|
|
||||||
<% else %>
|
<%else%>
|
||||||
|
|
||||||
! It is completely unknown
|
! It is completely unknown
|
||||||
|
|
||||||
<% endif %>
|
<%endif%>
|
||||||
|
|
||||||
<% endif %>
|
<%endif%>
|
||||||
|
|
||||||
\end
|
\end
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ tags: [[$:/tags/wiki-test-spec]]
|
|||||||
|
|
||||||
title: Text
|
title: Text
|
||||||
|
|
||||||
This is a <% if [<something>match[one]] %>Elephant<% else %>Crocodile<% endif %>, I think.
|
This is a <%if [<something>match[one]] %>Elephant<%else%>Crocodile<%endif%>, I think.
|
||||||
+
|
+
|
||||||
title: Output
|
title: Output
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ tags: [[$:/tags/wiki-test-spec]]
|
|||||||
|
|
||||||
title: Text
|
title: Text
|
||||||
|
|
||||||
This is a <% if [<something>match[one]] %>Elephant<% elseif [<something>match[two]] %>Antelope<% else %>Crocodile<% endif %>, I think.
|
This is a <%if [<something>match[one]] %>Elephant<%elseif [<something>match[two]] %>Antelope<%else%>Crocodile<%endif%>, I think.
|
||||||
+
|
+
|
||||||
title: Output
|
title: Output
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ tags: [[$:/tags/wiki-test-spec]]
|
|||||||
|
|
||||||
title: Text
|
title: Text
|
||||||
|
|
||||||
This is a <% if [<something>match[one]] %>Elephant
|
This is a <%if [<something>match[one]] %>Elephant
|
||||||
+
|
+
|
||||||
title: Output
|
title: Output
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ tags: [[$:/tags/wiki-test-spec]]
|
|||||||
|
|
||||||
title: Output
|
title: Output
|
||||||
|
|
||||||
This is a <% if 1 2 3 4 5 6 %>Elephant<% endif %>, I think.
|
This is a <%if 1 2 3 4 5 6 %>Elephant<%endif%>, I think.
|
||||||
+
|
+
|
||||||
title: ExpectedResult
|
title: ExpectedResult
|
||||||
|
|
||||||
|
@ -6,15 +6,15 @@ tags: [[$:/tags/wiki-test-spec]]
|
|||||||
title: Output
|
title: Output
|
||||||
|
|
||||||
\procedure test(animal)
|
\procedure test(animal)
|
||||||
<% if [<animal>match[Elephant]] %>
|
<%if [<animal>match[Elephant]] %>
|
||||||
It is an elephant
|
It is an elephant
|
||||||
<% else %>
|
<%else%>
|
||||||
<% if [<animal>match[Giraffe]] %>
|
<%if [<animal>match[Giraffe]] %>
|
||||||
It is a giraffe
|
It is a giraffe
|
||||||
<% else %>
|
<%else%>
|
||||||
It is completely unknown
|
It is completely unknown
|
||||||
<% endif %>
|
<%endif%>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
<<test "Giraffe">>
|
<<test "Giraffe">>
|
||||||
|
@ -7,20 +7,20 @@ title: Text
|
|||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
This is a 
|
This is a 
|
||||||
<% if [<something>match[one]] %>
|
<%if [<something>match[one]] %>
|
||||||
<% if [<another>match[one]] %>
|
<%if [<another>match[one]] %>
|
||||||
Indian
|
Indian
|
||||||
<% elseif [<another>match[two]] %>
|
<%elseif [<another>match[two]] %>
|
||||||
African
|
African
|
||||||
<% else %>
|
<%else%>
|
||||||
Unknown
|
Unknown
|
||||||
<% endif %>
|
<%endif%>
|
||||||
 Elephant
|
 Elephant
|
||||||
<% elseif [<something>match[two]] %>
|
<%elseif [<something>match[two]] %>
|
||||||
Antelope
|
Antelope
|
||||||
<% else %>
|
<%else%>
|
||||||
Crocodile
|
Crocodile
|
||||||
<% endif %>
|
<%endif%>
|
||||||
, I think.
|
, I think.
|
||||||
+
|
+
|
||||||
title: Output
|
title: Output
|
||||||
|
@ -5,8 +5,8 @@ tags: $:/tags/ViewTemplate
|
|||||||
title: $:/editions/tw5.com/empty-tag-node-template
|
title: $:/editions/tw5.com/empty-tag-node-template
|
||||||
type:
|
type:
|
||||||
|
|
||||||
<% if [<storyTiddler>!has[text]!has[tags]tagging[]] %>
|
<%if [<storyTiddler>!has[text]!has[tags]tagging[]] %>
|
||||||
The following tiddlers are tagged with <<tag>>:
|
The following tiddlers are tagged with <<tag>>:
|
||||||
|
|
||||||
<<list-links filter:"[<storyTiddler>!has[text]!has[tags]tagging[]]" class:"multi-columns">>
|
<<list-links filter:"[<storyTiddler>!has[text]!has[tags]tagging[]]" class:"multi-columns">>
|
||||||
<% endif %>
|
<%endif%>
|
@ -23,13 +23,13 @@ type: text/vnd.tiddlywiki
|
|||||||
These new token-based shortcuts allow a richer structure and expressivity than existing features such as widgets or pragmas. For example:
|
These new token-based shortcuts allow a richer structure and expressivity than existing features such as widgets or pragmas. For example:
|
||||||
|
|
||||||
```
|
```
|
||||||
<% if [<animal>match[Elephant]] %>
|
<%if [<animal>match[Elephant]] %>
|
||||||
It is an elephant
|
It is an elephant
|
||||||
<% elseif [<animal>match[Giraffe]] %>
|
<%elseif [<animal>match[Giraffe]] %>
|
||||||
It is a giraffe
|
It is a giraffe
|
||||||
<% else %>
|
<%else%>
|
||||||
It is completely unknown
|
It is completely unknown
|
||||||
<% endif %>
|
<%endif%>
|
||||||
```
|
```
|
||||||
|
|
||||||
Behind the scenes, the conditional shortcut syntax is rendered as the equivalent [[ListWidgets|ListWidget]].
|
Behind the scenes, the conditional shortcut syntax is rendered as the equivalent [[ListWidgets|ListWidget]].
|
||||||
|
@ -119,7 +119,7 @@ type: text/vnd.tiddlywiki
|
|||||||
\procedure .infoBox(text:"", title, icon:"$:/core/images/info-button", class, iconSize:"1.4rem")
|
\procedure .infoBox(text:"", title, icon:"$:/core/images/info-button", class, iconSize:"1.4rem")
|
||||||
\function _f.tipClass() [[doc-icon-block]] [<class>!is[blank]then<class>] +[join[ ]]
|
\function _f.tipClass() [[doc-icon-block]] [<class>!is[blank]then<class>] +[join[ ]]
|
||||||
<div class=<<_f.tipClass>>>
|
<div class=<<_f.tipClass>>>
|
||||||
<%if [<title>!is[blank]] %><div>''<<title>>''</div><% endif %>
|
<%if [<title>!is[blank]] %><div>''<<title>>''</div><%endif%>
|
||||||
<div class="doc-block-icon"><$transclude $tiddler=<<icon>> size=<<iconSize>>/></div>
|
<div class="doc-block-icon"><$transclude $tiddler=<<icon>> size=<<iconSize>>/></div>
|
||||||
<<text>>
|
<<text>>
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,18 +9,18 @@ type: text/vnd.tiddlywiki
|
|||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
|
||||||
\procedure .op-place()
|
\procedure .op-place()
|
||||||
<% if [<op-name>!is[blank]] %>
|
<%if [<op-name>!is[blank]] %>
|
||||||
<$macrocall $name=".place" _=<<op-name>> /><span class="tc-tiny-gap">=</span>
|
<$macrocall $name=".place" _=<<op-name>> /><span class="tc-tiny-gap">=</span>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\procedure .op-row()
|
\procedure .op-row()
|
||||||
<% if [<op-body>!is[blank]] %>
|
<%if [<op-body>!is[blank]] %>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="left"><<op-head>></th>
|
<th align="left"><<op-head>></th>
|
||||||
<td><<.op-place>><<op-body>></td>
|
<td><<.op-place>><<op-body>></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
<$list filter="[all[current]tag[Named Filter Run Prefix]]">
|
<$list filter="[all[current]tag[Named Filter Run Prefix]]">
|
||||||
|
@ -16,9 +16,9 @@ title: $:/editions/tw5.com/operator-macros
|
|||||||
<$list filter="[title<.state-prefix>addsuffix{!!title}addsuffix[/]addsuffix<n>]" variable=".state">
|
<$list filter="[title<.state-prefix>addsuffix{!!title}addsuffix[/]addsuffix<n>]" variable=".state">
|
||||||
<$reveal state=<<.state>> type="nomatch" text="show">
|
<$reveal state=<<.state>> type="nomatch" text="show">
|
||||||
<code><$text text=<<eg>>/></code>
|
<code><$text text=<<eg>>/></code>
|
||||||
<% if [<ie>!is[blank]] %>
|
<%if [<ie>!is[blank]] %>
|
||||||
<dd>→ <<ie>></dd>
|
<dd>→ <<ie>></dd>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
<dl>
|
<dl>
|
||||||
<dd><$button actions=<<.operator-example-tryit-actions>>>Try it</$button></dd>
|
<dd><$button actions=<<.operator-example-tryit-actions>>>Try it</$button></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -8,17 +8,17 @@ title: $:/editions/tw5.com/operator-template
|
|||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
|
||||||
\procedure .op-place()
|
\procedure .op-place()
|
||||||
<% if [<op-name>!is[blank]] %>
|
<%if [<op-name>!is[blank]] %>
|
||||||
<$macrocall $name=".place" _=<<op-name>> /><span class="tc-tiny-gap">=</span>
|
<$macrocall $name=".place" _=<<op-name>> /><span class="tc-tiny-gap">=</span>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\procedure .op-row()
|
\procedure .op-row()
|
||||||
<% if [<op-body>!is[blank]] %>
|
<%if [<op-body>!is[blank]] %>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="left"><<op-head>></th><td><<.op-place>><<op-body>></td>
|
<th align="left"><<op-head>></th><td><<.op-place>><<op-body>></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
<$list filter="[all[current]tag[Filter Operators]]">
|
<$list filter="[all[current]tag[Filter Operators]]">
|
||||||
|
@ -19,11 +19,11 @@ type: text/vnd.tiddlywiki
|
|||||||
\end
|
\end
|
||||||
|
|
||||||
\procedure .from-version(version)
|
\procedure .from-version(version)
|
||||||
<% if [<version>compare:version:gteq<tf.from-version-reference>] %>
|
<%if [<version>compare:version:gteq<tf.from-version-reference>] %>
|
||||||
<<.from-version-template "doc-from-version doc-from-version-new" "New in v">>
|
<<.from-version-template "doc-from-version doc-from-version-new" "New in v">>
|
||||||
<% else %>
|
<%else%>
|
||||||
<<.from-version-template "doc-from-version" "Introduced in v">>
|
<<.from-version-template "doc-from-version" "Introduced in v">>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\procedure .deprecated-since(version, superseded:"")
|
\procedure .deprecated-since(version, superseded:"")
|
||||||
|
@ -75,7 +75,7 @@ eg="""<$edit-text tiddler=<<currentTiddler>> field="heading" size="25" focus="ye
|
|||||||
eg="""\procedure onInput()
|
eg="""\procedure onInput()
|
||||||
<%if [get[temp]match[$:/]] %>
|
<%if [get[temp]match[$:/]] %>
|
||||||
<$action-confirm $message="Yes, this is how system tiddler names begin!"/>
|
<$action-confirm $message="Yes, this is how system tiddler names begin!"/>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
Type a new tiddler name, starting with the system prefix `$:/`: <$edit-text inputActions=<<onInput>> field="temp" class="tc-edit-texteditor"/>
|
Type a new tiddler name, starting with the system prefix `$:/`: <$edit-text inputActions=<<onInput>> field="temp" class="tc-edit-texteditor"/>
|
||||||
|
@ -26,7 +26,7 @@ The content of the `<$edit>` widget is ignored.
|
|||||||
|
|
||||||
! Examples
|
! Examples
|
||||||
|
|
||||||
!! Edit the contents (text field) of a tiddler titled <%if [<now YYYY-0MM-0DD>is[tiddler]] %> <$tiddler tiddler=<<now YYYY-0MM-0DD>> > <$link/></$tiddler> <%else %> with today’s date <% endif %>
|
!! Edit the contents (text field) of a tiddler titled <%if [<now YYYY-0MM-0DD>is[tiddler]] %> <$tiddler tiddler=<<now YYYY-0MM-0DD>> > <$link/></$tiddler> <%else %> with today’s date <%endif%>
|
||||||
|
|
||||||
<$macrocall $name=".example" n="1"
|
<$macrocall $name=".example" n="1"
|
||||||
eg="""<$edit tiddler=<<now YYYY-0MM-0DD>> class="tc-edit-texteditor"/>
|
eg="""<$edit tiddler=<<now YYYY-0MM-0DD>> class="tc-edit-texteditor"/>
|
||||||
|
@ -11,40 +11,40 @@ Within an "if" or "elseif" clause, the variable `condition` contains the value o
|
|||||||
A simple example:
|
A simple example:
|
||||||
|
|
||||||
<$macrocall $name='wikitext-example-without-html'
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
src='<% if [{$:/info/url/protocol}match[file:]] %>
|
src='<%if [{$:/info/url/protocol}match[file:]] %>
|
||||||
Loaded from a file URI
|
Loaded from a file URI
|
||||||
<% else %>
|
<%else%>
|
||||||
Not loaded from a file URI
|
Not loaded from a file URI
|
||||||
<% endif %>
|
<%endif%>
|
||||||
'/>
|
'/>
|
||||||
|
|
||||||
One or more `<% elseif %>` clauses may be included before the `<% else %>` clause:
|
One or more `<%elseif%>` clauses may be included before the `<%else%>` clause:
|
||||||
|
|
||||||
<$macrocall $name='wikitext-example-without-html'
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
src='<% if [{$:/info/url/protocol}match[file:]] %>
|
src='<%if [{$:/info/url/protocol}match[file:]] %>
|
||||||
Loaded from a file URI
|
Loaded from a file URI
|
||||||
<% elseif [{$:/info/url/protocol}match[https:]] %>
|
<%elseif [{$:/info/url/protocol}match[https:]] %>
|
||||||
Loaded from an HTTPS URI
|
Loaded from an HTTPS URI
|
||||||
<% elseif [{$:/info/url/protocol}match[http:]] %>
|
<%elseif [{$:/info/url/protocol}match[http:]] %>
|
||||||
Loaded from an HTTP URI
|
Loaded from an HTTP URI
|
||||||
<% else %>
|
<%else%>
|
||||||
Loaded from an unknown protocol
|
Loaded from an unknown protocol
|
||||||
<% endif %>
|
<%endif%>
|
||||||
'/>
|
'/>
|
||||||
|
|
||||||
The conditional shortcut syntax can be nested:
|
The conditional shortcut syntax can be nested:
|
||||||
|
|
||||||
<$macrocall $name='wikitext-example-without-html'
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
src='\procedure test(animal)
|
src='\procedure test(animal)
|
||||||
<% if [<animal>match[Elephant]] %>
|
<%if [<animal>match[Elephant]] %>
|
||||||
It is an elephant
|
It is an elephant
|
||||||
<% else %>
|
<%else%>
|
||||||
<% if [<animal>match[Giraffe]] %>
|
<%if [<animal>match[Giraffe]] %>
|
||||||
It is a giraffe
|
It is a giraffe
|
||||||
<% else %>
|
<%else%>
|
||||||
It is completely unknown
|
It is completely unknown
|
||||||
<% endif %>
|
<%endif%>
|
||||||
<% endif %>
|
<%endif%>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
<<test "Giraffe">>
|
<<test "Giraffe">>
|
||||||
@ -56,7 +56,7 @@ src='\procedure test(animal)
|
|||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
* Clauses are parsed in inline mode by default. Force block mode parsing by following the opening `<% if %>`, `<% elseif %>` or `<% else %>` with two line breaks
|
* Clauses are parsed in inline mode by default. Force block mode parsing by following the opening `<%if %>`, `<%elseif%>` or `<%else%>` with two line breaks
|
||||||
* Widgets and HTML elements must be within a single conditional clause; it is not possible to start an element in one conditional clause and end it in another
|
* Widgets and HTML elements must be within a single conditional clause; it is not possible to start an element in one conditional clause and end it in another
|
||||||
* The conditional shortcut syntax cannot contain pragmas such as procedure definitions
|
* The conditional shortcut syntax cannot contain pragmas such as procedure definitions
|
||||||
|
|
||||||
|
@ -6,11 +6,11 @@ title: $:/plugins/tiddlywiki/github-fork-ribbon/usage
|
|||||||
\end
|
\end
|
||||||
|
|
||||||
\procedure ribbonCreateActions()
|
\procedure ribbonCreateActions()
|
||||||
<% if [[$:/github-ribbon]!is[tiddler]] %>
|
<%if [[$:/github-ribbon]!is[tiddler]] %>
|
||||||
<$action-setfield $tiddler="$:/github-ribbon" $field="text" $value=<<ribbonCode>>
|
<$action-setfield $tiddler="$:/github-ribbon" $field="text" $value=<<ribbonCode>>
|
||||||
tags="$:/tags/PageTemplate"
|
tags="$:/tags/PageTemplate"
|
||||||
code-body="yes" />
|
code-body="yes" />
|
||||||
<% endif %>
|
<%endif%>
|
||||||
<$action-navigate $to="$:/github-ribbon" />
|
<$action-navigate $to="$:/github-ribbon" />
|
||||||
\end
|
\end
|
||||||
|
|
||||||
@ -18,9 +18,9 @@ title: $:/plugins/tiddlywiki/github-fork-ribbon/usage
|
|||||||
<$button actions=<<ribbonCreateActions>> >
|
<$button actions=<<ribbonCreateActions>> >
|
||||||
<%if [[$:/github-ribbon]!is[tiddler]] %>
|
<%if [[$:/github-ribbon]!is[tiddler]] %>
|
||||||
Create
|
Create
|
||||||
<% else %>
|
<%else%>
|
||||||
Show
|
Show
|
||||||
<% endif %> ~$:/github-ribbon
|
<%endif%> ~$:/github-ribbon
|
||||||
</$button>
|
</$button>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user