mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-07-25 04:58:54 +00:00
Clean up palette and filter run prefix code
Removes the unused actions-switch-colour-palette procedure, fixes the filter and subfilter operators to fall back to the default filter run prefix when given an empty suffix, and notes that the DefaultColourMappings fallback is retained for third party compatibility
This commit is contained in:
@@ -14,7 +14,7 @@ Export our filter function
|
||||
*/
|
||||
exports.filter = function(source,operator,options) {
|
||||
var suffixes = operator.suffixes || [],
|
||||
defaultFilterRunPrefix = (suffixes[0] || [options.defaultFilterRunPrefix] || [])[0] || "or",
|
||||
defaultFilterRunPrefix = (suffixes[0] && suffixes[0][0]) || options.defaultFilterRunPrefix || "or",
|
||||
filterFn = options.wiki.compileFilter(operator.operand,{defaultFilterRunPrefix}),
|
||||
results = [],
|
||||
target = operator.prefix !== "!";
|
||||
|
||||
@@ -14,7 +14,7 @@ Export our filter function
|
||||
*/
|
||||
exports.subfilter = function(source,operator,options) {
|
||||
var suffixes = operator.suffixes || [],
|
||||
defaultFilterRunPrefix = (suffixes[0] || [options.defaultFilterRunPrefix] || [])[0] || "or";
|
||||
defaultFilterRunPrefix = (suffixes[0] && suffixes[0][0]) || options.defaultFilterRunPrefix || "or";
|
||||
var list = options.wiki.filterTiddlers(operator.operand,options.widget,source,{defaultFilterRunPrefix});
|
||||
if(operator.prefix === "!") {
|
||||
var results = [];
|
||||
|
||||
@@ -2,6 +2,7 @@ title: $:/core/macros/CSS
|
||||
tags: $:/tags/Macro
|
||||
|
||||
\procedure actions-compile-palette-filtered(consolidatedPalette,outputPalette)
|
||||
<!-- The $:/config/DefaultColourMappings/ fallback used below is unused by the core and is retained for compatibility with third party plugins -->
|
||||
<!-- Note the join, needed to cope with palette entries containing spaces -->
|
||||
\function tf.colour(name) [<consolidatedPalette>getindex<name>] :else[[$:/config/DefaultColourMappings/]addsuffix<name>get[text]] :map[tf.colour-inner-transform-classic-palette-entry<currentTiddler>] :map[subfilter:all<currentTiddler>join[ ]]
|
||||
\function colour(name) [tf.colour<name>]
|
||||
@@ -83,12 +84,6 @@ tags: $:/tags/Macro
|
||||
<$transclude $variable="actions-compile-palette" inputPalette={{$:/palette}} outputPalette="$:/temp/palette-colours"/>
|
||||
\end actions-recompile-current-palette
|
||||
|
||||
\procedure actions-switch-colour-palette(paletteTitle)
|
||||
\procedure tv-action-refresh-policy() always
|
||||
<$action-deletetiddler $tiddler="$:/temp/palette-colours"/>
|
||||
<<actions-recompile-current-palette>>
|
||||
\end actions-switch-colour-palette
|
||||
|
||||
\procedure tv-palette-name() $:/temp/palette-colours
|
||||
|
||||
\function tf.colour(name)
|
||||
|
||||
Reference in New Issue
Block a user