mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-09 08:50:26 +00:00
thank you pmario, cleaned up global functions
This commit is contained in:
parent
c617e28b97
commit
30b4a4f58b
@ -1,5 +1,6 @@
|
||||
title: $:/core/functions/themes
|
||||
tags: $:/tags/Global
|
||||
code-body: yes
|
||||
|
||||
\function is.pixel.value(value) [<value>removesuffix[px]]
|
||||
\function is.percentage.value(value) [<value>removesuffix[%]]
|
||||
@ -19,41 +20,87 @@ tags: $:/tags/Global
|
||||
\function convert.to.pt(value) [convert.to.in<value>multiply[72]]
|
||||
\function convert.to.em(value) [[storyTiddler]is[variable]then<value>divide{$:/themes/tiddlywiki/vanilla/metrics/bodyfontsize}] [[storyTiddler]!is[variable]then<value>divide{$:/themes/tiddlywiki/vanilla/metrics/fontsize}]
|
||||
|
||||
\function convert.to.pixels(value,metric) [<metric>match[cm]then<value>multiply[37.8]] [<metric>match[mm]then<value>multiply[37.8]divide[10]] [<metric>match[Q]then<value>multiply[37.8]divide[40]] [<metric>match[in]then<value>multiply[96]] [<metric>match[pc]then<value>multiply[96]divide[6]] [<metric>match[pt]then<value>multiply[96]divide[72]] [<metric>match[em]then[storyTiddler]is[variable]then<value>multiply{$:/themes/tiddlywiki/vanilla/metrics/bodyfontsize}] [<metric>match[em]then[storyTiddler]!is[variable]then<value>multiply{$:/themes/tiddlywiki/vanilla/metrics/fontsize}]
|
||||
\function convert.to.pixels(value,metric)
|
||||
[<metric>match[cm]then<value>multiply[37.8]]
|
||||
[<metric>match[mm]then<value>multiply[37.8]divide[10]]
|
||||
[<metric>match[Q]then<value>multiply[37.8]divide[40]]
|
||||
[<metric>match[in]then<value>multiply[96]]
|
||||
[<metric>match[pc]then<value>multiply[96]divide[6]]
|
||||
[<metric>match[pt]then<value>multiply[96]divide[72]]
|
||||
[<metric>match[em]then[storyTiddler]is[variable]then<value>multiply{$:/themes/tiddlywiki/vanilla/metrics/bodyfontsize}]
|
||||
[<metric>match[em]then[storyTiddler]!is[variable]then<value>multiply{$:/themes/tiddlywiki/vanilla/metrics/fontsize}]
|
||||
\end
|
||||
|
||||
\function subtract.one.from.sidebarbreakpoint(value) [is.pixel.value<value>subtract[1]addsuffix[px]] :else[is.cm.value<value>function[convert.to.pixels],<value>,[cm]subtract[1]divide[37.8]addsuffix[cm]] :else[is.mm.value<value>function[convert.to.pixels],<value>,[mm]subtract[1]divide[37.8]multiply[10]addsuffix[mm]] :else[is.Q.value<value>function[convert.to.pixels],<value>,[Q]subtract[1]divide[37.8]multiply[40]addsuffix[Q]] :else[is.in.value<value>function[convert.to.pixels],<value>,[in]subtract[1]divide[96]addsuffix[in]] :else[is.pc.value<value>function[convert.to.pixels],<value>,[pc]subtract[1]divide[96]multiply[6]addsuffix[pc]] :else[is.pt.value<value>function[convert.to.pixels],<value>,[pt]subtract[1]divide[96]multiply[72]addsuffix[pt]] :else[is.em.value<value>function[convert.to.pixels],<value>,[em]subtract[1]divide{$:/themes/tiddlywiki/vanilla/metrics/fontsize}addsuffix[em]]
|
||||
\function subtract.one.from.sidebarbreakpoint(value)
|
||||
[is.pixel.value<value>subtract[1]addsuffix[px]]
|
||||
:else[is.cm.value<value>convert.to.pixels<value>,[cm]subtract[1]divide[37.8]addsuffix[cm]]
|
||||
:else[is.mm.value<value>convert.to.pixels<value>,[mm]subtract[1]divide[37.8]multiply[10]addsuffix[mm]]
|
||||
:else[is.Q.value<value>convert.to.pixels<value>,[Q]subtract[1]divide[37.8]multiply[40]addsuffix[Q]]
|
||||
:else[is.in.value<value>convert.to.pixels<value>,[in]subtract[1]divide[96]addsuffix[in]]
|
||||
:else[is.pc.value<value>convert.to.pixels<value>,[pc]subtract[1]divide[96]multiply[6]addsuffix[pc]]
|
||||
:else[is.pt.value<value>convert.to.pixels<value>,[pt]subtract[1]divide[96]multiply[72]addsuffix[pt]]
|
||||
:else[is.em.value<value>convert.to.pixels<value>,[em]subtract[1]divide{$:/themes/tiddlywiki/vanilla/metrics/fontsize}addsuffix[em]]
|
||||
\end
|
||||
|
||||
\function sidebarbreakpoint() [{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}]
|
||||
|
||||
\function sidebarbreakpoint-minus-one() [function[subtract.one.from.sidebarbreakpoint],<sidebarbreakpoint>] :else[<sidebarbreakpoint>]
|
||||
\function sidebarbreakpoint-minus-one() [subtract.one.from.sidebarbreakpoint<sidebarbreakpoint>] :else[<sidebarbreakpoint>]
|
||||
|
||||
\function add.one.to.breakpoint(value) [is.pixel.value<value>add[1]addsuffix[px]] :else[is.cm.value<value>function[convert.to.pixels],<value>,[cm]add[1]divide[37.8]addsuffix[cm]] :else[is.mm.value<value>function[convert.to.pixels],<value>,[mm]add[1]divide[37.8]multiply[10]addsuffix[mm]] :else[is.Q.value<value>function[convert.to.pixels],<value>,[Q]add[1]divide[37.8]multiply[40]addsuffix[Q]] :else[is.in.value<value>function[convert.to.pixels],<value>,[in]add[1]divide[96]addsuffix[in]] :else[is.pc.value<value>function[convert.to.pixels],<value>,[pc]add[1]divide[96]multiply[6]addsuffix[pc]] :else[is.pt.value<value>function[convert.to.pixels],<value>,[pt]add[1]divide[96]multiply[72]addsuffix[pt]] :else[is.em.value<value>function[convert.to.pixels],<value>,[em]add[1]divide{$:/themes/tiddlywiki/vanilla/metrics/fontsize}addsuffix[em]]
|
||||
\function add.one.to.breakpoint(value)
|
||||
[is.pixel.value<value>add[1]addsuffix[px]]
|
||||
:else[is.cm.value<value>convert.to.pixels<value>,[cm]add[1]divide[37.8]addsuffix[cm]]
|
||||
:else[is.mm.value<value>convert.to.pixels<value>,[mm]add[1]divide[37.8]multiply[10]addsuffix[mm]]
|
||||
:else[is.Q.value<value>convert.to.pixels<value>,[Q]add[1]divide[37.8]multiply[40]addsuffix[Q]]
|
||||
:else[is.in.value<value>convert.to.pixels<value>,[in]add[1]divide[96]addsuffix[in]]
|
||||
:else[is.pc.value<value>convert.to.pixels<value>,[pc]add[1]divide[96]multiply[6]addsuffix[pc]]
|
||||
:else[is.pt.value<value>convert.to.pixels<value>,[pt]add[1]divide[96]multiply[72]addsuffix[pt]]
|
||||
:else[is.em.value<value>convert.to.pixels<value>,[em]add[1]divide{$:/themes/tiddlywiki/vanilla/metrics/fontsize}addsuffix[em]]
|
||||
\end
|
||||
|
||||
\function breakpoint-plus-one() [function[add.one.to.breakpoint],{$:/config/plugins/menubar/breakpoint}] :else[{$:/config/plugins/menubar/breakpoint}]
|
||||
\function breakpoint-plus-one() [add.one.to.breakpoint{$:/config/plugins/menubar/breakpoint}] :else[{$:/config/plugins/menubar/breakpoint}]
|
||||
|
||||
\function get.base.theme.metric.recursive(theme,metric) [<theme>get[dependents]enlist-input[]] :map[function[get.base.theme.metric],<currentTiddler>,<metric>]
|
||||
\function get.base.theme.metric.recursive(theme,metric) [<theme>get[dependents]enlist-input[]] :map[get.base.theme.metric<currentTiddler>,<metric>]
|
||||
|
||||
\function get.base.theme.metric(theme,metric) [<theme>addsuffix[/metrics/]addsuffix<metric>!is[missing]] :else[<theme>addsuffix[/metrics/]addsuffix<metric>is[shadow]] :else[function[get.base.theme.metric.recursive],<theme>,<metric>]
|
||||
\function get.base.theme.metric(theme,metric)
|
||||
[<theme>addsuffix[/metrics/]addsuffix<metric>!is[missing]]
|
||||
:else[<theme>addsuffix[/metrics/]addsuffix<metric>is[shadow]]
|
||||
:else[get.base.theme.metric.recursive<theme>,<metric>]
|
||||
\end
|
||||
|
||||
\function get.base.theme(theme,metric) [function[get.base.theme.metric],<theme>,<metric>first[]removesuffix<metric>removesuffix[/metrics/]]
|
||||
\function get.base.theme(theme,metric) [get.base.theme.metric<theme>,<metric>first[]removesuffix<metric>removesuffix[/metrics/]]
|
||||
|
||||
\function get.theme.metric(metric) [function[get.base.theme.metric],<get.current.theme>,<metric>first[]get[text]]
|
||||
\function get.theme.metric(metric) [get.base.theme.metric<get.current.theme>,<metric>first[]get[text]]
|
||||
|
||||
\function get.base.theme.option.recursive(theme,option) [<theme>get[dependents]enlist-input[]] :map[function[get.base.theme.option],<currentTiddler>,<option>]
|
||||
\function get.base.theme.option.recursive(theme,option) [<theme>get[dependents]enlist-input[]] :map[get.base.theme.option<currentTiddler>,<option>]
|
||||
|
||||
\function get.base.theme.option(theme,option) [<theme>addsuffix[/options/]addsuffix<option>!is[missing]] :else[<theme>addsuffix[/options/]addsuffix<option>is[shadow]] :else[function[get.base.theme.option.recursive],<theme>,<option>]
|
||||
\function get.base.theme.option(theme,option)
|
||||
[<theme>addsuffix[/options/]addsuffix<option>!is[missing]]
|
||||
:else[<theme>addsuffix[/options/]addsuffix<option>is[shadow]]
|
||||
:else[get.base.theme.option.recursive<theme>,<option>]
|
||||
\end
|
||||
|
||||
\function get.theme.option(option) [function[get.base.theme.option],<get.current.theme>,<option>first[]get[text]]
|
||||
\function get.theme.option(option) [get.base.theme.option<get.current.theme>,<option>first[]get[text]]
|
||||
|
||||
\function get.theme.explicit.option(option) [<get.current.theme>addsuffix[/options/]addsuffix<option>get[text]]
|
||||
|
||||
\function get.theme(metric) [function[get.base.theme],<get.current.theme>,<metric>addsuffix[/metrics/]addsuffix<metric>!is[missing]] :else[function[get.base.theme],<get.current.theme>,<metric>addsuffix[/metrics/]addsuffix<metric>is[shadow]] :else[[$:/themes/tiddlywiki/vanilla/metrics/]addsuffix<metric>]
|
||||
\function get.theme(metric)
|
||||
[get.base.theme<get.current.theme>,<metric>addsuffix[/metrics/]addsuffix<metric>!is[missing]]
|
||||
:else[get.base.theme<get.current.theme>,<metric>addsuffix[/metrics/]addsuffix<metric>is[shadow]]
|
||||
:else[[$:/themes/tiddlywiki/vanilla/metrics/]addsuffix<metric>]
|
||||
\end
|
||||
|
||||
\function set.theme.metric(metric) [function[get.base.theme.metric],<get.current.theme>,<metric>first[]is[shadow]] :else[function[get.base.theme.metric],<get.current.theme>,<metric>first[]!is[shadow]!is[missing]] :else[[$:/themes/tiddlywiki/vanilla/metrics/]addsuffix<metric>]
|
||||
\function set.theme.metric(metric)
|
||||
[get.base.theme.metric<get.current.theme>,<metric>first[]is[shadow]]
|
||||
:else[get.base.theme.metric<get.current.theme>,<metric>first[]!is[shadow]!is[missing]]
|
||||
:else[[$:/themes/tiddlywiki/vanilla/metrics/]addsuffix<metric>]
|
||||
\end
|
||||
|
||||
\function get.base.functions.theme.recursive(theme) [<theme>get[dependents]enlist-input[]] :map[function[get.base.functions.theme],<currentTiddler>]
|
||||
\function get.base.functions.theme.recursive(theme) [<theme>get[dependents]enlist-input[]] :map[get.base.functions.theme<currentTiddler>]
|
||||
|
||||
\function get.base.functions.theme(theme) [<theme>addsufix[/functions]!is[missing]] :else[<theme>addsuffix[/functions]is[shadow]] :else[function[get.base.functions.theme.recursive],<theme>]
|
||||
\function get.base.functions.theme(theme)
|
||||
[<theme>addsufix[/functions]!is[missing]]
|
||||
:else[<theme>addsuffix[/functions]is[shadow]]
|
||||
:else[get.base.functions.theme.recursive<theme>]
|
||||
\end
|
||||
|
||||
\function get.current.theme() [{$:/theme}!is[blank]] :else[all[tiddlers+shadows]plugin-type[theme]plugin-priority[0]first[]]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user