mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 17:10:29 +00:00
Merge branch 'master' into geospatial-plugin
This commit is contained in:
commit
449460136d
@ -5,7 +5,7 @@
|
||||
# Default to the current version number for building the plugin library
|
||||
|
||||
if [ -z "$TW5_BUILD_VERSION" ]; then
|
||||
TW5_BUILD_VERSION=v5.3.0
|
||||
TW5_BUILD_VERSION=v5.3.2
|
||||
fi
|
||||
|
||||
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
||||
|
13
boot/boot.js
13
boot/boot.js
@ -575,9 +575,8 @@ var globalCheck =[
|
||||
" configurable: true",
|
||||
" });",
|
||||
" if(Object.keys(__temp__).length){",
|
||||
" console.log(Object.keys(__temp__));",
|
||||
" console.log(\"Warning: Global assignment detected\",Object.keys(__temp__));",
|
||||
" delete Object.prototype.__temp__;",
|
||||
" throw \"Global assignment is not allowed within modules on node.\";",
|
||||
" }",
|
||||
" delete Object.prototype.__temp__;",
|
||||
].join('\n');
|
||||
@ -596,11 +595,11 @@ $tw.utils.evalGlobal = function(code,context,filename,sandbox,allowGlobals) {
|
||||
// Add the code prologue and epilogue
|
||||
code = [
|
||||
"(function(" + contextNames.join(",") + ") {",
|
||||
" (function(){\n" + code + "\n;})();",
|
||||
" (function(){" + code + "\n;})();\n",
|
||||
(!$tw.browser && sandbox && !allowGlobals) ? globalCheck : "",
|
||||
" return exports;\n",
|
||||
"\nreturn exports;\n",
|
||||
"})"
|
||||
].join("\n");
|
||||
].join("");
|
||||
|
||||
// Compile the code into a function
|
||||
var fn;
|
||||
@ -926,7 +925,7 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
|
||||
}
|
||||
} else {
|
||||
// line number should be included in e.stack for runtime errors
|
||||
$tw.utils.error("Error executing boot module " + name + ": " + JSON.stringify(e) + "\n\n" + e.stack);
|
||||
$tw.utils.error("Error executing boot module " + name + ": " + String(e) + "\n\n" + e.stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1150,7 +1149,7 @@ $tw.Wiki = function(options) {
|
||||
shadowTiddlerTitles = null,
|
||||
getShadowTiddlerTitles = function() {
|
||||
if(!shadowTiddlerTitles) {
|
||||
shadowTiddlerTitles = Object.keys(shadowTiddlers);
|
||||
shadowTiddlerTitles = Object.keys(shadowTiddlers).sort(function(a,b) {return a.localeCompare(b);});
|
||||
}
|
||||
return shadowTiddlerTitles;
|
||||
},
|
||||
|
@ -1,6 +1,4 @@
|
||||
title: $:/core/images/new-journal-button
|
||||
tags: $:/tags/Image
|
||||
|
||||
<$parameters size="22pt" day=<<now "DD">>>
|
||||
<svg width=<<size>> height=<<size>> class="tc-image-new-journal-button tc-image-button" viewBox="0 0 128 128"><g fill-rule="evenodd"><path d="M102.545 112.818v11.818c0 1.306 1.086 2.364 2.425 2.364h6.06c1.34 0 2.425-1.058 2.425-2.364v-11.818h12.12c1.34 0 2.425-1.058 2.425-2.363v-5.91c0-1.305-1.085-2.363-2.424-2.363h-12.121V90.364c0-1.306-1.086-2.364-2.425-2.364h-6.06c-1.34 0-2.425 1.058-2.425 2.364v11.818h-12.12c-1.34 0-2.425 1.058-2.425 2.363v5.91c0 1.305 1.085 2.363 2.424 2.363h12.121zM60.016 4.965c-4.781-2.76-10.897-1.118-13.656 3.66L5.553 79.305A9.993 9.993 0 009.21 92.963l51.04 29.468c4.78 2.76 10.897 1.118 13.655-3.66l40.808-70.681a9.993 9.993 0 00-3.658-13.656L60.016 4.965zm-3.567 27.963a6 6 0 106-10.393 6 6 0 00-6 10.393zm31.697 17.928a6 6 0 106-10.392 6 6 0 00-6 10.392z"/><text class="tc-fill-background" font-family="Helvetica" font-size="47.172" font-weight="bold" transform="rotate(30 25.742 95.82)"><tspan x="42" y="77.485" text-anchor="middle"><$text text=<<day>>/></tspan></text></g></svg>
|
||||
</$parameters>
|
||||
<$parameters size="22pt" day=<<now "DD">>><svg width=<<size>> height=<<size>> class="tc-image-new-journal-button tc-image-button" viewBox="0 0 128 128"><g fill-rule="evenodd"><path d="M102.545 112.818v11.818c0 1.306 1.086 2.364 2.425 2.364h6.06c1.34 0 2.425-1.058 2.425-2.364v-11.818h12.12c1.34 0 2.425-1.058 2.425-2.363v-5.91c0-1.305-1.085-2.363-2.424-2.363h-12.121V90.364c0-1.306-1.086-2.364-2.425-2.364h-6.06c-1.34 0-2.425 1.058-2.425 2.364v11.818h-12.12c-1.34 0-2.425 1.058-2.425 2.363v5.91c0 1.305 1.085 2.363 2.424 2.363h12.121zM60.016 4.965c-4.781-2.76-10.897-1.118-13.656 3.66L5.553 79.305A9.993 9.993 0 009.21 92.963l51.04 29.468c4.78 2.76 10.897 1.118 13.655-3.66l40.808-70.681a9.993 9.993 0 00-3.658-13.656L60.016 4.965zm-3.567 27.963a6 6 0 106-10.393 6 6 0 00-6 10.393zm31.697 17.928a6 6 0 106-10.392 6 6 0 00-6 10.392z"/><text class="tc-fill-background" font-family="Helvetica" font-size="47.172" font-weight="bold" transform="rotate(30 25.742 95.82)"><tspan x="42" y="77.485" text-anchor="middle"><$text text=<<day>>/></tspan></text></g></svg></$parameters>
|
@ -4,7 +4,7 @@ description: Saves a wiki to a new wiki folder
|
||||
<<.from-version "5.1.20">> Saves the current wiki as a wiki folder, including tiddlers, plugins and configuration:
|
||||
|
||||
```
|
||||
--savewikifolder <wikifolderpath> [<filter>]
|
||||
--savewikifolder <wikifolderpath> [<filter>] [ [<name>=<value>] ]*
|
||||
```
|
||||
|
||||
* The target wiki folder must be empty or non-existent
|
||||
@ -12,8 +12,23 @@ description: Saves a wiki to a new wiki folder
|
||||
* Plugins from the official plugin library are replaced with references to those plugins in the `tiddlywiki.info` file
|
||||
* Custom plugins are unpacked into their own folder
|
||||
|
||||
The following options are supported:
|
||||
|
||||
* ''filter'': a filter expression that defines the tiddlers to include in the output.
|
||||
* ''explodePlugins'': defaults to "yes"
|
||||
** ''yes'' will "explode" plugins into separate tiddler files and save them to the plugin directory within the wiki folder
|
||||
** ''no'' will suppress exploding plugins into their constituent tiddler files. It will save the plugin as a single JSON tiddler in the tiddlers folder
|
||||
|
||||
Note that both ''explodePlugins'' options will produce wiki folders that build the same exact same original wiki. The difference lies in how plugins are represented in the wiki folder.
|
||||
|
||||
A common usage is to convert a TiddlyWiki HTML file into a wiki folder:
|
||||
|
||||
```
|
||||
tiddlywiki --load ./mywiki.html --savewikifolder ./mywikifolder
|
||||
```
|
||||
|
||||
Save the plugin to the tiddlers directory of the target wiki folder:
|
||||
|
||||
```
|
||||
tiddlywiki --load ./mywiki.html --savewikifolder ./mywikifolder explodePlugins=no
|
||||
```
|
@ -1,5 +1,5 @@
|
||||
title: $:/language/Help/server
|
||||
description: Provides an HTTP server interface to TiddlyWiki (deprecated in favour of the new listen command)
|
||||
description: (deprecated: see 'listen' command) Provides an HTTP server interface to TiddlyWiki
|
||||
|
||||
Legacy command to serve a wiki over HTTP.
|
||||
|
||||
|
@ -5,7 +5,14 @@ module-type: command
|
||||
|
||||
Command to save the current wiki as a wiki folder
|
||||
|
||||
--savewikifolder <wikifolderpath> [<filter>]
|
||||
--savewikifolder <wikifolderpath> [ [<name>=<value>] ]*
|
||||
|
||||
The following options are supported:
|
||||
|
||||
* ''filter'': a filter expression defining the tiddlers to be included in the output
|
||||
* ''explodePlugins'': set to "no" to suppress exploding plugins into their constituent shadow tiddlers (defaults to "yes")
|
||||
|
||||
Supports backward compatibility with --savewikifolder <wikifolderpath> [<filter>] [ [<name>=<value>] ]*
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
@ -35,14 +42,28 @@ Command.prototype.execute = function() {
|
||||
if(this.params.length < 1) {
|
||||
return "Missing wiki folder path";
|
||||
}
|
||||
var wikifoldermaker = new WikiFolderMaker(this.params[0],this.params[1],this.commander);
|
||||
var regFilter = /^[a-zA-Z0-9\.\-_]+=/g, // dynamic parameters
|
||||
namedParames,
|
||||
tiddlerFilter,
|
||||
options = {};
|
||||
if (regFilter.test(this.params[1])) {
|
||||
namedParames = this.commander.extractNamedParameters(this.params.slice(1));
|
||||
tiddlerFilter = namedParames.filter || "[all[tiddlers]]";
|
||||
} else {
|
||||
namedParames = this.commander.extractNamedParameters(this.params.slice(2));
|
||||
tiddlerFilter = this.params[1];
|
||||
}
|
||||
tiddlerFilter = tiddlerFilter || "[all[tiddlers]]";
|
||||
options.explodePlugins = namedParames.explodePlugins || "yes";
|
||||
var wikifoldermaker = new WikiFolderMaker(this.params[0],tiddlerFilter,this.commander,options);
|
||||
return wikifoldermaker.save();
|
||||
};
|
||||
|
||||
function WikiFolderMaker(wikiFolderPath,wikiFilter,commander) {
|
||||
function WikiFolderMaker(wikiFolderPath,wikiFilter,commander,options) {
|
||||
this.wikiFolderPath = wikiFolderPath;
|
||||
this.wikiFilter = wikiFilter || "[all[tiddlers]]";
|
||||
this.wikiFilter = wikiFilter;
|
||||
this.commander = commander;
|
||||
this.explodePlugins = options.explodePlugins;
|
||||
this.wiki = commander.wiki;
|
||||
this.savedPaths = []; // So that we can detect filename clashes
|
||||
}
|
||||
@ -93,10 +114,13 @@ WikiFolderMaker.prototype.save = function() {
|
||||
self.log("Adding built-in plugin: " + libraryDetails.name);
|
||||
newWikiInfo[libraryDetails.type] = newWikiInfo[libraryDetails.type] || [];
|
||||
$tw.utils.pushTop(newWikiInfo[libraryDetails.type],libraryDetails.name);
|
||||
} else {
|
||||
} else if(self.explodePlugins !== "no") {
|
||||
// A custom plugin
|
||||
self.log("Processing custom plugin: " + title);
|
||||
self.saveCustomPlugin(tiddler);
|
||||
} else if(self.explodePlugins === "no") {
|
||||
self.log("Processing custom plugin to tiddlders folder: " + title);
|
||||
self.saveTiddler("tiddlers", tiddler);
|
||||
}
|
||||
} else {
|
||||
// Ordinary tiddler
|
||||
|
@ -72,9 +72,6 @@ function FramedEngine(options) {
|
||||
if(this.widget.editRows) {
|
||||
this.domNode.setAttribute("rows",this.widget.editRows);
|
||||
}
|
||||
if(this.widget.editDir) {
|
||||
this.domNode.setAttribute("dir",this.widget.editDir);
|
||||
}
|
||||
if(this.widget.editTabIndex) {
|
||||
this.iframeNode.setAttribute("tabindex",this.widget.editTabIndex);
|
||||
}
|
||||
@ -123,7 +120,6 @@ FramedEngine.prototype.copyStyles = function() {
|
||||
this.domNode.style["-webkit-text-fill-color"] = "currentcolor";
|
||||
// Ensure we don't force text direction to LTR
|
||||
this.domNode.style.removeProperty("direction");
|
||||
this.domNode.style.removeProperty("unicodeBidi");
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -52,9 +52,6 @@ function SimpleEngine(options) {
|
||||
if(this.widget.editTabIndex) {
|
||||
this.domNode.setAttribute("tabindex",this.widget.editTabIndex);
|
||||
}
|
||||
if(this.widget.editDir) {
|
||||
this.domNode.setAttribute("dir",this.widget.editDir);
|
||||
}
|
||||
if(this.widget.editAutoComplete) {
|
||||
this.domNode.setAttribute("autocomplete",this.widget.editAutoComplete);
|
||||
}
|
||||
|
@ -183,7 +183,6 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
||||
this.editFocusSelectFromStart = $tw.utils.parseNumber(this.getAttribute("focusSelectFromStart","0"));
|
||||
this.editFocusSelectFromEnd = $tw.utils.parseNumber(this.getAttribute("focusSelectFromEnd","0"));
|
||||
this.editTabIndex = this.getAttribute("tabindex");
|
||||
this.editDir = this.getAttribute("dir");
|
||||
this.editCancelPopups = this.getAttribute("cancelPopups","") === "yes";
|
||||
this.editInputActions = this.getAttribute("inputActions");
|
||||
this.editRefreshTitle = this.getAttribute("refreshTitle");
|
||||
@ -221,7 +220,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
||||
EditTextWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// Completely rerender if any of our attributes have changed
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedAttributes.dir || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE] || changedTiddlers["$:/palette"] || changedAttributes.disabled || changedAttributes.fileDrop) {
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE] || changedTiddlers["$:/palette"] || changedAttributes.disabled || changedAttributes.fileDrop) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else if (changedTiddlers[this.editRefreshTitle]) {
|
||||
|
32
core/modules/filterrunprefixes/then.js
Normal file
32
core/modules/filterrunprefixes/then.js
Normal file
@ -0,0 +1,32 @@
|
||||
/*\
|
||||
title: $:/core/modules/filterrunprefixes/then.js
|
||||
type: application/javascript
|
||||
module-type: filterrunprefix
|
||||
|
||||
Replace results of previous runs unless empty
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter prefix function
|
||||
*/
|
||||
exports.then = function(operationSubFunction) {
|
||||
return function(results,source,widget) {
|
||||
if(results.length !== 0) {
|
||||
// Only run if previous run(s) produced results
|
||||
var thisRunResult = operationSubFunction(source,widget);
|
||||
if(thisRunResult.length !== 0) {
|
||||
// Replace results only if this run actually produces a result
|
||||
results.clear();
|
||||
results.pushTop(thisRunResult);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
})();
|
36
core/modules/filters/substitute.js
Normal file
36
core/modules/filters/substitute.js
Normal file
@ -0,0 +1,36 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/substitute.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator for substituting variables and embedded filter expressions with their corresponding values
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.substitute = function(source,operator,options) {
|
||||
var results = [],
|
||||
operands = [];
|
||||
$tw.utils.each(operator.operands,function(operand,index){
|
||||
operands.push({
|
||||
name: (index + 1).toString(),
|
||||
value: operand
|
||||
});
|
||||
});
|
||||
source(function(tiddler,title) {
|
||||
if(title) {
|
||||
results.push(options.wiki.getSubstitutedText(title,options.widget,{substitutions:operands}));
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -305,10 +305,11 @@ exports.parseAttribute = function(source,pos) {
|
||||
start: pos
|
||||
};
|
||||
// Define our regexps
|
||||
var reAttributeName = /([^\/\s>"'=]+)/g,
|
||||
reUnquotedAttribute = /([^\/\s<>"'=]+)/g,
|
||||
var reAttributeName = /([^\/\s>"'`=]+)/g,
|
||||
reUnquotedAttribute = /([^\/\s<>"'`=]+)/g,
|
||||
reFilteredValue = /\{\{\{([\S\s]+?)\}\}\}/g,
|
||||
reIndirectValue = /\{\{([^\}]+)\}\}/g;
|
||||
reIndirectValue = /\{\{([^\}]+)\}\}/g,
|
||||
reSubstitutedValue = /(?:```([\s\S]*?)```|`([^`]|[\S\s]*?)`)/g;
|
||||
// Skip whitespace
|
||||
pos = $tw.utils.skipWhiteSpace(source,pos);
|
||||
// Get the attribute name
|
||||
@ -361,8 +362,15 @@ exports.parseAttribute = function(source,pos) {
|
||||
node.type = "macro";
|
||||
node.value = macroInvocation;
|
||||
} else {
|
||||
node.type = "string";
|
||||
node.value = "true";
|
||||
var substitutedValue = $tw.utils.parseTokenRegExp(source,pos,reSubstitutedValue);
|
||||
if(substitutedValue) {
|
||||
pos = substitutedValue.end;
|
||||
node.type = "substituted";
|
||||
node.rawValue = substitutedValue.match[1] || substitutedValue.match[2];
|
||||
} else {
|
||||
node.type = "string";
|
||||
node.value = "true";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/parsers/wikiparser/rules/dir.js
|
||||
type: application/javascript
|
||||
module-type: wikirule
|
||||
|
||||
Wiki pragma rule for specifying text direction
|
||||
|
||||
```
|
||||
\dir rtl
|
||||
\dir ltr
|
||||
\dir auto
|
||||
```
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.name = "dir";
|
||||
exports.types = {pragma: true};
|
||||
|
||||
/*
|
||||
Instantiate parse rule
|
||||
*/
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /^\\dir[^\S\n]*(\S+)\r?\n/mg;
|
||||
};
|
||||
|
||||
/*
|
||||
Parse the most recent match
|
||||
*/
|
||||
exports.parse = function() {
|
||||
var self = this;
|
||||
// Move past the pragma invocation
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
// Parse tree nodes to return
|
||||
return [{
|
||||
type: "element",
|
||||
tag: this.parser.parseAsInline ? "span" : "div",
|
||||
attributes: {
|
||||
dir: {type: "string", value: this.match[1]}
|
||||
},
|
||||
children: []
|
||||
}];
|
||||
};
|
||||
|
||||
})();
|
@ -35,7 +35,7 @@ Instantiate parse rule
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /^\\(function|procedure|widget)\s+([^(\s]+)\((\s*([^)]*))?\)(\s*\r?\n)?/mg;
|
||||
this.matchRegExp = /\\(function|procedure|widget)\s+([^(\s]+)\((\s*([^)]*))?\)(\s*\r?\n)?/mg;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -53,7 +53,7 @@ exports.parse = function() {
|
||||
var reEnd;
|
||||
if(this.match[5]) {
|
||||
// If so, the end of the body is marked with \end
|
||||
reEnd = new RegExp("(\\r?\\n\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
||||
reEnd = new RegExp("(\\r?\\n[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
||||
} else {
|
||||
// Otherwise, the end of the definition is marked by the end of the line
|
||||
reEnd = /($|\r?\n)/mg;
|
||||
|
@ -26,7 +26,7 @@ Instantiate parse rule
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /^\\parameters\s*\(([^)]*)\)(\s*\r?\n)?/mg;
|
||||
this.matchRegExp = /\\parameters\s*\(([^)]*)\)(\s*\r?\n)?/mg;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -36,7 +36,6 @@ options: see below:
|
||||
*/
|
||||
var WikiParser = function(type,text,options) {
|
||||
this.wiki = options.wiki;
|
||||
this.parseAsInline = options.parseAsInline;
|
||||
var self = this;
|
||||
// Check for an externally linked tiddler
|
||||
if($tw.browser && (text || "") === "" && options._canonical_uri) {
|
||||
|
@ -15,6 +15,7 @@ Startup logic concerned with managing plugins
|
||||
// Export name and synchronous status
|
||||
exports.name = "plugins";
|
||||
exports.after = ["load-modules"];
|
||||
exports.before = ["startup"];
|
||||
exports.synchronous = true;
|
||||
|
||||
var TITLE_REQUIRE_RELOAD_DUE_TO_PLUGIN_CHANGE = "$:/status/RequireReloadDueToPluginChange";
|
||||
|
@ -38,6 +38,7 @@ exports.startup = function() {
|
||||
url: params.url,
|
||||
method: params.method,
|
||||
body: params.body,
|
||||
binary: params.binary,
|
||||
oncompletion: params.oncompletion,
|
||||
onprogress: params.onprogress,
|
||||
bindStatus: params["bind-status"],
|
||||
|
@ -27,6 +27,11 @@ exports.startup = function() {
|
||||
if($tw.browser) {
|
||||
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
|
||||
$tw.browser.isFirefox = !!document.mozFullScreenEnabled;
|
||||
// 2023-07-21 Edge returns UA below. So we use "isChromeLike"
|
||||
//'mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/114.0.0.0 safari/537.36 edg/114.0.1823.82'
|
||||
$tw.browser.isChromeLike = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
|
||||
$tw.browser.hasTouch = !!window.matchMedia && window.matchMedia("(pointer: coarse)").matches;
|
||||
$tw.browser.isMobileChrome = $tw.browser.isChromeLike && $tw.browser.hasTouch;
|
||||
}
|
||||
// Platform detection
|
||||
$tw.platform = {};
|
||||
|
@ -80,7 +80,7 @@ exports.makeDraggable = function(options) {
|
||||
if(dataTransfer.setDragImage) {
|
||||
if(dragImageType === "pill") {
|
||||
dataTransfer.setDragImage(dragImage.firstChild,-16,-16);
|
||||
} else if (dragImageType === "blank") {
|
||||
} else if(dragImageType === "blank") {
|
||||
dragImage.removeChild(dragImage.firstChild);
|
||||
dataTransfer.setDragImage(dragImage,0,0);
|
||||
} else {
|
||||
@ -106,7 +106,9 @@ exports.makeDraggable = function(options) {
|
||||
dataTransfer.setData("text/vnd.tiddler",jsonData);
|
||||
dataTransfer.setData("text/plain",titleString);
|
||||
dataTransfer.setData("text/x-moz-url","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
||||
} else {
|
||||
}
|
||||
// If browser is Chrome-like and has a touch-input device do NOT .setData
|
||||
if(!($tw.browser.isMobileChrome)) {
|
||||
dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
||||
}
|
||||
dataTransfer.setData("Text",titleString);
|
||||
|
@ -90,6 +90,7 @@ wiki: wiki to be used for executing action strings
|
||||
url: URL for request
|
||||
method: method eg GET, POST
|
||||
body: text of request body
|
||||
binary: set to "yes" to force binary processing of response payload
|
||||
oncompletion: action string to be invoked on completion
|
||||
onprogress: action string to be invoked on progress updates
|
||||
bindStatus: optional title of tiddler to which status ("pending", "complete", "error") should be written
|
||||
@ -106,10 +107,11 @@ function HttpClientRequest(options) {
|
||||
this.wiki = options.wiki;
|
||||
this.completionActions = options.oncompletion;
|
||||
this.progressActions = options.onprogress;
|
||||
this.bindStatus = options["bind-status"];
|
||||
this.bindProgress = options["bind-progress"];
|
||||
this.bindStatus = options["bindStatus"];
|
||||
this.bindProgress = options["bindProgress"];
|
||||
this.method = options.method || "GET";
|
||||
this.body = options.body || "";
|
||||
this.binary = options.binary || "";
|
||||
this.variables = options.variables;
|
||||
var url = options.url;
|
||||
$tw.utils.each(options.queryStrings,function(value,name) {
|
||||
@ -132,7 +134,7 @@ HttpClientRequest.prototype.send = function(callback) {
|
||||
var self = this,
|
||||
setBinding = function(title,text) {
|
||||
if(title) {
|
||||
this.wiki.addTiddler(new $tw.Tiddler({title: title, text: text}));
|
||||
self.wiki.addTiddler(new $tw.Tiddler({title: title, text: text}));
|
||||
}
|
||||
};
|
||||
if(this.url) {
|
||||
@ -156,6 +158,8 @@ HttpClientRequest.prototype.send = function(callback) {
|
||||
type: this.method,
|
||||
headers: this.requestHeaders,
|
||||
data: this.body,
|
||||
returnProp: this.binary === "" ? "responseText" : "response",
|
||||
responseType: this.binary === "" ? "text" : "arraybuffer",
|
||||
callback: function(err,data,xhr) {
|
||||
var hasSucceeded = xhr.status >= 200 && xhr.status < 300,
|
||||
completionCode = hasSucceeded ? "complete" : "error",
|
||||
@ -175,6 +179,16 @@ HttpClientRequest.prototype.send = function(callback) {
|
||||
data: (data || "").toString(),
|
||||
headers: JSON.stringify(headers)
|
||||
};
|
||||
/* Convert data from binary to base64 */
|
||||
if (xhr.responseType === "arraybuffer") {
|
||||
var binary = "",
|
||||
bytes = new Uint8Array(data),
|
||||
len = bytes.byteLength;
|
||||
for (var i=0; i<len; i++) {
|
||||
binary += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
resultVariables.data = window.btoa(binary);
|
||||
}
|
||||
self.wiki.addTiddler(new $tw.Tiddler(self.wiki.getTiddler(requestTrackerTitle),{
|
||||
status: completionCode,
|
||||
}));
|
||||
@ -212,6 +226,7 @@ Make an HTTP request. Options are:
|
||||
callback: function invoked with (err,data,xhr)
|
||||
progress: optional function invoked with (lengthComputable,loaded,total)
|
||||
returnProp: string name of the property to return as first argument of callback
|
||||
responseType: "text" or "arraybuffer"
|
||||
*/
|
||||
exports.httpRequest = function(options) {
|
||||
var type = options.type || "GET",
|
||||
@ -264,6 +279,7 @@ exports.httpRequest = function(options) {
|
||||
}
|
||||
}
|
||||
}
|
||||
request.responseType = options.responseType || "text";
|
||||
// Set up the state change handler
|
||||
request.onreadystatechange = function() {
|
||||
if(this.readyState === 4) {
|
||||
|
@ -116,7 +116,7 @@ CheckboxWidget.prototype.getValue = function() {
|
||||
} else {
|
||||
list = $tw.utils.parseStringArray(this.checkboxDefault || "") || [];
|
||||
}
|
||||
} else if (this.checkboxListIndex) {
|
||||
} else if(this.checkboxListIndex) {
|
||||
list = $tw.utils.parseStringArray(this.wiki.extractTiddlerDataItem(tiddler,this.checkboxListIndex,this.checkboxDefault || "")) || [];
|
||||
} else {
|
||||
list = this.wiki.filterTiddlers(this.checkboxFilter,this) || [];
|
||||
@ -215,6 +215,8 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
|
||||
if($tw.utils.isArray(fieldContents)) {
|
||||
// Make a copy so we can modify it without changing original that's refrenced elsewhere
|
||||
listContents = fieldContents.slice(0);
|
||||
} else if(fieldContents === undefined) {
|
||||
listContents = [];
|
||||
} else if(typeof fieldContents === "string") {
|
||||
listContents = $tw.utils.parseStringArray(fieldContents);
|
||||
// No need to copy since parseStringArray returns a fresh array, not refrenced elsewhere
|
||||
|
@ -48,7 +48,6 @@ EditWidget.prototype.execute = function() {
|
||||
this.editPlaceholder = this.getAttribute("placeholder");
|
||||
this.editTabIndex = this.getAttribute("tabindex");
|
||||
this.editFocus = this.getAttribute("focus","");
|
||||
this.editDir = this.getAttribute("dir");
|
||||
this.editCancelPopups = this.getAttribute("cancelPopups","");
|
||||
this.editInputActions = this.getAttribute("inputActions");
|
||||
this.editRefreshTitle = this.getAttribute("refreshTitle");
|
||||
@ -91,7 +90,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
EditWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// Refresh if an attribute has changed, or the type associated with the target tiddler has changed
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.dir || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) {
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
|
@ -49,7 +49,7 @@ ImportVariablesWidget.prototype.execute = function(tiddlerList) {
|
||||
this.tiddlerList = tiddlerList || this.wiki.filterTiddlers(this.filter,this);
|
||||
// Accumulate the <$set> widgets from each tiddler
|
||||
$tw.utils.each(this.tiddlerList,function(title) {
|
||||
var parser = widgetPointer.wiki.parseTiddler(title,{parseAsInline:true});
|
||||
var parser = widgetPointer.wiki.parseTiddler(title,{parseAsInline:true, configTrimWhiteSpace:true});
|
||||
if(parser) {
|
||||
var parseTreeNode = parser.tree[0];
|
||||
while(parseTreeNode && ["setvariable","set","parameters"].indexOf(parseTreeNode.type) !== -1) {
|
||||
|
@ -42,9 +42,6 @@ RevealWidget.prototype.render = function(parent,nextSibling) {
|
||||
if(this.style) {
|
||||
domNode.setAttribute("style",this.style);
|
||||
}
|
||||
if(this.direction) {
|
||||
domNode.setAttribute("dir",this.direction);
|
||||
}
|
||||
parent.insertBefore(domNode,nextSibling);
|
||||
this.renderChildren(domNode,null);
|
||||
if(!domNode.isTiddlyWikiFakeDom && this.type === "popup" && this.isOpen) {
|
||||
@ -126,7 +123,6 @@ RevealWidget.prototype.execute = function() {
|
||||
this["default"] = this.getAttribute("default","");
|
||||
this.animate = this.getAttribute("animate","no");
|
||||
this.retain = this.getAttribute("retain","no");
|
||||
this.direction = this.getAttribute("dir");
|
||||
this.openAnimation = this.animate === "no" ? undefined : "open";
|
||||
this.closeAnimation = this.animate === "no" ? undefined : "close";
|
||||
this.updatePopupPosition = this.getAttribute("updatePopupPosition","no") === "yes";
|
||||
@ -218,7 +214,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
*/
|
||||
RevealWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.state || changedAttributes.type || changedAttributes.text || changedAttributes.position || changedAttributes.positionAllowNegative || changedAttributes["default"] || changedAttributes.animate || changedAttributes.stateTitle || changedAttributes.stateField || changedAttributes.stateIndex || changedAttributes.dir) {
|
||||
if(changedAttributes.state || changedAttributes.type || changedAttributes.text || changedAttributes.position || changedAttributes.positionAllowNegative || changedAttributes["default"] || changedAttributes.animate || changedAttributes.stateTitle || changedAttributes.stateField || changedAttributes.stateIndex) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
|
@ -145,6 +145,7 @@ SelectWidget.prototype.execute = function() {
|
||||
this.selectDefault = this.getAttribute("default");
|
||||
this.selectMultiple = this.getAttribute("multiple", false);
|
||||
this.selectSize = this.getAttribute("size");
|
||||
this.selectTabindex = this.getAttribute("tabindex");
|
||||
this.selectTooltip = this.getAttribute("tooltip");
|
||||
this.selectFocus = this.getAttribute("focus");
|
||||
// Make the child widgets
|
||||
@ -162,6 +163,9 @@ SelectWidget.prototype.execute = function() {
|
||||
if(this.selectSize) {
|
||||
$tw.utils.addAttributeToParseTreeNode(selectNode,"size",this.selectSize);
|
||||
}
|
||||
if(this.selectTabindex) {
|
||||
$tw.utils.addAttributeToParseTreeNode(selectNode,"tabindex",this.selectTabindex);
|
||||
}
|
||||
if(this.selectTooltip) {
|
||||
$tw.utils.addAttributeToParseTreeNode(selectNode,"title",this.selectTooltip);
|
||||
}
|
||||
|
@ -41,27 +41,43 @@ TranscludeWidget.prototype.execute = function() {
|
||||
this.collectAttributes();
|
||||
this.collectStringParameters();
|
||||
this.collectSlotFillParameters();
|
||||
// Get the parse tree nodes that we are transcluding
|
||||
var target = this.getTransclusionTarget(),
|
||||
parseTreeNodes = target.parseTreeNodes;
|
||||
this.sourceText = target.text;
|
||||
this.parserType = target.type;
|
||||
this.parseAsInline = target.parseAsInline;
|
||||
// Determine whether we're being used in inline or block mode
|
||||
var parseAsInline = !this.parseTreeNode.isBlock;
|
||||
if(this.transcludeMode === "inline") {
|
||||
parseAsInline = true;
|
||||
} else if(this.transcludeMode === "block") {
|
||||
parseAsInline = false;
|
||||
}
|
||||
// Set 'thisTiddler'
|
||||
this.setVariable("thisTiddler",this.transcludeTitle);
|
||||
var parseTreeNodes, target;
|
||||
// Process the transclusion according to the output type
|
||||
switch(this.transcludeOutput || "text/html") {
|
||||
case "text/html":
|
||||
// No further processing required
|
||||
// Return the parse tree nodes of the target
|
||||
target = this.parseTransclusionTarget(parseAsInline);
|
||||
this.parseAsInline = target.parseAsInline;
|
||||
parseTreeNodes = target.parseTreeNodes;
|
||||
break;
|
||||
case "text/raw":
|
||||
// Just return the raw text
|
||||
parseTreeNodes = [{type: "text", text: this.sourceText}];
|
||||
target = this.getTransclusionTarget();
|
||||
parseTreeNodes = [{type: "text", text: target.text}];
|
||||
break;
|
||||
default:
|
||||
// text/plain
|
||||
var plainText = this.wiki.renderText("text/plain",this.parserType,this.sourceText,{parentWidget: this});
|
||||
parseTreeNodes = [{type: "text", text: plainText}];
|
||||
// "text/plain" is the plain text result of wikifying the text
|
||||
target = this.parseTransclusionTarget(parseAsInline);
|
||||
var widgetNode = this.wiki.makeWidget(target.parser,{
|
||||
parentWidget: this,
|
||||
document: $tw.fakeDocument
|
||||
});
|
||||
var container = $tw.fakeDocument.createElement("div");
|
||||
widgetNode.render(container,null);
|
||||
parseTreeNodes = [{type: "text", text: container.textContent}];
|
||||
break;
|
||||
}
|
||||
this.sourceText = target.text;
|
||||
this.parserType = target.type;
|
||||
// Set the legacy transclusion context variables only if we're not transcluding a variable
|
||||
if(!this.transcludeVariable) {
|
||||
var recursionMarker = this.makeRecursionMarker();
|
||||
@ -158,17 +174,44 @@ TranscludeWidget.prototype.collectSlotFillParameters = function() {
|
||||
};
|
||||
|
||||
/*
|
||||
Get transcluded parse tree nodes as an object {parser:,text:,type:}
|
||||
Get transcluded details as an object {text:,type:}
|
||||
*/
|
||||
TranscludeWidget.prototype.getTransclusionTarget = function() {
|
||||
var self = this;
|
||||
// Determine whether we're being used in inline or block mode
|
||||
var parseAsInline = !this.parseTreeNode.isBlock;
|
||||
if(this.transcludeMode === "inline") {
|
||||
parseAsInline = true;
|
||||
} else if(this.transcludeMode === "block") {
|
||||
parseAsInline = false;
|
||||
var text;
|
||||
// Return the text and type of the target
|
||||
if(this.hasAttribute("$variable")) {
|
||||
if(this.transcludeVariable) {
|
||||
// Transcluding a variable
|
||||
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()});
|
||||
text = variableInfo.text;
|
||||
return {
|
||||
text: variableInfo.text,
|
||||
type: this.transcludeType
|
||||
};
|
||||
}
|
||||
} else {
|
||||
// Transcluding a text reference
|
||||
var parserInfo = this.wiki.getTextReferenceParserInfo(
|
||||
this.transcludeTitle,
|
||||
this.transcludeField,
|
||||
this.transcludeIndex,
|
||||
{
|
||||
subTiddler: this.transcludeSubTiddler,
|
||||
defaultType: this.transcludeType
|
||||
});
|
||||
return {
|
||||
text: parserInfo.text,
|
||||
type: parserInfo.type
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Get transcluded parse tree nodes as an object {text:,type:,parseTreeNodes:,parseAsInline:}
|
||||
*/
|
||||
TranscludeWidget.prototype.parseTransclusionTarget = function(parseAsInline) {
|
||||
var self = this;
|
||||
var parser;
|
||||
// Get the parse tree
|
||||
if(this.hasAttribute("$variable")) {
|
||||
@ -177,7 +220,7 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
||||
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()}),
|
||||
srcVariable = variableInfo && variableInfo.srcVariable;
|
||||
if(variableInfo.text) {
|
||||
if(srcVariable.isFunctionDefinition) {
|
||||
if(srcVariable && srcVariable.isFunctionDefinition) {
|
||||
var result = (variableInfo.resultList ? variableInfo.resultList[0] : variableInfo.text) || "";
|
||||
parser = {
|
||||
tree: [{
|
||||
@ -207,7 +250,7 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
||||
if(variableInfo.isCacheable && srcVariable[cacheKey]) {
|
||||
parser = srcVariable[cacheKey];
|
||||
} else {
|
||||
parser = this.wiki.parseText(this.transcludeType,variableInfo.text || "",{parseAsInline: parseAsInline, configTrimWhiteSpace: srcVariable.configTrimWhiteSpace});
|
||||
parser = this.wiki.parseText(this.transcludeType,variableInfo.text || "",{parseAsInline: parseAsInline, configTrimWhiteSpace: srcVariable && srcVariable.configTrimWhiteSpace});
|
||||
if(variableInfo.isCacheable) {
|
||||
srcVariable[cacheKey] = parser;
|
||||
}
|
||||
@ -215,7 +258,7 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
||||
}
|
||||
if(parser) {
|
||||
// Add parameters widget for procedures and custom widgets
|
||||
if(srcVariable.isProcedureDefinition || srcVariable.isWidgetDefinition) {
|
||||
if(srcVariable && (srcVariable.isProcedureDefinition || srcVariable.isWidgetDefinition)) {
|
||||
parser = {
|
||||
tree: [
|
||||
{
|
||||
@ -234,7 +277,7 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
||||
}
|
||||
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],name,param["default"])
|
||||
});
|
||||
} else if(srcVariable.isMacroDefinition || !srcVariable.isFunctionDefinition) {
|
||||
} else if(srcVariable && !srcVariable.isFunctionDefinition) {
|
||||
// For macros and ordinary variables, wrap the parse tree in a vars widget assigning the parameters to variables named "__paramname__"
|
||||
parser = {
|
||||
tree: [
|
||||
@ -265,27 +308,14 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
||||
defaultType: this.transcludeType
|
||||
});
|
||||
}
|
||||
// Set 'thisTiddler'
|
||||
this.setVariable("thisTiddler",this.transcludeTitle);
|
||||
// Return the parse tree
|
||||
if(parser) {
|
||||
return {
|
||||
parser: parser,
|
||||
parseTreeNodes: parser.tree,
|
||||
parseAsInline: parseAsInline,
|
||||
text: parser.source,
|
||||
type: parser.type
|
||||
};
|
||||
} else {
|
||||
// If there's no parse tree then return the missing slot value
|
||||
return {
|
||||
parser: null,
|
||||
parseTreeNodes: (this.slotFillParseTrees["ts-missing"] || []),
|
||||
parseAsInline: parseAsInline,
|
||||
text: null,
|
||||
type: null
|
||||
};
|
||||
}
|
||||
return {
|
||||
parser: parser,
|
||||
parseTreeNodes: parser ? parser.tree : (this.slotFillParseTrees["ts-missing"] || []),
|
||||
parseAsInline: parseAsInline,
|
||||
text: parser && parser.source,
|
||||
type: parser && parser.type
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -182,8 +182,7 @@ Widget.prototype.getVariableInfo = function(name,options) {
|
||||
}
|
||||
return {
|
||||
text: text,
|
||||
resultList: [text],
|
||||
srcVariable: {}
|
||||
resultList: [text]
|
||||
};
|
||||
};
|
||||
|
||||
@ -380,6 +379,8 @@ Widget.prototype.computeAttribute = function(attribute) {
|
||||
} else if(attribute.type === "macro") {
|
||||
var variableInfo = this.getVariableInfo(attribute.value.name,{params: attribute.value.params});
|
||||
value = variableInfo.text;
|
||||
} else if(attribute.type === "substituted") {
|
||||
value = this.wiki.getSubstitutedText(attribute.rawValue,this) || "";
|
||||
} else { // String attribute
|
||||
value = attribute.value;
|
||||
}
|
||||
@ -718,44 +719,23 @@ Widget.prototype.findFirstDomNode = function() {
|
||||
};
|
||||
|
||||
/*
|
||||
Entry into destroy procedure
|
||||
*/
|
||||
Widget.prototype.destroyChildren = function() {
|
||||
$tw.utils.each(this.children,function(childWidget) {
|
||||
childWidget.destroy();
|
||||
});
|
||||
};
|
||||
/*
|
||||
Legacy entry into destroy procedure
|
||||
Remove any DOM nodes created by this widget or its children
|
||||
*/
|
||||
Widget.prototype.removeChildDomNodes = function() {
|
||||
this.destroy();
|
||||
};
|
||||
/*
|
||||
Default destroy
|
||||
*/
|
||||
Widget.prototype.destroy = function() {
|
||||
// call children to remove their resources
|
||||
this.destroyChildren();
|
||||
// remove our resources
|
||||
this.children = [];
|
||||
this.removeLocalDomNodes();
|
||||
};
|
||||
|
||||
/*
|
||||
Remove any DOM nodes created by this widget
|
||||
*/
|
||||
Widget.prototype.removeLocalDomNodes = function() {
|
||||
// If this widget has directly created DOM nodes, delete them and exit.
|
||||
// If this widget has directly created DOM nodes, delete them and exit. This assumes that any child widgets are contained within the created DOM nodes, which would normally be the case
|
||||
if(this.domNodes.length > 0) {
|
||||
$tw.utils.each(this.domNodes,function(domNode) {
|
||||
domNode.parentNode.removeChild(domNode);
|
||||
});
|
||||
this.domNodes = [];
|
||||
} else {
|
||||
// Otherwise, ask the child widgets to delete their DOM nodes
|
||||
$tw.utils.each(this.children,function(childWidget) {
|
||||
childWidget.removeChildDomNodes();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Invoke the action widgets that are descendents of the current widget.
|
||||
*/
|
||||
|
@ -1063,6 +1063,34 @@ exports.getTextReferenceParserInfo = function(title,field,index,options) {
|
||||
return parserInfo;
|
||||
}
|
||||
|
||||
/*
|
||||
Parse a block of text of a specified MIME type
|
||||
text: text on which to perform substitutions
|
||||
widget
|
||||
options: see below
|
||||
Options include:
|
||||
substitutions: an optional array of substitutions
|
||||
*/
|
||||
exports.getSubstitutedText = function(text,widget,options) {
|
||||
options = options || {};
|
||||
text = text || "";
|
||||
var self = this,
|
||||
substitutions = options.substitutions || [],
|
||||
output;
|
||||
// Evaluate embedded filters and substitute with first result
|
||||
output = text.replace(/\$\{([\S\s]+?)\}\$/g, function(match,filter) {
|
||||
return self.filterTiddlers(filter,widget)[0] || "";
|
||||
});
|
||||
// Process any substitutions provided in options
|
||||
$tw.utils.each(substitutions,function(substitute) {
|
||||
output = $tw.utils.replaceString(output,new RegExp("\\$" + $tw.utils.escapeRegExp(substitute.name) + "\\$","mg"),substitute.value);
|
||||
});
|
||||
// Substitute any variable references with their values
|
||||
return output.replace(/\$\(([^\)\$]+)\)\$/g, function(match,varname) {
|
||||
return widget.getVariable(varname,{defaultValue: ""})
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
Make a widget tree for a parse tree
|
||||
parser: parser object
|
||||
|
@ -12,8 +12,7 @@ tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$
|
||||
tv-config-toolbar-class={{$:/config/Toolbar/ButtonClass}}
|
||||
tv-show-missing-links={{$:/config/MissingLinks}}
|
||||
storyviewTitle={{$:/view}}
|
||||
languageTitle={{{ [{$:/language}get[name]] }}}
|
||||
tv-text-direction={{$:/config/DefaultTextDirection}}>
|
||||
languageTitle={{{ [{$:/language}get[name]] }}}>
|
||||
|
||||
<div class=<<containerClasses>>>
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
code-body: yes
|
||||
title: $:/core/ui/AlertTemplate
|
||||
|
||||
\whitespace trim
|
||||
|
@ -1,3 +1,4 @@
|
||||
code-body: yes
|
||||
title: $:/core/ui/EditTemplate
|
||||
|
||||
\define delete-edittemplate-state-tiddlers()
|
||||
@ -29,7 +30,6 @@ title: $:/core/ui/EditTemplate
|
||||
data-tiddler-title=<<currentTiddler>>
|
||||
data-tags={{!!tags}}
|
||||
class={{{ [all[shadows+tiddlers]tag[$:/tags/ClassFilters/TiddlerTemplate]!is[draft]] :map:flat[subfilter{!!text}] tc-tiddler-frame tc-tiddler-edit-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}}
|
||||
dir=<<tv-text-direction>>
|
||||
role="region"
|
||||
aria-label={{$:/language/EditTemplate/Caption}}>
|
||||
<$fieldmangler>
|
||||
|
@ -9,7 +9,6 @@ title: $:/core/ui/EditTemplate/body/editor
|
||||
placeholder={{$:/language/EditTemplate/Body/Placeholder}}
|
||||
tabindex={{$:/config/EditTabIndex}}
|
||||
focus={{{ [{$:/config/AutoFocus}match[text]then[true]] ~[[false]] }}}
|
||||
dir=<<tv-text-direction>>
|
||||
cancelPopups="yes"
|
||||
fileDrop={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}}
|
||||
|
||||
|
@ -15,7 +15,7 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
||||
importState=<<qualify $:/state/ImportImage>> >
|
||||
<$dropzone importTitle=<<importTitle>> autoOpenOnImport="no" contentTypesFilter={{$:/config/Editor/ImportContentTypesFilter}} class="tc-dropzone-editor" enable={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}} filesOnly="yes" actions=<<importFileActions>> >
|
||||
<$reveal stateTitle=<<edit-preview-state>> type="match" text="yes" tag="div">
|
||||
<div class="tc-tiddler-preview" dir=<<tv-text-direction>>>
|
||||
<div class="tc-tiddler-preview">
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||
|
||||
@ -32,7 +32,7 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
||||
</div>
|
||||
</$reveal>
|
||||
|
||||
<$reveal stateTitle=<<edit-preview-state>> type="nomatch" text="yes" tag="div" dir=<<tv-text-direction>>>
|
||||
<$reveal stateTitle=<<edit-preview-state>> type="nomatch" text="yes" tag="div">
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||
|
||||
|
@ -5,7 +5,7 @@ tags: $:/tags/EditTemplate
|
||||
$:/config/EditToolbarButtons/Visibility/$(listItem)$
|
||||
\end
|
||||
\whitespace trim
|
||||
<div class="tc-tiddler-title tc-tiddler-edit-title" dir=<<tv-text-direction>>>
|
||||
<div class="tc-tiddler-title tc-tiddler-edit-title">
|
||||
<$view field="title"/>
|
||||
<span class="tc-tiddler-controls tc-titlebar"><$list filter="[all[shadows+tiddlers]tag[$:/tags/EditToolbar]!has[draft.of]]" variable="listItem"><$let tv-config-toolbar-class={{{ [enlist<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]] +[join[ ]]}}}><$reveal type="nomatch" state=<<config-title>> text="hide"><$transclude tiddler=<<listItem>>/></$reveal></$let></$list></span>
|
||||
<div style="clear: both;"></div>
|
||||
|
@ -74,7 +74,7 @@ $value={{{ [subfilter<get-field-value-tiddler-filter>get[text]] }}}/>
|
||||
\whitespace trim
|
||||
|
||||
<$set name="newFieldValueTiddlerPrefix" value=<<newFieldValueTiddlerPrefix>> emptyValue=<<qualify "$:/temp/NewFieldValue">> >
|
||||
<div class="tc-edit-fields" dir=<<tv-text-direction>>>
|
||||
<div class="tc-edit-fields">
|
||||
<table class={{{ [all[current]fields[]] :filter[lookup[$:/config/EditTemplateFields/Visibility/]!match[hide]] +[count[]!match[0]] +[then[tc-edit-fields]] ~[[tc-edit-fields tc-edit-fields-small]] }}}>
|
||||
<tbody>
|
||||
<$list filter="[all[current]fields[]] +[sort[title]]" variable="currentField" storyview="pop">
|
||||
@ -101,7 +101,7 @@ $value={{{ [subfilter<get-field-value-tiddler-filter>get[text]] }}}/>
|
||||
</div>
|
||||
|
||||
<$fieldmangler>
|
||||
<div class="tc-edit-field-add" dir=<<tv-text-direction>>>
|
||||
<div class="tc-edit-field-add">
|
||||
<em class="tc-edit tc-small-gap-right">
|
||||
<<lingo Fields/Add/Prompt>>
|
||||
</em>
|
||||
|
@ -14,7 +14,7 @@ tags: $:/tags/EditTemplate
|
||||
<$list filter="[all[current]shadowsource[]]" variable="pluginTitle">
|
||||
|
||||
<$set name="pluginLink" value=<<pluginLinkBody>>>
|
||||
<div class="tc-message-box" dir=<<tv-text-direction>>>
|
||||
<div class="tc-message-box">
|
||||
|
||||
<<lingo Warning>>
|
||||
|
||||
@ -29,7 +29,7 @@ tags: $:/tags/EditTemplate
|
||||
<$list filter="[all[current]shadowsource[]]" variable="pluginTitle">
|
||||
|
||||
<$set name="pluginLink" value=<<pluginLinkBody>>>
|
||||
<div class="tc-message-box" dir=<<tv-text-direction>>>
|
||||
<div class="tc-message-box">
|
||||
|
||||
<<lingo OverriddenWarning>>
|
||||
|
||||
|
@ -27,7 +27,7 @@ color:$(foregroundColor)$;
|
||||
|
||||
\define edit-tags-template(tagField:"tags")
|
||||
\whitespace trim
|
||||
<div class="tc-edit-tags" dir=<<tv-text-direction>>>
|
||||
<div class="tc-edit-tags">
|
||||
<$list filter="[list[!!$tagField$]sort[title]]" storyview="pop">
|
||||
<$macrocall $name="tag-body" colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}} palette={{$:/palette}} icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}} tagField=<<__tagField__>>/>
|
||||
</$list>
|
||||
|
@ -2,13 +2,13 @@ title: $:/core/ui/EditTemplate/title
|
||||
tags: $:/tags/EditTemplate
|
||||
|
||||
\whitespace trim
|
||||
<$edit-text field="draft.title" class="tc-titlebar tc-edit-texteditor" focus={{{ [{$:/config/AutoFocus}match[title]then[true]] ~[[false]] }}} tabindex={{$:/config/EditTabIndex}} cancelPopups="yes" dir=<<tv-text-direction>>/>
|
||||
<$edit-text field="draft.title" class="tc-titlebar tc-edit-texteditor" focus={{{ [{$:/config/AutoFocus}match[title]then[true]] ~[[false]] }}} tabindex={{$:/config/EditTabIndex}} cancelPopups="yes"/>
|
||||
|
||||
<$vars pattern="""[\|\[\]{}]""" bad-chars="""`| [ ] { }`""">
|
||||
|
||||
<$list filter="[all[current]regexp:draft.title<pattern>]" variable="listItem">
|
||||
|
||||
<div class="tc-message-box" dir=<<tv-text-direction>>>
|
||||
<div class="tc-message-box">
|
||||
|
||||
{{$:/core/images/warning}} {{$:/language/EditTemplate/Title/BadCharacterWarning}}
|
||||
|
||||
@ -18,7 +18,7 @@ tags: $:/tags/EditTemplate
|
||||
|
||||
</$vars>
|
||||
|
||||
<$reveal state="!!draft.title" type="nomatch" text={{!!draft.of}} tag="div" dir=<<tv-text-direction>>>
|
||||
<$reveal state="!!draft.title" type="nomatch" text={{!!draft.of}} tag="div">
|
||||
|
||||
<$list filter="[{!!draft.title}!is[missing]]" variable="listItem">
|
||||
|
||||
|
@ -9,7 +9,7 @@ first-search-filter: [all[shadows+tiddlers]prefix[$:/language/Docs/Types/]sort[d
|
||||
<div class="tc-edit-type-selector-wrapper">
|
||||
<em class="tc-edit tc-small-gap-right"><<lingo Type/Prompt>></em>
|
||||
<div class="tc-type-selector-dropdown-wrapper">
|
||||
<div class="tc-type-selector" dir=<<tv-text-direction>>}><$fieldmangler>
|
||||
<div class="tc-type-selector"><$fieldmangler>
|
||||
<$macrocall $name="keyboard-driven-input" tiddler=<<currentTiddler>> storeTitle=<<typeInputTiddler>> refreshTitle=<<refreshTitle>> selectionStateTitle=<<typeSelectionTiddler>> field="type" tag="input" default="" placeholder={{$:/language/EditTemplate/Type/Placeholder}} focusPopup=<<qualify "$:/state/popup/type-dropdown">> class="tc-edit-typeeditor tc-edit-texteditor tc-popup-handle" tabindex={{$:/config/EditTabIndex}} focus={{{ [{$:/config/AutoFocus}match[type]then[true]] ~[[false]] }}} cancelPopups="yes" configTiddlerFilter="[[$:/core/ui/EditTemplate/type]]" inputCancelActions=<<input-cancel-actions>>/><$button popup=<<qualify "$:/state/popup/type-dropdown">> class="tc-btn-invisible tc-btn-dropdown tc-small-gap" tooltip={{$:/language/EditTemplate/Type/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Type/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button><$button message="tm-remove-field" param="type" class="tc-btn-invisible tc-btn-icon" tooltip={{$:/language/EditTemplate/Type/Delete/Hint}} aria-label={{$:/language/EditTemplate/Type/Delete/Caption}}>{{$:/core/images/delete-button}}<$action-deletetiddler $filter="[<storeTitle>] [<refreshTitle>] [<selectionStateTitle>]"/></$button>
|
||||
</$fieldmangler></div>
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
title: $:/core/ui/ImportPreviews/Text
|
||||
tags: $:/tags/ImportPreview
|
||||
caption: {{$:/language/Import/Listing/Preview/Text}}
|
||||
code-body: yes
|
||||
|
||||
<$transclude tiddler=<<currentTiddler>> subtiddler=<<payloadTiddler>> mode="block"/>
|
||||
|
@ -3,15 +3,14 @@ tags: $:/tags/MoreSideBar
|
||||
caption: {{$:/language/SideBar/Tags/Caption}}
|
||||
|
||||
\whitespace trim
|
||||
|
||||
<$let tv-config-toolbar-icons="yes" tv-config-toolbar-text="yes" tv-config-toolbar-class="">
|
||||
<div class="tc-tiny-v-gap-bottom">
|
||||
{{$:/core/ui/Buttons/tag-manager}}
|
||||
{{$:/core/ui/Buttons/tag-manager}}
|
||||
</div>
|
||||
</$let>
|
||||
<$list filter={{$:/core/Filters/AllTags!!filter}}>
|
||||
<div class="tc-tiny-v-gap-bottom">
|
||||
<$transclude tiddler="$:/core/ui/TagTemplate"/>
|
||||
<$transclude tiddler="$:/core/ui/TagTemplate"/>
|
||||
</div>
|
||||
</$list>
|
||||
<hr class="tc-untagged-separator">
|
||||
|
@ -1,4 +1,5 @@
|
||||
title: $:/core/ui/PageStylesheet
|
||||
code-body: yes
|
||||
|
||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
||||
\whitespace trim
|
||||
|
@ -2,6 +2,7 @@ title: $:/core/ui/PageTemplate
|
||||
name: {{$:/language/PageTemplate/Name}}
|
||||
description: {{$:/language/PageTemplate/Description}}
|
||||
icon: $:/core/images/layout-button
|
||||
code-body: yes
|
||||
|
||||
\whitespace trim
|
||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
||||
@ -13,8 +14,7 @@ icon: $:/core/images/layout-button
|
||||
tv-enable-drag-and-drop={{$:/config/DragAndDrop/Enable}}
|
||||
tv-show-missing-links={{$:/config/MissingLinks}}
|
||||
storyviewTitle={{$:/view}}
|
||||
languageTitle={{{ [{$:/language}get[name]] }}}
|
||||
tv-text-direction={{$:/config/DefaultTextDirection}}>
|
||||
languageTitle={{{ [{$:/language}get[name]] }}}>
|
||||
|
||||
<div class={{{ [all[shadows+tiddlers]tag[$:/tags/ClassFilters/PageTemplate]!is[draft]] :map:flat[subfilter{!!text}] tc-page-container [[tc-page-view-]addsuffix<storyviewTitle>] [[tc-language-]addsuffix<languageTitle>] :and[unique[]join[ ]] }}} >
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
title: $:/core/ui/RootTemplate
|
||||
code-body: yes
|
||||
|
||||
<$transclude tiddler={{{ [{$:/layout}has[text]] ~[[$:/core/ui/PageTemplate]] }}} mode="inline"/>
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
title: $:/core/ui/StoryTiddlerTemplate
|
||||
code-body: yes
|
||||
|
||||
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/StoryTiddlerTemplateFilter]!is[draft]get[text]] :and[has[title]else[$:/core/ui/ViewTemplate]] }}} />
|
||||
|
@ -2,22 +2,29 @@ title: $:/core/ui/TagPickerTagTemplate
|
||||
|
||||
\whitespace trim
|
||||
<$button class=<<button-classes>> tag="a" tooltip={{$:/language/EditTemplate/Tags/Add/Button/Hint}}>
|
||||
<$list filter="[<saveTiddler>minlength[1]]">
|
||||
<$action-listops $tiddler=<<saveTiddler>> $field=<<tagField>> $subfilter="[<tag>]"/>
|
||||
</$list>
|
||||
<$set name="currentTiddlerCSSEscaped" value={{{ [<saveTiddler>escapecss[]] }}}>
|
||||
<$action-sendmessage $message="tm-focus-selector" $param=<<get-tagpicker-focus-selector>> preventScroll="true"/>
|
||||
</$set>
|
||||
<<delete-tag-state-tiddlers>>
|
||||
<$list filter="[<refreshTitle>minlength[1]]">
|
||||
<$action-setfield $tiddler=<<refreshTitle>> text="yes"/>
|
||||
</$list>
|
||||
<<actions>>
|
||||
<$set name="backgroundColor" value={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}>
|
||||
<$wikify name="foregroundColor" text="""<$macrocall $name="contrastcolour" target=<<backgroundColor>> fallbackTarget=<<fallbackTarget>> colourA=<<colourA>> colourB=<<colourB>>/>""">
|
||||
<span class="tc-tag-label tc-btn-invisible" style=<<tag-pill-styles>> data-tag-title=<<currentTiddler>> >
|
||||
{{||$:/core/ui/TiddlerIcon}}<$view field="title" format="text"/>
|
||||
</span>
|
||||
</$wikify>
|
||||
</$set>
|
||||
<$list filter="[<saveTiddler>minlength[1]]">
|
||||
<$action-listops $tiddler=<<saveTiddler>> $field=<<tagField>> $subfilter="[<tag>]"/>
|
||||
</$list>
|
||||
<$set name="currentTiddlerCSSEscaped" value={{{ [<saveTiddler>escapecss[]] }}}>
|
||||
<$action-sendmessage $message="tm-focus-selector" $param=<<get-tagpicker-focus-selector>> preventScroll="true"/>
|
||||
</$set>
|
||||
<<delete-tag-state-tiddlers>>
|
||||
<$list filter="[<refreshTitle>minlength[1]]">
|
||||
<$action-setfield $tiddler=<<refreshTitle>> text="yes"/>
|
||||
</$list>
|
||||
<<actions>>
|
||||
<$set name="backgroundColor"
|
||||
value={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}
|
||||
>
|
||||
<$wikify name="foregroundColor"
|
||||
text="""<$macrocall $name="contrastcolour" target=<<backgroundColor>> fallbackTarget=<<fallbackTarget>> colourA=<<colourA>> colourB=<<colourB>>/>"""
|
||||
>
|
||||
<span class="tc-tag-label tc-btn-invisible"
|
||||
style=<<tag-pill-styles>>
|
||||
data-tag-title=<<currentTiddler>>
|
||||
>
|
||||
{{||$:/core/ui/TiddlerIcon}}<$view field="title" format="text"/>
|
||||
</span>
|
||||
</$wikify>
|
||||
</$set>
|
||||
</$button>
|
||||
|
@ -3,16 +3,23 @@ title: $:/core/ui/TagTemplate
|
||||
\whitespace trim
|
||||
<span class="tc-tag-list-item" data-tag-title=<<currentTiddler>>>
|
||||
<$set name="transclusion" value=<<currentTiddler>>>
|
||||
<$macrocall $name="tag-pill-body" tag=<<currentTiddler>> icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}} colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}} palette={{$:/palette}} element-tag="""$button""" element-attributes="""popup=<<qualify "$:/state/popup/tag">> dragFilter='[all[current]tagging[]]' tag='span'"""/>
|
||||
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" position="below" animate="yes" class="tc-drop-down">
|
||||
<$set name="tv-show-missing-links" value="yes">
|
||||
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
|
||||
</$set>
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TagDropdown]!has[draft.of]]" variable="listItem">
|
||||
<$transclude tiddler=<<listItem>>/>
|
||||
</$list>
|
||||
<hr>
|
||||
<$macrocall $name="list-tagged-draggable" tag=<<currentTiddler>>/>
|
||||
</$reveal>
|
||||
<$macrocall $name="tag-pill-body"
|
||||
tag=<<currentTiddler>>
|
||||
icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}}
|
||||
colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}
|
||||
palette={{$:/palette}}
|
||||
element-tag="$button"
|
||||
element-attributes="""popup=<<qualify "$:/state/popup/tag">> dragFilter="[all[current]tagging[]]" tag='span'"""
|
||||
/>
|
||||
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" position="below" animate="yes" class="tc-drop-down">
|
||||
<$set name="tv-show-missing-links" value="yes">
|
||||
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
|
||||
</$set>
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TagDropdown]!has[draft.of]]" variable="listItem">
|
||||
<$transclude tiddler=<<listItem>>/>
|
||||
</$list>
|
||||
<hr>
|
||||
<$macrocall $name="list-tagged-draggable" tag=<<currentTiddler>>/>
|
||||
</$reveal>
|
||||
</$set>
|
||||
</span>
|
||||
|
@ -1,4 +1,5 @@
|
||||
title: $:/core/ui/ViewTemplate
|
||||
code-body: yes
|
||||
|
||||
\whitespace trim
|
||||
\define folded-state()
|
||||
@ -7,7 +8,7 @@ $:/state/folded/$(currentTiddler)$
|
||||
\define cancel-delete-tiddler-actions(message) <$action-sendmessage $message="tm-$message$-tiddler"/>
|
||||
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global/View]!is[draft]]
|
||||
<$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify "$:/state/popup/tiddler-info">>>
|
||||
<div dir=<<tv-text-direction>> data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{ [all[shadows+tiddlers]tag[$:/tags/ClassFilters/TiddlerTemplate]!is[draft]] :map:flat[subfilter{!!text}] tc-tiddler-frame tc-tiddler-view-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[shadow]is[tiddler]then[tc-tiddler-overridden-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}} role="article">
|
||||
<div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{ [all[shadows+tiddlers]tag[$:/tags/ClassFilters/TiddlerTemplate]!is[draft]] :map:flat[subfilter{!!text}] tc-tiddler-frame tc-tiddler-view-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[shadow]is[tiddler]then[tc-tiddler-overridden-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}} role="article">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!is[draft]]" variable="listItem">
|
||||
<$transclude tiddler=<<listItem>>/>
|
||||
</$list>
|
||||
|
@ -3,7 +3,7 @@ tags: $:/tags/ViewTemplate
|
||||
|
||||
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View/Body]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global/View/Body]!is[draft]]
|
||||
|
||||
<$reveal tag="div" class="tc-tiddler-body" type="nomatch" stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes" dir=<<tv-text-direction>>>
|
||||
<$reveal tag="div" class="tc-tiddler-body" type="nomatch" stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes">
|
||||
|
||||
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/ViewTemplateBodyFilter]!is[draft]get[text]] :and[!is[blank]else[$:/core/ui/ViewTemplate/body/default]] }}} />
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
title: $:/core/ui/ViewTemplate/body/default
|
||||
code-body: yes
|
||||
|
||||
<$transclude>
|
||||
|
||||
|
@ -3,7 +3,7 @@ tags: $:/tags/ViewTemplate
|
||||
|
||||
\whitespace trim
|
||||
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
|
||||
<div class="tc-subtitle" dir=<<tv-text-direction>>>
|
||||
<div class="tc-subtitle">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate/Subtitle]!has[draft.of]]" variable="subtitleTiddler" counter="indexSubtitleTiddler">
|
||||
<$list filter="[<indexSubtitleTiddler-first>match[no]]" variable="ignore">
|
||||
|
||||
|
@ -3,5 +3,5 @@ tags: $:/tags/ViewTemplate
|
||||
|
||||
\whitespace trim
|
||||
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
|
||||
<div class="tc-tags-wrapper" dir=<<tv-text-direction>>><$list filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/></div>
|
||||
<div class="tc-tags-wrapper"><$list filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/></div>
|
||||
</$reveal>
|
||||
|
@ -6,7 +6,7 @@ tags: $:/tags/ViewTemplate
|
||||
fill:$(foregroundColor)$;
|
||||
\end
|
||||
<div class="tc-tiddler-title">
|
||||
<div class="tc-titlebar" dir=<<tv-text-direction>>>
|
||||
<div class="tc-titlebar">
|
||||
<span class="tc-tiddler-controls">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]] :filter[lookup[$:/config/ViewToolbarButtons/Visibility/]!match[hide]]" storyview="pop" variable="listItem"><$set name="tv-config-toolbar-class" filter="[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]"><$transclude tiddler=<<listItem>>/></$set></$list>
|
||||
</span>
|
||||
|
@ -1,2 +0,0 @@
|
||||
title: $:/config/DefaultTextDirection
|
||||
text: auto
|
@ -1,6 +1,6 @@
|
||||
title: $:/config/OfficialPluginLibrary
|
||||
tags: $:/tags/PluginLibrary
|
||||
url: https://tiddlywiki.com/library/v5.2.8/index.html
|
||||
url: https://tiddlywiki.com/library/v5.3.2/index.html
|
||||
caption: {{$:/language/OfficialPluginLibrary}}
|
||||
|
||||
{{$:/language/OfficialPluginLibrary/Hint}}
|
||||
|
@ -2,7 +2,8 @@ title: $:/config/ViewTemplateBodyFilters/
|
||||
tags: $:/tags/ViewTemplateBodyFilter
|
||||
|
||||
stylesheet: [tag[$:/tags/Stylesheet]then[$:/core/ui/ViewTemplate/body/rendered-plain-text]]
|
||||
system: [prefix[$:/boot/]] [prefix[$:/config/]] [prefix[$:/core/macros]] [prefix[$:/core/save/]] [prefix[$:/core/templates/]] [prefix[$:/core/ui/]split[/]count[]compare:number:eq[4]] [prefix[$:/info/]] [prefix[$:/language/]] [prefix[$:/languages/]] [prefix[$:/snippets/]] [prefix[$:/state/]] [prefix[$:/status/]] [prefix[$:/info/]] [prefix[$:/temp/]] +[!is[image]limit[1]then[$:/core/ui/ViewTemplate/body/code]]
|
||||
core-ui-tags: [tag[$:/tags/PageTemplate]] [tag[$:/tags/EditTemplate]] [tag[$:/tags/ViewTemplate]] [tag[$:/tags/KeyboardShortcut]] [tag[$:/tags/ImportPreview]] [tag[$:/tags/EditPreview]][tag[$:/tags/EditorToolbar]] [tag[$:/tags/Actions]] :then[[$:/core/ui/ViewTemplate/body/code]]
|
||||
system: [prefix[$:/boot/]] [prefix[$:/config/]] [prefix[$:/core/macros]] [prefix[$:/core/save/]] [prefix[$:/core/templates/]] [prefix[$:/info/]] [prefix[$:/language/]] [prefix[$:/languages/]] [prefix[$:/snippets/]] [prefix[$:/state/]] [prefix[$:/status/]] [prefix[$:/info/]] [prefix[$:/temp/]] +[!is[image]limit[1]then[$:/core/ui/ViewTemplate/body/code]]
|
||||
code-body: [field:code-body[yes]then[$:/core/ui/ViewTemplate/body/code]]
|
||||
import: [field:plugin-type[import]then[$:/core/ui/ViewTemplate/body/import]]
|
||||
plugin: [has[plugin-type]then[$:/core/ui/ViewTemplate/body/plugin]]
|
||||
|
@ -9,26 +9,51 @@ color:$(foregroundColor)$;
|
||||
|
||||
<!-- This has no whitespace trim to avoid modifying $actions$. Closing tags omitted for brevity. -->
|
||||
\define tag-pill-inner(tag,icon,colour,fallbackTarget,colourA,colourB,element-tag,element-attributes,actions)
|
||||
<$vars
|
||||
\whitespace trim
|
||||
<$let
|
||||
foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">>
|
||||
backgroundColor="""$colour$"""
|
||||
><$element-tag$
|
||||
backgroundColor=<<__colour__>>
|
||||
>
|
||||
<$element-tag$
|
||||
$element-attributes$
|
||||
class="tc-tag-label tc-btn-invisible"
|
||||
style=<<tag-pill-styles>>
|
||||
>$actions$<$transclude tiddler="""$icon$"""/><$view tiddler=<<__tag__>> field="title" format="text" /></$element-tag$>
|
||||
>
|
||||
<<__actions__>>
|
||||
<$transclude tiddler=<<__icon__>>/>
|
||||
<$view tiddler=<<__tag__>> field="title" format="text" />
|
||||
</$element-tag$>
|
||||
</$let>
|
||||
\end
|
||||
|
||||
\define tag-pill-body(tag,icon,colour,palette,element-tag,element-attributes,actions)
|
||||
<$macrocall $name="tag-pill-inner" tag=<<__tag__>> icon="""$icon$""" colour="""$colour$""" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}} element-tag="""$element-tag$""" element-attributes="""$element-attributes$""" actions="""$actions$"""/>
|
||||
\whitespace trim
|
||||
<$macrocall $name="tag-pill-inner"
|
||||
tag=<<__tag__>>
|
||||
icon=<<__icon__>>
|
||||
colour=<<__colour__>>
|
||||
fallbackTarget={{$palette$##tag-background}}
|
||||
colourA={{$palette$##foreground}}
|
||||
colourB={{$palette$##background}}
|
||||
element-tag=<<__element-tag__>>
|
||||
element-attributes=<<__element-attributes__>>
|
||||
actions=<<__actions__>>
|
||||
/>
|
||||
\end
|
||||
|
||||
\define tag-pill(tag,element-tag:"span",element-attributes:"",actions:"")
|
||||
\whitespace trim
|
||||
<span class="tc-tag-list-item" data-tag-title=<<__tag__>>>
|
||||
<$let currentTiddler=<<__tag__>>>
|
||||
<$macrocall $name="tag-pill-body" tag=<<__tag__>> icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}} colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}} palette={{$:/palette}} element-tag="""$element-tag$""" element-attributes="""$element-attributes$""" actions="""$actions$"""/>
|
||||
</$let>
|
||||
<$let currentTiddler=<<__tag__>>>
|
||||
<$macrocall $name="tag-pill-body"
|
||||
tag=<<__tag__>>
|
||||
icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}}
|
||||
colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}
|
||||
palette={{$:/palette}}
|
||||
element-tag=<<__element-tag__>>
|
||||
element-attributes=<<__element-attributes__>>
|
||||
actions=<<__actions__>>/>
|
||||
</$let>
|
||||
</span>
|
||||
\end
|
||||
|
||||
|
@ -7,7 +7,7 @@ tags: $:/tags/Macro
|
||||
|
||||
\define toc-caption()
|
||||
\whitespace trim
|
||||
<span class="tc-toc-caption">
|
||||
<span class="tc-toc-caption tc-tiny-gap-left">
|
||||
<$set name="tv-wikilinks" value="no">
|
||||
<$transclude field="caption">
|
||||
<$view field="title"/>
|
||||
@ -145,7 +145,7 @@ tags: $:/tags/Macro
|
||||
<$qualify name="toc-state" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>
|
||||
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
||||
<li class=<<toc-item-class>>>
|
||||
<$list filter="[all[current]tagging[]$sort$limit[1]]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button> <$view field='caption'><$view field='title'/></$view>">
|
||||
<$list filter="[all[current]tagging[]$sort$limit[1]]" variable="ignore" emptyMessage="""<$button class="tc-btn-invisible">{{$:/core/images/blank}}</$button><span class="toc-item-muted"><<toc-caption>></span>""">
|
||||
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
||||
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
||||
<$transclude tiddler=<<toc-closed-icon>> />
|
||||
|
@ -1,3 +1,2 @@
|
||||
title: $:/tags/ViewTemplateBodyFilter
|
||||
list: $:/config/ViewTemplateBodyFilters/hide-body $:/config/ViewTemplateBodyFilters/code-body $:/config/ViewTemplateBodyFilters/stylesheet $:/config/ViewTemplateBodyFilters/system $:/config/ViewTemplateBodyFilters/import $:/config/ViewTemplateBodyFilters/plugin $:/config/ViewTemplateBodyFilters/default
|
||||
|
||||
list: $:/config/ViewTemplateBodyFilters/hide-body $:/config/ViewTemplateBodyFilters/code-body $:/config/ViewTemplateBodyFilters/stylesheet $:/config/ViewTemplateBodyFilters/core-ui-advanced-search $:/config/ViewTemplateBodyFilters/core-ui-tags $:/config/ViewTemplateBodyFilters/system $:/config/ViewTemplateBodyFilters/import $:/config/ViewTemplateBodyFilters/plugin $:/config/ViewTemplateBodyFilters/default
|
@ -3,7 +3,7 @@
|
||||
{
|
||||
"file": "../../../tw5.com/tiddlers/images/New Release Banner.png",
|
||||
"fields": {
|
||||
"type": "image/jpg",
|
||||
"type": "image/jpeg",
|
||||
"title": "New Release Banner",
|
||||
"tags": "picture"
|
||||
}
|
||||
|
60
editions/prerelease/tiddlers/Release 5.3.2.tid
Normal file
60
editions/prerelease/tiddlers/Release 5.3.2.tid
Normal file
@ -0,0 +1,60 @@
|
||||
caption: 5.3.2
|
||||
created: 20230820114855583
|
||||
modified: 20230820114855583
|
||||
tags: ReleaseNotes
|
||||
title: Release 5.3.2
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
//[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.3.1...master]]//
|
||||
|
||||
! Translation improvement
|
||||
|
||||
Improvements to the following translations:
|
||||
|
||||
*
|
||||
|
||||
! Widget Improvements
|
||||
|
||||
*
|
||||
|
||||
! Hackability Improvements
|
||||
|
||||
*
|
||||
|
||||
! Bug Fixes
|
||||
|
||||
*
|
||||
|
||||
! Node.js Improvements
|
||||
|
||||
*
|
||||
|
||||
! Developer Improvements
|
||||
|
||||
*
|
||||
|
||||
! Acknowledgements
|
||||
|
||||
[[@Jermolene|https://github.com/Jermolene]] would like to thank the contributors to this release who have generously given their time to help improve TiddlyWiki:
|
||||
|
||||
<<.contributors """
|
||||
AnthonyMuscio
|
||||
btheado
|
||||
catter-fly
|
||||
cmo-pomerium
|
||||
CrossEye
|
||||
flibbles
|
||||
hffqyd
|
||||
lilscribby
|
||||
linonetwo
|
||||
Marxsal
|
||||
mateuszwilczek
|
||||
pille1842
|
||||
pmario
|
||||
rmunn
|
||||
saqimtiaz
|
||||
stevesunypoly
|
||||
TiddlyTweeter
|
||||
twMat
|
||||
yaisog
|
||||
""">>
|
@ -1,6 +1,6 @@
|
||||
title: $:/config/LocalPluginLibrary
|
||||
tags: $:/tags/PluginLibrary
|
||||
url: http://127.0.0.1:8080/prerelease/library/v5.2.2/index.html
|
||||
url: http://127.0.0.1:8080/prerelease/library/v5.3.2/index.html
|
||||
caption: {{$:/language/OfficialPluginLibrary}} (Prerelease Local)
|
||||
|
||||
A locally installed version of the official ~TiddlyWiki plugin library at tiddlywiki.com for testing and debugging. //Requires a local web server to share the library//
|
||||
|
@ -1,6 +1,6 @@
|
||||
title: $:/config/OfficialPluginLibrary
|
||||
tags: $:/tags/PluginLibrary
|
||||
url: https://tiddlywiki.com/prerelease/library/v5.2.8/index.html
|
||||
url: https://tiddlywiki.com/prerelease/library/v5.3.2/index.html
|
||||
caption: {{$:/language/OfficialPluginLibrary}} (Prerelease)
|
||||
|
||||
The prerelease version of the official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
|
||||
|
@ -1,5 +1,5 @@
|
||||
title: TiddlyWiki Pre-release
|
||||
modified: 20150428204930183
|
||||
modified: 20230731122156493
|
||||
|
||||
This is a pre-release build of TiddlyWiki provided for testing and review purposes. ''Please don't try to depend on the pre-release for anything important'' -- you should use the latest official release from https://tiddlywiki.com.
|
||||
|
||||
|
40
editions/test/tiddlers/tests/data/filters/substitute.tid
Normal file
40
editions/test/tiddlers/tests/data/filters/substitute.tid
Normal file
@ -0,0 +1,40 @@
|
||||
title: Filters/substitute
|
||||
description: Test substitute operator
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: substitute filter data 1
|
||||
tags: Hello There [[Welcome to TiddlyWiki]] GettingStarted
|
||||
|
||||
TiddlyWiki
|
||||
+
|
||||
title: substitute filter data 2
|
||||
|
||||
The output of the filter `[[substitute filter data 1]tags[]]` is ${[[substitute filter data 1]tags[]]}$.
|
||||
+
|
||||
title: substitute filter data 3
|
||||
|
||||
Welcome to $(projectname)$ $1$ $2$ $3$. Tiddlers starting with `substitute`: ${[prefix[substitute]format:titlelist[]join[ ]]}$.
|
||||
+
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$let projectname="TiddlyWiki">
|
||||
(<$text text={{{ [[]substitute[]] }}}/>)
|
||||
(<$text text={{{ [[Hello There, welcome to $TiddlyWiki$]substitute[]] }}}/>)
|
||||
(<$text text={{{ [[Welcome to $(projectname)$]substitute[]] }}}/>)
|
||||
(<$text text={{{ [[Welcome to $(projectname)$ $1$]substitute[today]] }}}/>)
|
||||
(<$text text={{{ [[This is not a valid embedded filter ${ hello )$]substitute[]] }}}/>)
|
||||
(<$text text={{{ [{substitute filter data 2}substitute[]] }}}/>)
|
||||
(<$text text={{{ [{substitute filter data 3}substitute[every],[day]] }}}/>)
|
||||
</$let>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>()
|
||||
(Hello There, welcome to $TiddlyWiki$)
|
||||
(Welcome to TiddlyWiki)
|
||||
(Welcome to TiddlyWiki today)
|
||||
(This is not a valid embedded filter ${ hello )$)
|
||||
(The output of the filter `[[substitute filter data 1]tags[]]` is Hello.)
|
||||
(Welcome to TiddlyWiki every day $3$. Tiddlers starting with `substitute`: [[substitute filter data 1]] [[substitute filter data 2]] [[substitute filter data 3]].)</p>
|
@ -0,0 +1,24 @@
|
||||
title: Functions/Function/Indented
|
||||
description: Indented function definition
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
\function .dividebysomething(factor:0.5)
|
||||
[divide<factor>]
|
||||
\end
|
||||
|
||||
\function multiplebysomething(first:ignored,factor:2)
|
||||
[multiply<factor>multiply[2].dividebysomething[0.25]]
|
||||
\end
|
||||
|
||||
<$text text={{{ [[4]function[multiplebysomething]] }}}/>
|
||||
|
|
||||
<$text text={{{ [[6]function[multiplebysomething],[ignored],[4]] }}}/>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>64|192</p>
|
@ -33,4 +33,4 @@ $param$ with a ''buffalo''
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Going to lunch with a ''buffalo''</p><p>Going to breakfastwith a<strong>buffalo</strong></p><p>Going to dinner with a <strong>buffalo</strong></p>Going to lunch with a buffalo with a buffaloGoing to dinner with a buffalo
|
||||
<p>Going to lunch with a ''buffalo''</p><p>Going to breakfastwith a<strong>buffalo</strong></p><p>Going to dinner with a <strong>buffalo</strong></p>Going to lunch with a ''buffalo''Going to breakfastwith abuffaloGoing to dinner with a buffalo
|
@ -0,0 +1,23 @@
|
||||
title: ImportVariables/WithSetWidgets
|
||||
description: Import variables defined with a set widget
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
\import Definitions
|
||||
<$text text=<<one>>/>,
|
||||
<$text text=<<two>>/>
|
||||
+
|
||||
title: Definitions
|
||||
|
||||
\whitespace trim
|
||||
<$set name="one" value="elephant">
|
||||
<$set name="two" value="giraffe">
|
||||
</$set>
|
||||
</$set>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>elephant,giraffe</p>
|
@ -0,0 +1,22 @@
|
||||
title: ImportVariables/WithSetWidgets2
|
||||
description: Import variables defined with a set widget without whitespace pragma
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
\import Definitions
|
||||
<$text text=<<one>>/>,
|
||||
<$text text=<<two>>/>
|
||||
+
|
||||
title: Definitions
|
||||
|
||||
<$set name="one" value="elephant">
|
||||
<$set name="two" value="giraffe">
|
||||
</$set>
|
||||
</$set>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>elephant,giraffe</p>
|
@ -0,0 +1,29 @@
|
||||
title: ImportVariables/WithSetWidgetsAndMacros
|
||||
description: Import variables defined with a set widget without whitespace pragma
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
\import Definitions
|
||||
<$text text=<<name>>/>,
|
||||
<$text text=<<address>>/>,
|
||||
<$text text=<<one>>/>,
|
||||
<$text text=<<two>>/>
|
||||
+
|
||||
title: Definitions
|
||||
|
||||
\define name() Bugs Bunny
|
||||
\procedure address()
|
||||
Bunny Hill
|
||||
\end
|
||||
|
||||
<$set name="one" value="elephant">
|
||||
<$set name="two" value="giraffe">
|
||||
</$set>
|
||||
</$set>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Bugs Bunny,Bunny Hill,elephant,giraffe</p>
|
@ -0,0 +1,20 @@
|
||||
title: Procedures/Nested/Indented
|
||||
description: Nested Procedures that are indented
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
\procedure alpha(x)
|
||||
\procedure beta(y)
|
||||
<$text text=<<y>>/>
|
||||
\end beta
|
||||
<$transclude $variable="beta" y={{{ [<x>addprefix<x>] }}}/>
|
||||
\end alpha
|
||||
|
||||
<<alpha "Elephant">>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>ElephantElephant</p>
|
@ -0,0 +1,22 @@
|
||||
title: Procedures/TrailingNewlines
|
||||
description: Trailing newlines in procedures must not be dropped
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure inner()
|
||||
Paragraph 1
|
||||
|
||||
Paragraph 2
|
||||
\end
|
||||
\procedure outer()
|
||||
<$macrocall $name=inner />
|
||||
|
||||
\end
|
||||
<<outer>>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Paragraph 1</p><p>Paragraph 2</p>
|
@ -0,0 +1,33 @@
|
||||
title: Transclude/CustomWidget/Simple/Indented
|
||||
description: Custom widget definition indented
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$transclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
</$transclude>
|
||||
+
|
||||
title: TiddlerOne
|
||||
|
||||
\whitespace trim
|
||||
<!-- Define the <$my.widget> widget by defining a transcludable variable with that name -->
|
||||
\widget $my.widget(one:'Jaguar')
|
||||
\whitespace trim
|
||||
<$text text=<<one>>/>
|
||||
<$slot $name="ts-raw">
|
||||
Whale
|
||||
</$slot>
|
||||
\end
|
||||
<$my.widget one="Dingo">
|
||||
Crocodile
|
||||
</$my.widget>
|
||||
<$my.widget one="BumbleBee">
|
||||
Squirrel
|
||||
</$my.widget>
|
||||
<$my.widget/>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>DingoCrocodileBumbleBeeSquirrelJaguarWhale</p>
|
@ -0,0 +1,20 @@
|
||||
title: Transclude/Parameterised/Shortcut/ParametersIndented
|
||||
description: Simple parameterised transclusion using the parameters pragma (indented)
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$transclude $tiddler='TiddlerOne' one='Ferret'/>
|
||||
<$transclude $tiddler='TiddlerOne'/>
|
||||
+
|
||||
title: TiddlerOne
|
||||
|
||||
\whitespace trim
|
||||
\parameters(one:'Jaguar')
|
||||
<$text text=<<one>>/>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>FerretJaguar</p>
|
@ -0,0 +1,26 @@
|
||||
title: Procedures/Double/Underscore
|
||||
description: Checking that procedures don't expose parameters as variables wrapped in double underscores
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
\procedure mamacro(one:"red",two:"green")
|
||||
It is $one$ and $two$<<__one__>><<__two__>>.
|
||||
\end
|
||||
|
||||
<$macrocall $name="mamacro"/>
|
||||
|
||||
<$transclude $variable="mamacro"/>
|
||||
|
||||
<$transclude $variable="mamacro" one="orange"/>
|
||||
|
||||
<$transclude $variable="mamacro" 0="pink"/>
|
||||
|
||||
<$transclude $variable="mamacro" one="purple" 1="pink"/>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>It is $one$ and $two$.</p><p>It is $one$ and $two$.</p><p>It is $one$ and $two$.</p><p>It is $one$ and $two$.</p><p>It is $one$ and $two$.</p>
|
@ -0,0 +1,21 @@
|
||||
title: Widgets/SubstitutedAttributes
|
||||
description: Attributes specified as string that should have substitution performed.
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
<$set name="var with spaces" value="spaces">
|
||||
<$let project="TiddlyWiki" disabled="true" var-with-dashes="dashes">
|
||||
<div class=`$(project)$
|
||||
${ [[Hello]addsuffix[There]] }$` attrib=`myvalue` otherattrib=`$(1)$` blankattrib=`` quoted="here" disabled=```$(disabled)$``` dashes=`$(var-with-dashes)$` spaces=`$(var with spaces)$`>
|
||||
</div>
|
||||
</$let>
|
||||
</$set>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p><div attrib="myvalue" blankattrib="" class="TiddlyWiki
|
||||
HelloThere" dashes="dashes" disabled="true" otherattrib="" quoted="here" spaces="spaces"></div></p>
|
@ -397,8 +397,8 @@ Tests the filtering mechanism.
|
||||
expect(wiki.filterTiddlers("[all[shadows]tag[two]]").join(",")).toBe("$:/TiddlerFive");
|
||||
expect(wiki.filterTiddlers("[all[shadows+tiddlers]tag[two]]").join(",")).toBe("$:/TiddlerFive,$:/TiddlerTwo,Tiddler Three");
|
||||
expect(wiki.filterTiddlers("[all[tiddlers+shadows]tag[two]]").join(",")).toBe("$:/TiddlerTwo,Tiddler Three,$:/TiddlerFive");
|
||||
expect(wiki.filterTiddlers("[all[shadows+tiddlers]]").join(",")).toBe("$:/TiddlerFive,TiddlerSix,TiddlerSeventh,Tiddler8,$:/ShadowPlugin,$:/TiddlerTwo,a fourth tiddler,filter regexp test,has filter,hasList,one,Tiddler Three,TiddlerOne");
|
||||
expect(wiki.filterTiddlers("[all[tiddlers+shadows]]").join(",")).toBe("$:/ShadowPlugin,$:/TiddlerTwo,a fourth tiddler,filter regexp test,has filter,hasList,one,Tiddler Three,TiddlerOne,$:/TiddlerFive,TiddlerSix,TiddlerSeventh,Tiddler8");
|
||||
expect(wiki.filterTiddlers("[all[shadows+tiddlers]]").join(",")).toBe("$:/TiddlerFive,Tiddler8,TiddlerSeventh,TiddlerSix,$:/ShadowPlugin,$:/TiddlerTwo,a fourth tiddler,filter regexp test,has filter,hasList,one,Tiddler Three,TiddlerOne");
|
||||
expect(wiki.filterTiddlers("[all[tiddlers+shadows]]").join(",")).toBe("$:/ShadowPlugin,$:/TiddlerTwo,a fourth tiddler,filter regexp test,has filter,hasList,one,Tiddler Three,TiddlerOne,$:/TiddlerFive,Tiddler8,TiddlerSeventh,TiddlerSix");
|
||||
expect(wiki.filterTiddlers("[all[tiddlers]tag[two]]").join(",")).toBe("$:/TiddlerTwo,Tiddler Three");
|
||||
expect(wiki.filterTiddlers("[all[orphans+tiddlers+tags]]").join(",")).toBe("$:/ShadowPlugin,$:/TiddlerTwo,a fourth tiddler,filter regexp test,has filter,hasList,Tiddler Three,TiddlerOne,two,one");
|
||||
});
|
||||
@ -420,10 +420,10 @@ Tests the filtering mechanism.
|
||||
|
||||
it("should handle the tagging operator", function() {
|
||||
expect(wiki.filterTiddlers("[[one]tagging[]sort[title]]").join(",")).toBe("Tiddler Three,Tiddler8,TiddlerOne,TiddlerSeventh");
|
||||
expect(wiki.filterTiddlers("[[one]tagging[]]").join(",")).toBe("Tiddler Three,TiddlerOne,TiddlerSeventh,Tiddler8");
|
||||
expect(wiki.filterTiddlers("[[one]tagging[]]").join(",")).toBe("Tiddler Three,TiddlerOne,Tiddler8,TiddlerSeventh");
|
||||
expect(wiki.filterTiddlers("[[two]tagging[]sort[title]]").join(",")).toBe("$:/TiddlerFive,$:/TiddlerTwo,Tiddler Three");
|
||||
var fakeWidget = {wiki: wiki, getVariable: function(name) {return name === "currentTiddler" ? "one": undefined;}};
|
||||
expect(wiki.filterTiddlers("[all[current]tagging[]]",fakeWidget).join(",")).toBe("Tiddler Three,TiddlerOne,TiddlerSeventh,Tiddler8");
|
||||
expect(wiki.filterTiddlers("[all[current]tagging[]]",fakeWidget).join(",")).toBe("Tiddler Three,TiddlerOne,Tiddler8,TiddlerSeventh");
|
||||
});
|
||||
|
||||
it("should handle the untagged operator", function() {
|
||||
|
@ -161,6 +161,16 @@ describe("HTML tag new parser tests", function() {
|
||||
expect($tw.utils.parseAttribute(" attrib1>",0)).toEqual(
|
||||
{ type : 'string', value : 'true', start : 0, name : 'attrib1', end : 8 }
|
||||
);
|
||||
expect($tw.utils.parseAttribute("p=`blah` ",1)).toEqual(null);
|
||||
expect($tw.utils.parseAttribute("p=`blah` ",0)).toEqual(
|
||||
{ start: 0, name: 'p', type: 'substituted', rawValue: 'blah', end: 8 }
|
||||
);
|
||||
expect($tw.utils.parseAttribute("p=```blah``` ",0)).toEqual(
|
||||
{ start: 0, name: 'p', type: 'substituted', rawValue: 'blah', end: 12 }
|
||||
);
|
||||
expect($tw.utils.parseAttribute("p=`Hello \"There\"`",0)).toEqual(
|
||||
{ start: 0, name: 'p', type: 'substituted', rawValue: 'Hello "There"', end: 17 }
|
||||
);
|
||||
});
|
||||
|
||||
it("should parse HTML tags", function() {
|
||||
|
@ -434,6 +434,15 @@ describe("'reduce' and 'intersection' filter prefix tests", function() {
|
||||
expect(wiki.filterTiddlers("[tag[shopping]] :map[get[title]addprefix[-]addprefix<length>addprefix[of]addprefix<index>]").join(",")).toBe("0of4-Brownies,1of4-Chick Peas,2of4-Milk,3of4-Rice Pudding");
|
||||
});
|
||||
|
||||
it("should handle the :then prefix", function() {
|
||||
expect(wiki.filterTiddlers("[[one]] :then[[two]]").join(",")).toBe("two");
|
||||
expect(wiki.filterTiddlers("[[one]] :then[tag[shopping]]").join(",")).toBe("Brownies,Chick Peas,Milk,Rice Pudding");
|
||||
expect(wiki.filterTiddlers("[[one]] [[two]] [[three]] :then[[four]]").join(",")).toBe("four");
|
||||
expect(wiki.filterTiddlers("[[one]] :then[tag[nonexistent]]").join(",")).toBe("one");
|
||||
expect(wiki.filterTiddlers(":then[[two]]").length).toBe(0);
|
||||
expect(wiki.filterTiddlers("[[notatiddler]is[tiddler]] :then[[two]]").length).toBe(0);
|
||||
});
|
||||
|
||||
it("should handle macro parameters for filter run prefixes",function() {
|
||||
var widget = require("$:/core/modules/widgets/widget.js");
|
||||
var rootWidget = new widget.widget({ type:"widget", children:[ {type:"widget", children:[]} ] },
|
||||
|
@ -1,11 +0,0 @@
|
||||
created: 20230613162508509
|
||||
modified: 20230613162508509
|
||||
title: Right-To-Left Languages
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.3.0">> The [[language plugins|Languages]] in TiddlyWiki's plugin library apply the appropriate [["right-to-left" setting|https://www.w3.org/International/questions/qa-html-dir]] to the entire document. To set the right to left setting independently for an individual tiddler, use the `\dir` [[pragma|Pragma]] at the top of the tiddler:
|
||||
|
||||
```
|
||||
\dir rtl
|
||||
This text will be displayed with right-to-left formatting
|
||||
```
|
@ -1,11 +1,11 @@
|
||||
created: 20140129085406905
|
||||
modified: 20210106151027268
|
||||
modified: 20230805140720289
|
||||
tags: [[Other Resources]] Articles
|
||||
title: "TiddlyWiki Posts" by Jeffrey Kishner
|
||||
type: text/vnd.tiddlywiki
|
||||
url: http://blog.jeffreykishner.com/tiddlywiki/
|
||||
url: https://web.archive.org/web/20221015011644/http://blog.jeffreykishner.com/tiddlywiki/
|
||||
|
||||
A collection of articles covering integration with Fargo, Font Awesome and Google Calendar, and tips for managing task lists.
|
||||
A collection of articles covering integration with Fargo, Font Awesome and Google Calendar, and tips for managing task lists. The original site is missing, but a link to an archive is provided.
|
||||
|
||||
{{!!url}}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
created: 20201117163027900
|
||||
modified: 20210106151027459
|
||||
modified: 20230723074506632
|
||||
tags: Tutorials
|
||||
title: GitHub Saver Tutorial by Mohammad
|
||||
type: text/vnd.tiddlywiki
|
||||
url: https://kookma.github.io/TW5-GitHub-Saver/
|
||||
|
||||
GitHub Saver is a step by step tutorial shows how to integrate Tiddlywiki 5 and GitHub Pages to create websites hosted on https://github.com/.
|
||||
GitHub Saver is a step by step tutorial that shows how to integrate Tiddlywiki 5 and ~GitHub Pages to create websites hosted on https://github.com/.
|
||||
|
||||
{{!!url}}
|
||||
|
||||
@ -13,11 +13,11 @@ This instruction is based on Tiddlywiki single html file model, while it can use
|
||||
|
||||
!! Other tutorials
|
||||
|
||||
;Tiddlywiki, Travis-CI and GitHub Pages
|
||||
;Tiddlywiki, Travis-CI and ~GitHub Pages
|
||||
:https://kookma.github.io/Tiddlywiki-Travis-CI/
|
||||
:This wiki shows how to set up websites hosted on [[GitHub Pages|https://pages.github.com/]] using [[Travis-CI|https://travis-ci.org]] and [[Tiddlywiki 5|https://tiddlywiki.com]] on Node.js.
|
||||
|
||||
|
||||
;Tiddlywiki and GitHub Pages
|
||||
;Tiddlywiki and ~GitHub Pages
|
||||
:https://kookma.github.io/Tiddlywiki-and-GitHub-Pages/
|
||||
:This instruction is based on local edit, save and push to GitHub. It does NOT use the new GitHub Saver mechanism (requires TW 5.1.20+) which lets edit and save directly from Tiddlywiki!
|
||||
:This instruction is based on local edit, save and push to ~GitHub. It does NOT use the new ~GitHub Saver mechanism (requires TW 5.1.20+) which lets edit and save directly from Tiddlywiki!
|
@ -1,16 +0,0 @@
|
||||
created: 20140312085406905
|
||||
modified: 20140312084543862
|
||||
tags: Tutorials
|
||||
title: "Install and run TiddlyWiki on a CentOS 6 VPS using Nginx" from RoseHosting
|
||||
type: text/vnd.tiddlywiki
|
||||
url: http://www.rosehosting.com/blog/install-and-run-tiddlywiki-on-a-centoos-6-vps-using-nginx/
|
||||
|
||||
A step by step guide to running TiddlyWiki on a ~CentOS Virtual Private Server.
|
||||
|
||||
{{!!url}}
|
||||
|
||||
<<<
|
||||
In this tutorial we will guide you through the steps of installing and running TiddlyWiki on a ~CentOS 6 VPS.
|
||||
|
||||
We will also install and configure Nginx as a reverse proxy, so you can run TiddlyWiki behind Nginx.
|
||||
<<<
|
9
editions/tw5.com/tiddlers/definitions/Git.tid
Normal file
9
editions/tw5.com/tiddlers/definitions/Git.tid
Normal file
@ -0,0 +1,9 @@
|
||||
created: 20230723073000469
|
||||
modified: 20230723073046462
|
||||
tags: Definitions
|
||||
title: Git
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
>Git (/ɡɪt/) is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows (thousands of parallel branches running on different computers).
|
||||
>
|
||||
>https://en.wikipedia.org/wiki/Git
|
@ -1,13 +1,15 @@
|
||||
created: 20140910212609354
|
||||
modified: 20190408173002622
|
||||
modified: 20230723074351846
|
||||
tags: Definitions
|
||||
title: GitHub
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
GitHub is a hosting service for distributed projects that use git as their version-control system. It allows free hosting and management of open-source projects and facilitates collaborative development on the source code. Using GitHub for non-open-source endeavours requires additional fees.
|
||||
GitHub is a hosting service for distributed projects that use git as their version-control system. It allows free hosting and management of open-source projects and facilitates collaborative development on the source code. Using ~GitHub for non-open-source endeavours requires additional fees.
|
||||
|
||||
The code and documentation of TiddlyWiki is hosted on GitHub at:
|
||||
The code and documentation of TiddlyWiki is hosted on ~GitHub at:
|
||||
|
||||
https://github.com/Jermolene/TiddlyWiki5
|
||||
|
||||
GitHub also offer a free web hosting service called [[GitHub Pages|https://pages.github.com/]] that can be used directly from the single file configuration. See [[Saving to a Git service]].
|
||||
~GitHub also offer a free web hosting service called [[GitHub Pages|https://pages.github.com/]] that can be used directly from the single file configuration. See [[Saving to a Git service]].
|
||||
|
||||
An alternative to ~GitHub is GitLab
|
13
editions/tw5.com/tiddlers/definitions/GitLab.tid
Normal file
13
editions/tw5.com/tiddlers/definitions/GitLab.tid
Normal file
@ -0,0 +1,13 @@
|
||||
created: 20230723072527781
|
||||
modified: 20230723073955715
|
||||
tags: Definitions
|
||||
title: GitLab
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
>GitLab Inc. is an open-core company that operates ~GitLab, a ~DevOps software package which can develop, secure, and operate software. The open source software project was created by Ukrainian developer Dmytro Zaporozhets and Dutch developer Sytse Sijbrandij
|
||||
>
|
||||
>https://en.wikipedia.org/wiki/GitLab
|
||||
|
||||
Both GitLab and GitHub use [[Git]] a distributed version control system, that can be used to store, view and edit TiddlyWiki wikis using [[GitLab Pages|https://docs.gitlab.com/ee/user/project/pages/]]
|
||||
|
||||
Learn more at: [[Saving to a Git service]]
|
@ -1,6 +1,8 @@
|
||||
caption: Fourth-Caption
|
||||
created: 20150221194405000
|
||||
modified: 20211114013601188
|
||||
tags: Contents [[Table-of-Contents Demonstrations]]
|
||||
title: Fourth
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.toc-lorem>>
|
||||
|
@ -2,5 +2,15 @@ created: 20150221194423000
|
||||
modified: 20211114013601189
|
||||
tags: SecondThree [[Table-of-Contents Demonstrations]]
|
||||
title: SecondThreeThree
|
||||
toc-link: no
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
''Important''
|
||||
|
||||
It's important that this tiddler has no "child" to be able to visually test every possible toc code-path.
|
||||
|
||||
* This tiddler has a field ''toc-link: no''
|
||||
* Do not tag any other tiddler with the title of this one
|
||||
|
||||
|
||||
|
||||
<<.toc-lorem>>
|
||||
|
@ -1,7 +1,9 @@
|
||||
caption: Third-Caption
|
||||
created: 20150221194436000
|
||||
list: ThirdOne ThirdTwo ThirdThree
|
||||
modified: 20211114013601191
|
||||
tags: Contents [[Table-of-Contents Demonstrations]]
|
||||
title: Third
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.toc-lorem>>
|
||||
|
20
editions/tw5.com/tiddlers/features/Deserializers.tid
Normal file
20
editions/tw5.com/tiddlers/features/Deserializers.tid
Normal file
@ -0,0 +1,20 @@
|
||||
created: 20230627093650105
|
||||
modified: 20230627094356394
|
||||
tags: Features
|
||||
title: Deserializers
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
Deserializer [[modules|Modules]] parse text in various formats into their JSON representation as tiddlers. The deserializer modules available in a wiki can be seen using the [[deserializers operator|deserializers Operator]] and can be used with the [[deserialize Operator]].
|
||||
|
||||
The TiddlyWiki core provides the following deserializers:
|
||||
|
||||
|!Deserializer |!Description |
|
||||
|(DOM)|Extracts tiddlers from a DOM node, should not be used with the <<.op deserialize[]>> operator |
|
||||
|application/javascript|Parses a JavaScript module as a tiddler extracting fields from the header comment|
|
||||
|application/json|Parses [[JSON|JSON in TiddlyWiki]] into tiddlers|
|
||||
|application/x-tiddler|Parses the [[.tid file format|TiddlerFiles]] as a tiddler|
|
||||
|application/x-tiddler-html-div|Parses the [[<DIV>.tiddler file format|TiddlerFiles]] as a tiddler|
|
||||
|application/x-tiddlers|Parses the [[MultiTiddlerFile format|MultiTiddlerFiles]] as tiddlers|
|
||||
|text/css|Parses CSS as a tiddler extracting fields from the header comment|
|
||||
|text/html|Parses an HTML file into tiddlers. Supports ~TiddlyWiki Classic HTML files, ~TiddlyWiki5 HTML files and ordinary HTML files|
|
||||
|text/plain|Parses plain text as a tiddler|
|
@ -1,12 +1,12 @@
|
||||
created: 20190802113703788
|
||||
modified: 20190802132727925
|
||||
modified: 20230501175143648
|
||||
tags: Filters
|
||||
title: Conditional Operators
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.1.20">>The conditional filter operators allow ''if-then-else'' logic to be expressed within filters.
|
||||
<<.from-version "5.1.20">>The conditional filter operators allow for ''if-then-else'' logic to be expressed within filters.
|
||||
|
||||
The foundation is the convention that an empty list can be used to represent the boolean value ''false'' and a list with at one (or more) entries to represent ''true''.
|
||||
The foundation is the convention that an empty list can be used to represent the Boolean value <<.value false>> and a list with at one (or more) entries to represent <<.value true>>.
|
||||
|
||||
The conditional operators are:
|
||||
|
||||
@ -19,10 +19,12 @@ The conditional operators are:
|
||||
|
||||
These operators can be combined. For example:
|
||||
|
||||
<<.inline-operator-example "[[New Tiddler]is[missing]then[I am missing]else[No I am not missing]]">>
|
||||
<<.operator-example 1 "[[New Tiddler]is[missing]then[I am missing]else[No I am not missing]]">>
|
||||
|
||||
The [[else Operator]] can be used to apply a defaults for missing values. In this example, we take advantage of the fact that the [[get Operator]] returns an empty list if the field or tiddler does not exist:
|
||||
The <<.olink else>> operator can be used to apply a defaults for missing values. In this example, we take advantage of the fact that the <<.olink get>> operator returns an empty list if the field or tiddler does not exist:
|
||||
|
||||
<<.inline-operator-example "[[HelloThere]get[custom-field]else[default-value]]">>
|
||||
<<.operator-example 2 "[[HelloThere]get[custom-field]else[default-value]]">>
|
||||
|
||||
<<list-links "[tag[Conditional Operators]]">>
|
||||
! Filter Run Prefixes
|
||||
|
||||
The [[:then|:then Filter Run Prefix]] and [[:else|:else Filter Run Prefix]] filter run prefixes serve a similar purpose as the conditional operators. Refer to their documentation for more information.
|
@ -1,7 +1,7 @@
|
||||
caption: deserialize
|
||||
created: 20230601195749377
|
||||
from-version: 5.3.0
|
||||
modified: 20230602105513132
|
||||
modified: 20230627094109762
|
||||
op-input: a selection of strings
|
||||
op-output: JSON representations of tiddlers extracted from input titles.
|
||||
op-parameter: the deserializer module to be used to extract tiddlers from the input
|
||||
@ -10,17 +10,8 @@ tags: [[Filter Operators]] [[Special Operators]]
|
||||
title: deserialize Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.tip "Deserializer modules parse text in various formats into their JSON representation as tiddlers. You can see the deserializers available in a wiki using the [[deserializers operator|deserializers Operator]].">>
|
||||
{{Deserializers}}
|
||||
|
||||
|
||||
|!Deserializer |!Description |
|
||||
|(DOM)|Extracts tiddlers from a DOM node, should not be used with the <<.op deserialize[]>> operator |
|
||||
|application/javascript|Parses a JavaScript module as a tiddler extracting fields from the header comment|
|
||||
|application/json|Parses [[JSON|JSON in TiddlyWiki]] into tiddlers|
|
||||
|application/x-tiddler|Parses the [[.tid file format|TiddlerFiles]] as a tiddler|
|
||||
|application/x-tiddler-html-div|Parses the [[<DIV>.tiddler file format|TiddlerFiles]] as a tiddler|
|
||||
|application/x-tiddlers|Parses the [[MultiTiddlerFile format|MultiTiddlerFiles]] as tiddlers|
|
||||
|text/css|Parses CSS as a tiddler extracting fields from the header comment|
|
||||
|text/html|Parses an HTML file into tiddlers. Supports ~TiddlyWiki Classic HTML files, ~TiddlyWiki5 HTML files and ordinary HTML files|
|
||||
|text/plain|Parses plain text as a tiddler|
|
||||
|
||||
<<.operator-examples "deserialize">>
|
@ -1,14 +1,14 @@
|
||||
caption: deserializers
|
||||
created: 20210506115203172
|
||||
from-version: 5.2.0
|
||||
modified: 20210506130322593
|
||||
modified: 20230627094238610
|
||||
op-input: ignored
|
||||
op-output: the title of each available deserializer
|
||||
op-parameter: none
|
||||
tags: [[Filter Operators]] [[Special Operators]] [[Selection Constructors]]
|
||||
tags: [[Filter Operators]] [[Special Operators]] [[Selection Constructors]]
|
||||
title: deserializers Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.tip "You can specify a specific deserializer for a DropzoneWidget to use">>
|
||||
<<.tip "You can specify a specific [[deserializer|Deserializers]] for a DropzoneWidget to use">>
|
||||
|
||||
<<.operator-examples "deserializers">>
|
||||
|
@ -0,0 +1,37 @@
|
||||
created: 20230614225302905
|
||||
modified: 20230614233448662
|
||||
tags: [[Operator Examples]] [[substitute Operator]]
|
||||
title: substitute Operator (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define time() morning
|
||||
\define field() modified
|
||||
\procedure sentence() This tiddler was last $(field)$ on ${[{!!modified}format:date[DDth MMM YYYY]]}$
|
||||
\define name() Bugs Bunny
|
||||
\define address() Rabbit Hole Hill
|
||||
|
||||
!Substitute <<.op substitute[]>> operator parameters
|
||||
<<.operator-example 1 "[[Hi, I'm $1$ and I live in $2$]substitute[Bugs Bunny],[Rabbit Hole Hill]]">>
|
||||
|
||||
!Substitute variables
|
||||
This example uses the following variables:
|
||||
|
||||
* name: <$codeblock code=<<name>>/>
|
||||
* address: <$codeblock code=<<address>>/>
|
||||
|
||||
<<.operator-example 2 "[[Hi, I'm $(name)$ and I live in $(address)$]substitute[]]">>
|
||||
|
||||
!Substitute variables and operator parameters
|
||||
This example uses the following variable:
|
||||
|
||||
* time: <$codeblock code=<<time>>/>
|
||||
|
||||
<<.operator-example 3 "[[Something in the $(time)$ at $2$ about $1$ ]substitute[Maths],[the Library]]">>
|
||||
|
||||
!Substitute a filter expression and a variable
|
||||
This example uses the following variables:
|
||||
|
||||
* field: <$codeblock code=<<field>>/>
|
||||
* sentence: <$codeblock code=<<sentence>>/>
|
||||
|
||||
<<.operator-example 4 "[<sentence>substitute[]]">>
|
27
editions/tw5.com/tiddlers/filters/substitute Operator.tid
Normal file
27
editions/tw5.com/tiddlers/filters/substitute Operator.tid
Normal file
@ -0,0 +1,27 @@
|
||||
caption: substitute
|
||||
created: 20230614223551834
|
||||
modified: 20230615173049692
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: the input titles with placeholders for filter expressions, parameter and variables replaced with their corresponding values
|
||||
op-parameter: the <<.op substitute>> operator optionally accepts a variable number of parameters, see below for details
|
||||
op-purpose: returns each item in the list, replacing within each title placeholders for filters, parameters and variables with their corresponding values
|
||||
tags: [[Filter Operators]] [[String Operators]]
|
||||
title: substitute Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.3.0">>
|
||||
|
||||
The <<.op substitute>> operator replaces any placeholders in the input titles in the following order:
|
||||
|
||||
# filter expressions
|
||||
# parameters to the <<.op substitute>> operator
|
||||
# variables
|
||||
|
||||
|placeholder syntax|description|h
|
||||
|`$n$`|Text substitution of a parameter provided to the operator, where n is the position of the parameter starting with 1 for the first parameter. Unmatched placeholders pass through unchanged. |
|
||||
|`$(varname)$`|Text substitution of a variable. Undefined variables are replaced with an empty string. |
|
||||
|`${ filter expression }$`|Text substitution of the first result of evaluating a filter expression. In other words, if the filter returns multiple titles only the first one will be used. |
|
||||
|
||||
<<.tip """Placeholders that contain square bracket characters are not valid filter syntax when used directly in a filter expression. However they can be provided as input to the <$macrocall $name=".op" _="substitute"/> operator as text references or variables""">>
|
||||
|
||||
<<.operator-examples "substitute">>
|
@ -0,0 +1,49 @@
|
||||
created: 20230617183745774
|
||||
modified: 20230617183745774
|
||||
tags: [[Then Filter Run Prefix]]
|
||||
title: Then Filter Run Prefix (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
||||
!! Conditional Execution
|
||||
|
||||
The <<.op :then>> filter run prefix can be used to avoid the need for nested [[ListWidget]]s or [[Macro Definitions in WikiText]].
|
||||
|
||||
<$macrocall $name='wikitext-example-without-html'
|
||||
src="""<$edit-text field="search" placeholder="Search title"/>
|
||||
|
||||
<$let searchTerm={{!!search}}>
|
||||
<$list filter="[<searchTerm>minlength[3]] :then[!is[system]search:title<searchTerm>]" template="$:/core/ui/ListItemTemplate"/>
|
||||
</$let>"""/>
|
||||
|
||||
|
||||
!! Conditional (Sub)Filters
|
||||
|
||||
The <<.op :then>> filter run prefix can be combined with the <<.op :else>> prefix to create conditional filters. In this example, the fields used in <<.var searchSubfilter>> for searching depend on the value of [[$:/temp/searchFields]] and the sort order used by <<.var sortSubfilter>> depends on the value of [[$:/temp/searchSort]]. Checkboxes are used to set the values of these tiddlers.
|
||||
|
||||
<<.tip "Note that each filter run of the subfilter receives the input of the <<.olink subfilter>> operator as input">>
|
||||
|
||||
Since the <<.olink then>> and <<.olink else>> operators cannot call subfilters or perform additional filter steps, they cannot be used for such applications.
|
||||
|
||||
<$macrocall $name='wikitext-example-without-html'
|
||||
src="""<$checkbox tiddler="$:/temp/searchSort"
|
||||
field="text"
|
||||
checked="chrono" unchecked="alpha" default="alpha">
|
||||
Sort chronologically (newest first)
|
||||
</$checkbox><br/>
|
||||
<$checkbox tiddler="$:/temp/searchFields"
|
||||
field="text"
|
||||
checked="title" unchecked="default" default="title">
|
||||
Search <<.field title>> only
|
||||
</$checkbox><p/>
|
||||
<$let searchSubfilter="[{$:/temp/searchFields}match[default]] :then[search[prefix]] :else[search:title[prefix]]"
|
||||
sortSubfilter="[{$:/temp/searchSort}match[chrono]] :then[!nsort[modified]] :else[sort[title]]"
|
||||
limit=10 >
|
||||
<$list filter="[all[tiddlers]!is[system]subfilter<searchSubfilter>subfilter<sortSubfilter>first<limit>]">
|
||||
<$link/> (<$text text={{{ [{!!modified}format:date[YYYY-0MM-0DD]] }}} />)<br/>
|
||||
</$list>
|
||||
<$list filter="[all[tiddlers]!is[system]subfilter<searchSubfilter>rest<limit>count[]]">
|
||||
... and <<currentTiddler>> more.
|
||||
</$list>
|
||||
</$let>"""/>
|
||||
|
@ -0,0 +1,71 @@
|
||||
created: 20210618133745003
|
||||
from-version: 5.3.0
|
||||
modified: 20230506172920710
|
||||
rp-input: <<.olink all>> tiddler titles
|
||||
rp-output: the output of this filter run replaces the output of previous runs unless it is an empty list (see below)
|
||||
rp-purpose: replace any input to this filter run with its output, only evaluating the run when there is any input
|
||||
search:
|
||||
tags: [[Filter Run Prefix]] [[Filter Syntax]]
|
||||
title: Then Filter Run Prefix
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define .op-row()
|
||||
<$macrocall $name=".if"
|
||||
cond="""$(op-body)$"""
|
||||
then="""<tr><th align="left">$(op-head)$</th><td><<.op-place>>$(op-body)$</td></tr>"""
|
||||
else=""/>
|
||||
\end
|
||||
|
||||
<$list filter="[all[current]has[from-version]]" variable="listItem">
|
||||
<$macrocall $name=".from-version" version={{!!from-version}}/>
|
||||
</$list>
|
||||
<$let op-head="" op-body="" op-name="">
|
||||
<table class="doc-table">
|
||||
<!-- purpose -->
|
||||
<$let op-head="purpose" op-body={{!!rp-purpose}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- input -->
|
||||
<$let op-head="[[input|Filter Expression]]" op-body={{!!rp-input}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- suffix -->
|
||||
<$let op-head="suffix" op-body={{!!rp-suffix}} op-name={{!!rp-suffix-name}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- output -->
|
||||
<$let op-head="output" op-body={{!!rp-output}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
</table>
|
||||
</$let>
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
":then"
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
!Introduction
|
||||
|
||||
The <<.op :then>> filter run prefix is used to replace the result of all previous filter runs with its output.
|
||||
|
||||
If the result of all previous runs is an empty list, the <<.op :then>> prefixed filter run is not evaluated.
|
||||
|
||||
If the output of a <<.op :then>> prefixed filter run is itself an empty list, the result of all previous filter runs is passed through unaltered.
|
||||
|
||||
<<.tip "Note that a list with a single empty string item is not an empty list.">>
|
||||
|
||||
|
||||
!! <<.op :then>> run prefix versus the <<.olink then>> operator
|
||||
|
||||
The major difference between the <<.op then>> operator and a <<.op :then>> prefixed filter run is that the operator will replace //each item// of the input [[Title List]] with its parameter while <<.op :then>> will replace the //whole input list// with the result of its run.
|
||||
|
||||
|doc-op-comparison tc-center|k
|
||||
| !<<.op :then>> Filter Run Prefix | !<<.op then>> Operator |
|
||||
|^<<.operator-example m1-1 "[tag[WikiText]] :then[[true]]">>|^<<.operator-example m1-2 "[tag[WikiText]then[true]]">><p>To make them equivalent, additional filter steps may be added:</p> <<.operator-example m1-3 "[tag[WikiText]count[]compare:number:gt[0]then[true]]">>|
|
||||
|
||||
|
||||
! [[Examples|Then Filter Run Prefix (Examples)]]
|
||||
|
@ -1,6 +1,6 @@
|
||||
caption: then
|
||||
created: 20190802112756430
|
||||
modified: 20190802113849579
|
||||
modified: 20230501174334627
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: the input titles with each one replaced by the string <<.place T>>
|
||||
op-parameter: a string
|
||||
@ -12,4 +12,6 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.1.20">> See [[Conditional Operators]] for an overview.
|
||||
|
||||
<<.tip "The [[Then Filter Run Prefix]] has a similar purpose to the <<.op then>> operator. See its documentation for a comparison of usage.">>
|
||||
|
||||
<<.operator-examples "then">>
|
||||
|
@ -1,6 +1,6 @@
|
||||
created: 20130822170200000
|
||||
list: [[A Gentle Guide to TiddlyWiki]] [[Discover TiddlyWiki]] [[Some of the things you can do with TiddlyWiki]] [[Ten reasons to switch to TiddlyWiki]] Examples [[What happened to the original TiddlyWiki?]]
|
||||
modified: 20230326083239710
|
||||
modified: 20230820112855583
|
||||
tags: TableOfContents
|
||||
title: HelloThere
|
||||
type: text/vnd.tiddlywiki
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user