diff --git a/core/wiki/functions/themes.tid b/core/wiki/functions/themes.tid index 365a60874..13c7d0fbe 100644 --- a/core/wiki/functions/themes.tid +++ b/core/wiki/functions/themes.tid @@ -1,5 +1,6 @@ title: $:/core/functions/themes tags: $:/tags/Global +code-body: yes \function is.pixel.value(value) [removesuffix[px]] \function is.percentage.value(value) [removesuffix[%]] @@ -19,41 +20,87 @@ tags: $:/tags/Global \function convert.to.pt(value) [convert.to.inmultiply[72]] \function convert.to.em(value) [[storyTiddler]is[variable]thendivide{$:/themes/tiddlywiki/vanilla/metrics/bodyfontsize}] [[storyTiddler]!is[variable]thendivide{$:/themes/tiddlywiki/vanilla/metrics/fontsize}] -\function convert.to.pixels(value,metric) [match[cm]thenmultiply[37.8]] [match[mm]thenmultiply[37.8]divide[10]] [match[Q]thenmultiply[37.8]divide[40]] [match[in]thenmultiply[96]] [match[pc]thenmultiply[96]divide[6]] [match[pt]thenmultiply[96]divide[72]] [match[em]then[storyTiddler]is[variable]thenmultiply{$:/themes/tiddlywiki/vanilla/metrics/bodyfontsize}] [match[em]then[storyTiddler]!is[variable]thenmultiply{$:/themes/tiddlywiki/vanilla/metrics/fontsize}] +\function convert.to.pixels(value,metric) +[match[cm]thenmultiply[37.8]] +[match[mm]thenmultiply[37.8]divide[10]] +[match[Q]thenmultiply[37.8]divide[40]] +[match[in]thenmultiply[96]] +[match[pc]thenmultiply[96]divide[6]] +[match[pt]thenmultiply[96]divide[72]] +[match[em]then[storyTiddler]is[variable]thenmultiply{$:/themes/tiddlywiki/vanilla/metrics/bodyfontsize}] +[match[em]then[storyTiddler]!is[variable]thenmultiply{$:/themes/tiddlywiki/vanilla/metrics/fontsize}] +\end -\function subtract.one.from.sidebarbreakpoint(value) [is.pixel.valuesubtract[1]addsuffix[px]] :else[is.cm.valuefunction[convert.to.pixels],,[cm]subtract[1]divide[37.8]addsuffix[cm]] :else[is.mm.valuefunction[convert.to.pixels],,[mm]subtract[1]divide[37.8]multiply[10]addsuffix[mm]] :else[is.Q.valuefunction[convert.to.pixels],,[Q]subtract[1]divide[37.8]multiply[40]addsuffix[Q]] :else[is.in.valuefunction[convert.to.pixels],,[in]subtract[1]divide[96]addsuffix[in]] :else[is.pc.valuefunction[convert.to.pixels],,[pc]subtract[1]divide[96]multiply[6]addsuffix[pc]] :else[is.pt.valuefunction[convert.to.pixels],,[pt]subtract[1]divide[96]multiply[72]addsuffix[pt]] :else[is.em.valuefunction[convert.to.pixels],,[em]subtract[1]divide{$:/themes/tiddlywiki/vanilla/metrics/fontsize}addsuffix[em]] +\function subtract.one.from.sidebarbreakpoint(value) +[is.pixel.valuesubtract[1]addsuffix[px]] +:else[is.cm.valueconvert.to.pixels,[cm]subtract[1]divide[37.8]addsuffix[cm]] +:else[is.mm.valueconvert.to.pixels,[mm]subtract[1]divide[37.8]multiply[10]addsuffix[mm]] +:else[is.Q.valueconvert.to.pixels,[Q]subtract[1]divide[37.8]multiply[40]addsuffix[Q]] +:else[is.in.valueconvert.to.pixels,[in]subtract[1]divide[96]addsuffix[in]] +:else[is.pc.valueconvert.to.pixels,[pc]subtract[1]divide[96]multiply[6]addsuffix[pc]] +:else[is.pt.valueconvert.to.pixels,[pt]subtract[1]divide[96]multiply[72]addsuffix[pt]] +:else[is.em.valueconvert.to.pixels,[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],] :else[] +\function sidebarbreakpoint-minus-one() [subtract.one.from.sidebarbreakpoint] :else[] -\function add.one.to.breakpoint(value) [is.pixel.valueadd[1]addsuffix[px]] :else[is.cm.valuefunction[convert.to.pixels],,[cm]add[1]divide[37.8]addsuffix[cm]] :else[is.mm.valuefunction[convert.to.pixels],,[mm]add[1]divide[37.8]multiply[10]addsuffix[mm]] :else[is.Q.valuefunction[convert.to.pixels],,[Q]add[1]divide[37.8]multiply[40]addsuffix[Q]] :else[is.in.valuefunction[convert.to.pixels],,[in]add[1]divide[96]addsuffix[in]] :else[is.pc.valuefunction[convert.to.pixels],,[pc]add[1]divide[96]multiply[6]addsuffix[pc]] :else[is.pt.valuefunction[convert.to.pixels],,[pt]add[1]divide[96]multiply[72]addsuffix[pt]] :else[is.em.valuefunction[convert.to.pixels],,[em]add[1]divide{$:/themes/tiddlywiki/vanilla/metrics/fontsize}addsuffix[em]] +\function add.one.to.breakpoint(value) +[is.pixel.valueadd[1]addsuffix[px]] +:else[is.cm.valueconvert.to.pixels,[cm]add[1]divide[37.8]addsuffix[cm]] +:else[is.mm.valueconvert.to.pixels,[mm]add[1]divide[37.8]multiply[10]addsuffix[mm]] +:else[is.Q.valueconvert.to.pixels,[Q]add[1]divide[37.8]multiply[40]addsuffix[Q]] +:else[is.in.valueconvert.to.pixels,[in]add[1]divide[96]addsuffix[in]] +:else[is.pc.valueconvert.to.pixels,[pc]add[1]divide[96]multiply[6]addsuffix[pc]] +:else[is.pt.valueconvert.to.pixels,[pt]add[1]divide[96]multiply[72]addsuffix[pt]] +:else[is.em.valueconvert.to.pixels,[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) [get[dependents]enlist-input[]] :map[function[get.base.theme.metric],,] +\function get.base.theme.metric.recursive(theme,metric) [get[dependents]enlist-input[]] :map[get.base.theme.metric,] -\function get.base.theme.metric(theme,metric) [addsuffix[/metrics/]addsuffix!is[missing]] :else[addsuffix[/metrics/]addsuffixis[shadow]] :else[function[get.base.theme.metric.recursive],,] +\function get.base.theme.metric(theme,metric) +[addsuffix[/metrics/]addsuffix!is[missing]] +:else[addsuffix[/metrics/]addsuffixis[shadow]] +:else[get.base.theme.metric.recursive,] +\end -\function get.base.theme(theme,metric) [function[get.base.theme.metric],,first[]removesuffixremovesuffix[/metrics/]] +\function get.base.theme(theme,metric) [get.base.theme.metric,first[]removesuffixremovesuffix[/metrics/]] -\function get.theme.metric(metric) [function[get.base.theme.metric],,first[]get[text]] +\function get.theme.metric(metric) [get.base.theme.metric,first[]get[text]] -\function get.base.theme.option.recursive(theme,option) [get[dependents]enlist-input[]] :map[function[get.base.theme.option],,