mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-06-04 07:34:07 +00:00
Refactor some variable names
This commit is contained in:
parent
4d06ecd535
commit
796c33bc46
@ -1,25 +1,25 @@
|
|||||||
title: $:/core/macros/CSS
|
title: $:/core/macros/CSS
|
||||||
tags: $:/tags/Macro
|
tags: $:/tags/Macro
|
||||||
|
|
||||||
\procedure actions-compile-palette-filtered(tempPalette,outputTitle,scheme)
|
\procedure actions-compile-palette-filtered(consolidatedPalette,outputPalette,scheme)
|
||||||
<!-- Note the join, needed to cope with palette entries containing spaces -->
|
<!-- Note the join, needed to cope with palette entries containing spaces -->
|
||||||
\function colour(name) [<name>addsuffix[@]addsuffix<scheme>] :map[<tempPalette>getindex<currentTiddler>] +[!match[]] :else[<tempPalette>getindex<name>] :else[[$:/config/DefaultColourMappings/]addsuffix<name>addsuffix[@]addsuffix<scheme>get[text]] :else[[$:/config/DefaultColourMappings/]addsuffix<name>get[text]] :map[subfilter<currentTiddler>join[ ]]
|
\function colour(name) [<name>addsuffix[@]addsuffix<scheme>] :map[<consolidatedPalette>getindex<currentTiddler>] +[!match[]] :else[<consolidatedPalette>getindex<name>] :else[[$:/config/DefaultColourMappings/]addsuffix<name>addsuffix[@]addsuffix<scheme>get[text]] :else[[$:/config/DefaultColourMappings/]addsuffix<name>get[text]] :map[subfilter<currentTiddler>join[ ]]
|
||||||
\function color(name) [function[colour],<name>]
|
\function color(name) [function[colour],<name>]
|
||||||
<!-- Make the colour function use the input palette -->
|
<!-- Make the colour function use the input palette -->
|
||||||
<$list filter="[<tempPalette>indexes[]sort[]]" variable="colour-name">
|
<$list filter="[<consolidatedPalette>indexes[]sort[]]" variable="colour-name">
|
||||||
<$let filter-text={{{ [<colour-name>addsuffix[@]addsuffix<scheme>] :map[<tempPalette>getindex<currentTiddler>] +[!match[]] :else[<tempPalette>getindex<colour-name>] :else[[$:/config/DefaultColourMappings/]addsuffix<colour-name>addsuffix[@]addsuffix<scheme>get[text]] :else[[$:/config/DefaultColourMappings/]addsuffix<colour-name>get[text]] }}}>
|
<$let filter-text={{{ [<colour-name>addsuffix[@]addsuffix<scheme>] :map[<consolidatedPalette>getindex<currentTiddler>] +[!match[]] :else[<consolidatedPalette>getindex<colour-name>] :else[[$:/config/DefaultColourMappings/]addsuffix<colour-name>addsuffix[@]addsuffix<scheme>get[text]] :else[[$:/config/DefaultColourMappings/]addsuffix<colour-name>get[text]] }}}>
|
||||||
<!-- Note the join, needed to cope with palette entries containing spaces -->
|
<!-- Note the join, needed to cope with palette entries containing spaces -->
|
||||||
<$action-setfield $tiddler=<<outputTitle>> $index=<<colour-name>> $value={{{ [subfilter<filter-text>join[ ]] }}}/>
|
<$action-setfield $tiddler=<<outputPalette>> $index=<<colour-name>> $value={{{ [subfilter<filter-text>join[ ]] }}}/>
|
||||||
</$let>
|
</$let>
|
||||||
</$list>
|
</$list>
|
||||||
\end actions-compile-palette-filtered
|
\end actions-compile-palette-filtered
|
||||||
|
|
||||||
\procedure actions-compile-palette-wikified(tempPalette,outputTitle,scheme)
|
\procedure actions-compile-palette-wikified(consolidatedPalette,outputPalette,scheme)
|
||||||
<!-- Define our own deeply backwards compatible local versions of the colour macro -->
|
<!-- Define our own deeply backwards compatible local versions of the colour macro -->
|
||||||
\define colour(name)
|
\define colour(name)
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$transclude tiddler=<<tempPalette>> index="$name$@$(scheme)$">
|
<$transclude tiddler=<<consolidatedPalette>> index="$name$@$(scheme)$">
|
||||||
<$transclude tiddler=<<tempPalette>> index="$name$">
|
<$transclude tiddler=<<consolidatedPalette>> index="$name$">
|
||||||
<$transclude tiddler="$:/config/DefaultColourMappings/$name$@$(scheme)$">
|
<$transclude tiddler="$:/config/DefaultColourMappings/$name$@$(scheme)$">
|
||||||
<$transclude tiddler="$:/config/DefaultColourMappings/$name$"/>
|
<$transclude tiddler="$:/config/DefaultColourMappings/$name$"/>
|
||||||
</$transclude>
|
</$transclude>
|
||||||
@ -27,28 +27,28 @@ tags: $:/tags/Macro
|
|||||||
</$transclude>
|
</$transclude>
|
||||||
\end colour
|
\end colour
|
||||||
\define color(name) <<colour $name$>>
|
\define color(name) <<colour $name$>>
|
||||||
<$list filter="[<tempPalette>indexes[]sort[]]" variable="colour-name" $debug="yes">
|
<$list filter="[<consolidatedPalette>indexes[]sort[]]" variable="colour-name" $debug="yes">
|
||||||
<$let
|
<$let
|
||||||
palette-entry-text={{{ [<colour-name>addsuffix[@]addsuffix<scheme>] :map[<tempPalette>getindex<currentTiddler>] +[!match[]] :else[<tempPalette>getindex<colour-name>] :else[[$:/config/DefaultColourMappings/]addsuffix<colour-name>get[text]] }}}
|
palette-entry-text={{{ [<colour-name>addsuffix[@]addsuffix<scheme>] :map[<consolidatedPalette>getindex<currentTiddler>] +[!match[]] :else[<consolidatedPalette>getindex<colour-name>] :else[[$:/config/DefaultColourMappings/]addsuffix<colour-name>get[text]] }}}
|
||||||
>
|
>
|
||||||
<$wikify name="colour-value" text=<<palette-entry-text>> mode="inline">
|
<$wikify name="colour-value" text=<<palette-entry-text>> mode="inline">
|
||||||
<$action-setfield $tiddler=<<outputTitle>> $index=<<colour-name>> $value=<<colour-value>>/>
|
<$action-setfield $tiddler=<<outputPalette>> $index=<<colour-name>> $value=<<colour-value>>/>
|
||||||
</$wikify>
|
</$wikify>
|
||||||
</$let>
|
</$let>
|
||||||
</$list>
|
</$list>
|
||||||
\end actions-compile-palette-wikified
|
\end actions-compile-palette-wikified
|
||||||
|
|
||||||
\procedure actions-compile-palette-import(inputTitle,outputTitle,exclusions:"",scheme,palette-type)
|
\procedure actions-compile-palette-import(inputPalette,outputPalette,exclusions:"",scheme,palette-type)
|
||||||
<%if [enlist<exclusions>!match<inputTitle>count[]] :map[enlist<exclusions>count[]compare:number:eq<currentTiddler>] +[!match[]] %>
|
<%if [enlist<exclusions>!match<inputPalette>count[]] :map[enlist<exclusions>count[]compare:number:eq<currentTiddler>] +[!match[]] %>
|
||||||
<%if [<inputTitle>get[palette-type]!match[]else[classic]match<palette-type>] %>
|
<%if [<inputPalette>get[palette-type]!match[]else[classic]match<palette-type>] %>
|
||||||
<$set name="exclusions" filter="[enlist<exclusions>] [<inputTitle>]">
|
<$set name="exclusions" filter="[enlist<exclusions>] [<inputPalette>]">
|
||||||
<!-- Recursively import any imported palette -->
|
<!-- Recursively import any imported palette -->
|
||||||
<$let
|
<$let
|
||||||
prefixed-palette-import={{{ [[palette-import@]addsuffix<scheme>] }}}
|
prefixed-palette-import={{{ [[palette-import@]addsuffix<scheme>] }}}
|
||||||
inputTitle={{{ [<inputTitle>get<prefixed-palette-import>has[title]] :else[<inputTitle>get[palette-import]] }}}
|
inputPalette={{{ [<inputPalette>get<prefixed-palette-import>has[title]] :else[<inputPalette>get[palette-import]] }}}
|
||||||
>
|
>
|
||||||
<%if [<inputTitle>has[title]] %>
|
<%if [<inputPalette>has[title]] %>
|
||||||
<$transclude $variable="actions-compile-palette-import" inputTitle=<<inputTitle>> outputTitle=<<outputTitle>> exclusions=<<exclusions>> scheme=<<scheme>> palette-type=<<palette-type>>/>
|
<$transclude $variable="actions-compile-palette-import" inputPalette=<<inputPalette>> outputPalette=<<outputPalette>> exclusions=<<exclusions>> scheme=<<scheme>> palette-type=<<palette-type>>/>
|
||||||
<%endif%>
|
<%endif%>
|
||||||
</$let>
|
</$let>
|
||||||
<!-- Copy the suffixed palette entries with the suffix stripped -->
|
<!-- Copy the suffixed palette entries with the suffix stripped -->
|
||||||
@ -56,53 +56,54 @@ tags: $:/tags/Macro
|
|||||||
<$let
|
<$let
|
||||||
prefixed-scheme={{{ [<scheme>addprefix[@]] }}}
|
prefixed-scheme={{{ [<scheme>addprefix[@]] }}}
|
||||||
>
|
>
|
||||||
<$action-setmultiplefields $tiddler=<<outputTitle>> $indexes="[<inputTitle>indexes[]suffix<prefixed-scheme>removesuffix<prefixed-scheme>sort[]]" $values="[<inputTitle>indexes[]suffix<prefixed-scheme>sort[]] :map[<inputTitle>getindex<currentTiddler>]"/>
|
<$action-setmultiplefields $tiddler=<<outputPalette>> $indexes="[<inputPalette>indexes[]suffix<prefixed-scheme>removesuffix<prefixed-scheme>sort[]]" $values="[<inputPalette>indexes[]suffix<prefixed-scheme>sort[]] :map[<inputPalette>getindex<currentTiddler>]"/>
|
||||||
</$let>
|
</$let>
|
||||||
<%endif%
|
<%endif%
|
||||||
<!-- Copy the unsuffixed palette entries -->
|
<!-- Copy the unsuffixed palette entries -->
|
||||||
<$action-setmultiplefields $tiddler=<<outputTitle>> $indexes="[<inputTitle>indexes[]!regexp[@]sort[]]" $values="[<inputTitle>indexes[]!regexp[@]sort[]] :map[<inputTitle>getindex<currentTiddler>]"/>
|
<$action-setmultiplefields $tiddler=<<outputPalette>> $indexes="[<inputPalette>indexes[]!regexp[@]sort[]]" $values="[<inputPalette>indexes[]!regexp[@]sort[]] :map[<inputPalette>getindex<currentTiddler>]"/>
|
||||||
<!-- Copy the fields from the palette -->
|
<!-- Copy the fields from the palette -->
|
||||||
<$action-setmultiplefields $tiddler=<<outputTitle>> $fields="[<inputTitle>fields[]sort[]] -title -tags -text" $values="[<inputTitle>fields[]sort[]] -title -tags -text :map[<inputTitle>get<currentTiddler>]"/>
|
<$action-setmultiplefields $tiddler=<<outputPalette>> $fields="[<inputPalette>fields[]sort[]] -title -tags -text" $values="[<inputPalette>fields[]sort[]] -title -tags -text :map[<inputPalette>get<currentTiddler>]"/>
|
||||||
</$set>
|
</$set>
|
||||||
<%endif%>
|
<%endif%>
|
||||||
<%endif%>
|
<%endif%>
|
||||||
\end actions-compile-palette-import
|
\end actions-compile-palette-import
|
||||||
|
|
||||||
\procedure actions-compile-palette(inputTitle,outputTitle,defaultImport="$:/palettes/Vanilla")
|
\procedure actions-compile-palette(inputPalette,outputPalette)
|
||||||
\procedure tv-action-refresh-policy() always
|
\procedure tv-action-refresh-policy() always
|
||||||
<$let
|
<$let
|
||||||
tempPalette="$:/temp/palette-consolidated"
|
consolidatedPalette="$:/temp/palette-consolidated"
|
||||||
>
|
>
|
||||||
<!-- Compute the current scheme -->
|
<!-- Compute the current scheme -->
|
||||||
<$let
|
<$let
|
||||||
palette-type={{{ [<inputTitle>get[palette-type]] :else[[classic]] }}}
|
palette-type={{{ [<inputPalette>get[palette-type]] :else[[classic]] }}}
|
||||||
color-scheme-filter={{{ [<inputTitle>get[color-scheme]] :else[[light]] }}}
|
color-scheme-filter={{{ [<inputPalette>get[color-scheme]] :else[[light]] }}}
|
||||||
scheme={{{ [subfilter<color-scheme-filter>] }}}
|
scheme={{{ [subfilter<color-scheme-filter>] }}}
|
||||||
>
|
>
|
||||||
<!-- Clear the temporary consolidated palette -->
|
<!-- Clear the consolidated palette that stores the result of flattening the chain of imported input palettes -->
|
||||||
<$action-deletetiddler $tiddler=<<tempPalette>>/>
|
<$action-deletetiddler $tiddler=<<consolidatedPalette>>/>
|
||||||
<$action-setfield $tiddler=<<tempPalette>> type="application/x-tiddler-dictionary"/>
|
<$action-setfield $tiddler=<<consolidatedPalette>> type="application/x-tiddler-dictionary"/>
|
||||||
<$action-deletetiddler $tiddler=<<outputTitle>>/>
|
<!-- Clear the output palette that stores the plain CSS values of palette entries -->
|
||||||
<$action-setfield $tiddler=<<outputTitle>> type="application/x-tiddler-dictionary"/>
|
<$action-deletetiddler $tiddler=<<outputPalette>>/>
|
||||||
|
<$action-setfield $tiddler=<<outputPalette>> type="application/x-tiddler-dictionary"/>
|
||||||
<!-- Consolidate the chain of palettes -->
|
<!-- Consolidate the chain of palettes -->
|
||||||
<$transclude $variable="actions-compile-palette-import" inputTitle=<<inputTitle>> outputTitle=<<tempPalette>> scheme=<<scheme>> palette-type=<<palette-type>>/>
|
<$transclude $variable="actions-compile-palette-import" inputPalette=<<inputPalette>> outputPalette=<<consolidatedPalette>> scheme=<<scheme>> palette-type=<<palette-type>>/>
|
||||||
<!-- Save the current scheme in the output tiddler -->
|
<!-- Save the current scheme in the output tiddler -->
|
||||||
<$action-setfield $tiddler=<<outputTitle>> $field="color-scheme" $value=<<scheme>>/>
|
<$action-setfield $tiddler=<<outputPalette>> $field="color-scheme" $value=<<scheme>>/>
|
||||||
<!-- Compile the temporary palette to the output palette -->
|
<!-- Compile the temporary palette to the output palette -->
|
||||||
<%if [<inputTitle>get[palette-type]match[modern]] %>
|
<%if [<inputPalette>get[palette-type]match[modern]] %>
|
||||||
<$transclude $variable="actions-compile-palette-filtered" tempPalette=<<tempPalette>> outputTitle=<<outputTitle>> scheme=<<scheme>>/>
|
<$transclude $variable="actions-compile-palette-filtered" consolidatedPalette=<<consolidatedPalette>> outputPalette=<<outputPalette>> scheme=<<scheme>>/>
|
||||||
<%else%>
|
<%else%>
|
||||||
<$transclude $variable="actions-compile-palette-wikified" tempPalette=<<tempPalette>> outputTitle=<<outputTitle>> scheme=<<scheme>>/>
|
<$transclude $variable="actions-compile-palette-wikified" consolidatedPalette=<<consolidatedPalette>> outputPalette=<<outputPalette>> scheme=<<scheme>>/>
|
||||||
<%endif%>
|
<%endif%>
|
||||||
<!-- Remove the temporary consolidated palette -->
|
<!-- Remove the temporary consolidated palette -->
|
||||||
<!-- <$action-deletetiddler $tiddler=<<tempPalette>>/> -->
|
<!-- <$action-deletetiddler $tiddler=<<consolidatedPalette>>/> -->
|
||||||
</$let>
|
</$let>
|
||||||
</$let>
|
</$let>
|
||||||
\end actions-compile-palette
|
\end actions-compile-palette
|
||||||
|
|
||||||
\procedure actions-recompile-current-palette()
|
\procedure actions-recompile-current-palette()
|
||||||
\procedure tv-action-refresh-policy() always
|
\procedure tv-action-refresh-policy() always
|
||||||
<$transclude $variable="actions-compile-palette" inputTitle={{$:/palette}} outputTitle="$:/temp/palette-colours"/>
|
<$transclude $variable="actions-compile-palette" inputPalette={{$:/palette}} outputPalette="$:/temp/palette-colours"/>
|
||||||
\end actions-recompile-current-palette
|
\end actions-recompile-current-palette
|
||||||
|
|
||||||
\procedure actions-switch-colour-palette(paletteTitle)
|
\procedure actions-switch-colour-palette(paletteTitle)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user