mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-25 12:23:42 +00:00
Compare commits
3 Commits
barcode-re
...
core-icons
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
374a0fe56d | ||
|
|
06758183d3 | ||
|
|
46d323c902 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,5 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.c9/
|
.c9/
|
||||||
.vs/
|
|
||||||
.vscode/
|
.vscode/
|
||||||
tmp/
|
tmp/
|
||||||
output/
|
output/
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# Default to the current version number for building the plugin library
|
# Default to the current version number for building the plugin library
|
||||||
|
|
||||||
if [ -z "$TW5_BUILD_VERSION" ]; then
|
if [ -z "$TW5_BUILD_VERSION" ]; then
|
||||||
TW5_BUILD_VERSION=v5.3.2
|
TW5_BUILD_VERSION=v5.2.8
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
||||||
@@ -104,15 +104,13 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
--build favicon static index \
|
--build favicon static index \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
# /empty.html Empty
|
# /empty.html Empty
|
||||||
# /empty.hta For Internet Explorer
|
# /empty.hta For Internet Explorer
|
||||||
# /empty-external-core.html External core empty
|
|
||||||
# /tiddlywikicore-<version>.js Core plugin javascript
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/empty \
|
$TW5_BUILD_MAIN_EDITION \
|
||||||
--verbose \
|
--verbose \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--build empty emptyexternalcore \
|
--build empty \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
69
boot/boot.js
69
boot/boot.js
@@ -569,22 +569,10 @@ $tw.utils.getTypeEncoding = function(ext) {
|
|||||||
return typeInfo ? typeInfo.encoding : "utf8";
|
return typeInfo ? typeInfo.encoding : "utf8";
|
||||||
};
|
};
|
||||||
|
|
||||||
var globalCheck =[
|
|
||||||
" Object.defineProperty(Object.prototype, '__temp__', {",
|
|
||||||
" get: function () { return this; },",
|
|
||||||
" configurable: true",
|
|
||||||
" });",
|
|
||||||
" if(Object.keys(__temp__).length){",
|
|
||||||
" console.log(\"Warning: Global assignment detected\",Object.keys(__temp__));",
|
|
||||||
" delete Object.prototype.__temp__;",
|
|
||||||
" }",
|
|
||||||
" delete Object.prototype.__temp__;",
|
|
||||||
].join('\n');
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Run code globally with specified context variables in scope
|
Run code globally with specified context variables in scope
|
||||||
*/
|
*/
|
||||||
$tw.utils.evalGlobal = function(code,context,filename,sandbox,allowGlobals) {
|
$tw.utils.evalGlobal = function(code,context,filename) {
|
||||||
var contextCopy = $tw.utils.extend(Object.create(null),context);
|
var contextCopy = $tw.utils.extend(Object.create(null),context);
|
||||||
// Get the context variables as a pair of arrays of names and values
|
// Get the context variables as a pair of arrays of names and values
|
||||||
var contextNames = [], contextValues = [];
|
var contextNames = [], contextValues = [];
|
||||||
@@ -593,38 +581,25 @@ $tw.utils.evalGlobal = function(code,context,filename,sandbox,allowGlobals) {
|
|||||||
contextValues.push(value);
|
contextValues.push(value);
|
||||||
});
|
});
|
||||||
// Add the code prologue and epilogue
|
// Add the code prologue and epilogue
|
||||||
code = [
|
code = "(function(" + contextNames.join(",") + ") {(function(){\n" + code + "\n;})();\nreturn exports;\n})\n";
|
||||||
"(function(" + contextNames.join(",") + ") {",
|
|
||||||
" (function(){" + code + "\n;})();\n",
|
|
||||||
(!$tw.browser && sandbox && !allowGlobals) ? globalCheck : "",
|
|
||||||
"\nreturn exports;\n",
|
|
||||||
"})"
|
|
||||||
].join("");
|
|
||||||
|
|
||||||
// Compile the code into a function
|
// Compile the code into a function
|
||||||
var fn;
|
var fn;
|
||||||
if($tw.browser) {
|
if($tw.browser) {
|
||||||
fn = window["eval"](code + "\n\n//# sourceURL=" + filename);
|
fn = window["eval"](code + "\n\n//# sourceURL=" + filename);
|
||||||
} else {
|
} else {
|
||||||
if(sandbox){
|
fn = vm.runInThisContext(code,filename);
|
||||||
fn = vm.runInContext(code,sandbox,filename)
|
|
||||||
} else {
|
|
||||||
fn = vm.runInThisContext(code,filename);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Call the function and return the exports
|
// Call the function and return the exports
|
||||||
return fn.apply(null,contextValues);
|
return fn.apply(null,contextValues);
|
||||||
};
|
};
|
||||||
$tw.utils.sandbox = !$tw.browser ? vm.createContext({}) : undefined;
|
|
||||||
/*
|
/*
|
||||||
Run code in a sandbox with only the specified context variables in scope
|
Run code in a sandbox with only the specified context variables in scope
|
||||||
*/
|
*/
|
||||||
$tw.utils.evalSandboxed = $tw.browser ? $tw.utils.evalGlobal : function(code,context,filename,allowGlobals) {
|
$tw.utils.evalSandboxed = $tw.browser ? $tw.utils.evalGlobal : function(code,context,filename) {
|
||||||
return $tw.utils.evalGlobal(
|
var sandbox = $tw.utils.extend(Object.create(null),context);
|
||||||
code,context,filename,
|
vm.runInNewContext(code,sandbox,filename);
|
||||||
allowGlobals ? vm.createContext({}) : $tw.utils.sandbox,
|
return sandbox.exports;
|
||||||
allowGlobals
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -925,7 +900,7 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// line number should be included in e.stack for runtime errors
|
// line number should be included in e.stack for runtime errors
|
||||||
$tw.utils.error("Error executing boot module " + name + ": " + String(e) + "\n\n" + e.stack);
|
$tw.utils.error("Error executing boot module " + name + ": " + JSON.stringify(e) + "\n\n" + e.stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1149,7 +1124,7 @@ $tw.Wiki = function(options) {
|
|||||||
shadowTiddlerTitles = null,
|
shadowTiddlerTitles = null,
|
||||||
getShadowTiddlerTitles = function() {
|
getShadowTiddlerTitles = function() {
|
||||||
if(!shadowTiddlerTitles) {
|
if(!shadowTiddlerTitles) {
|
||||||
shadowTiddlerTitles = Object.keys(shadowTiddlers).sort(function(a,b) {return a.localeCompare(b);});
|
shadowTiddlerTitles = Object.keys(shadowTiddlers);
|
||||||
}
|
}
|
||||||
return shadowTiddlerTitles;
|
return shadowTiddlerTitles;
|
||||||
},
|
},
|
||||||
@@ -1945,7 +1920,7 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||||||
// Read the specification
|
// Read the specification
|
||||||
var filesInfo = $tw.utils.parseJSONSafe(fs.readFileSync(filepath + path.sep + "tiddlywiki.files","utf8"));
|
var filesInfo = $tw.utils.parseJSONSafe(fs.readFileSync(filepath + path.sep + "tiddlywiki.files","utf8"));
|
||||||
// Helper to process a file
|
// Helper to process a file
|
||||||
var processFile = function(filename,isTiddlerFile,fields,isEditableFile,rootPath) {
|
var processFile = function(filename,isTiddlerFile,fields,isEditableFile) {
|
||||||
var extInfo = $tw.config.fileExtensionInfo[path.extname(filename)],
|
var extInfo = $tw.config.fileExtensionInfo[path.extname(filename)],
|
||||||
type = (extInfo || {}).type || fields.type || "text/plain",
|
type = (extInfo || {}).type || fields.type || "text/plain",
|
||||||
typeInfo = $tw.config.contentTypeInfo[type] || {},
|
typeInfo = $tw.config.contentTypeInfo[type] || {},
|
||||||
@@ -1966,12 +1941,6 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||||||
} else {
|
} else {
|
||||||
var value = tiddler[name];
|
var value = tiddler[name];
|
||||||
switch(fieldInfo.source) {
|
switch(fieldInfo.source) {
|
||||||
case "subdirectories":
|
|
||||||
value = path.relative(rootPath, filename).split('/').slice(0, -1);
|
|
||||||
break;
|
|
||||||
case "filepath":
|
|
||||||
value = path.relative(rootPath, filename);
|
|
||||||
break;
|
|
||||||
case "filename":
|
case "filename":
|
||||||
value = path.basename(filename);
|
value = path.basename(filename);
|
||||||
break;
|
break;
|
||||||
@@ -2054,7 +2023,7 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||||||
var thisPath = path.relative(filepath, files[t]),
|
var thisPath = path.relative(filepath, files[t]),
|
||||||
filename = path.basename(thisPath);
|
filename = path.basename(thisPath);
|
||||||
if(filename !== "tiddlywiki.files" && !metaRegExp.test(filename) && fileRegExp.test(filename)) {
|
if(filename !== "tiddlywiki.files" && !metaRegExp.test(filename) && fileRegExp.test(filename)) {
|
||||||
processFile(thisPath,dirSpec.isTiddlerFile,dirSpec.fields,dirSpec.isEditableFile,dirSpec.path);
|
processFile(thisPath,dirSpec.isTiddlerFile,dirSpec.fields,dirSpec.isEditableFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2079,11 +2048,7 @@ $tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
|||||||
console.log("Warning: missing plugin.info file in " + filepath);
|
console.log("Warning: missing plugin.info file in " + filepath);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var pluginInfo = $tw.utils.parseJSONSafe(fs.readFileSync(infoPath,"utf8"),function() {return null;});
|
var pluginInfo = $tw.utils.parseJSONSafe(fs.readFileSync(infoPath,"utf8"));
|
||||||
if(!pluginInfo) {
|
|
||||||
console.log("warning: invalid JSON in plugin.info file at " + infoPath);
|
|
||||||
pluginInfo = {};
|
|
||||||
}
|
|
||||||
// Read the plugin files
|
// Read the plugin files
|
||||||
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
|
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
|
||||||
// Save the plugin tiddlers into the plugin info
|
// Save the plugin tiddlers into the plugin info
|
||||||
@@ -2200,11 +2165,7 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
|||||||
pluginFields;
|
pluginFields;
|
||||||
// Bail if we don't have a wiki info file
|
// Bail if we don't have a wiki info file
|
||||||
if(fs.existsSync(wikiInfoPath)) {
|
if(fs.existsSync(wikiInfoPath)) {
|
||||||
wikiInfo = $tw.utils.parseJSONSafe(fs.readFileSync(wikiInfoPath,"utf8"),function() {return null;});
|
wikiInfo = $tw.utils.parseJSONSafe(fs.readFileSync(wikiInfoPath,"utf8"));
|
||||||
if(!wikiInfo) {
|
|
||||||
console.log("warning: invalid JSON in tiddlywiki.info file at " + wikiInfoPath);
|
|
||||||
wikiInfo = {};
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -2447,7 +2408,7 @@ $tw.boot.initStartup = function(options) {
|
|||||||
$tw.utils.registerFileType("video/webm","base64",".webm");
|
$tw.utils.registerFileType("video/webm","base64",".webm");
|
||||||
$tw.utils.registerFileType("video/mp4","base64",".mp4");
|
$tw.utils.registerFileType("video/mp4","base64",".mp4");
|
||||||
$tw.utils.registerFileType("audio/mp3","base64",".mp3");
|
$tw.utils.registerFileType("audio/mp3","base64",".mp3");
|
||||||
$tw.utils.registerFileType("audio/mpeg","base64",[".mp3",".m2a",".mp2",".mpa",".mpg",".mpga"]);
|
$tw.utils.registerFileType("audio/mpeg","base64");
|
||||||
$tw.utils.registerFileType("text/markdown","utf8",[".md",".markdown"],{deserializerType:"text/x-markdown"});
|
$tw.utils.registerFileType("text/markdown","utf8",[".md",".markdown"],{deserializerType:"text/x-markdown"});
|
||||||
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
|
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
|
||||||
$tw.utils.registerFileType("application/enex+xml","utf8",".enex");
|
$tw.utils.registerFileType("application/enex+xml","utf8",".enex");
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ title: $:/Acknowledgements
|
|||||||
TiddlyWiki incorporates code from these fine OpenSource projects:
|
TiddlyWiki incorporates code from these fine OpenSource projects:
|
||||||
|
|
||||||
* [[The Stanford Javascript Crypto Library|http://bitwiseshiftleft.github.io/sjcl/]]
|
* [[The Stanford Javascript Crypto Library|http://bitwiseshiftleft.github.io/sjcl/]]
|
||||||
* [[The Jasmine JavaScript Test Framework|https://jasmine.github.io/]]
|
* [[The Jasmine JavaScript Test Framework|http://pivotal.github.io/jasmine/]]
|
||||||
* [[Normalize.css by Nicolas Gallagher|http://necolas.github.io/normalize.css/]]
|
* [[Normalize.css by Nicolas Gallagher|http://necolas.github.io/normalize.css/]]
|
||||||
|
|
||||||
And media from these projects:
|
And media from these projects:
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
title: $:/core/images/network-activity
|
|
||||||
tags: $:/tags/Image
|
|
||||||
|
|
||||||
<svg width="22pt" height="22pt" class="tc-image-network-activity tc-image-button" viewBox="0 0 128 128"><g class={{{ [{$:/state/http-requests}match[0]then[]else[tc-network-activity-background]] }}}>
|
|
||||||
<$list filter="[{$:/state/http-requests}match[0]]" variable="ignore">
|
|
||||||
<path d="M64.043 45.153a4.002 4.002 0 0 1 4.367 2.21l.084.188 30.403 73.4a4 4 0 0 1-7.307 3.25l-.084-.188-3.103-7.49-8.898 8.899a3.985 3.985 0 0 1-2.624 1.166l-.205.005a3.987 3.987 0 0 1-2.828-1.171l-9.849-9.848-9.847 9.848a3.985 3.985 0 0 1-2.624 1.166l-.204.005a3.987 3.987 0 0 1-2.829-1.171l-8.899-8.9-3.102 7.491a4 4 0 1 1-7.391-3.062l30.403-73.4a4.001 4.001 0 0 1 4.495-2.39l.042-.008Zm13.636 56.74-8.023 8.024 7.02 7.019 8.023-8.022-7.02-7.02Zm-27.353.008-7.019 7.019 8.016 8.016 7.019-7.02-8.016-8.015Zm13.68-13.68-8.023 8.023 8.016 8.016 8.023-8.023-8.016-8.016Zm-8.971-8.971-4.687 11.315 8.001-8.001-3.314-3.314Zm17.933.009-3.305 3.305 7.979 7.979-4.674-11.284ZM64 57.607l-5.666 13.68c.096.072.188.15.278.232l.133.126 5.261 5.262 5.262-5.262c.128-.127.261-.244.4-.35L64 57.607Zm0-34.69a8 8 0 1 1 0 16 8 8 0 0 1 0-16Z"/>
|
|
||||||
</$list>
|
|
||||||
<$list filter="[{$:/state/http-requests}!match[0]]" variable="ignore">
|
|
||||||
<path d="M109.395.952a4.002 4.002 0 0 1 3.787 2.708C117.529 11.62 120 20.753 120 30.462c0 15.186-6.044 28.96-15.858 39.047a4 4 0 1 1-6.47-4.626l-.12-.094C106.466 56.074 112 43.914 112 30.462c0-8.492-2.205-16.469-6.074-23.39l.054-.036a4 4 0 0 1 3.415-6.084Zm-90.762 0a4 4 0 0 1 3.072 6.562l.093.06A47.786 47.786 0 0 0 16 30.463c0 13.315 5.42 25.363 14.176 34.058l-.01.007a4 4 0 1 1-6.312 4.863l-.063.05C14.017 59.359 8 45.613 8 30.462c0-9.77 2.502-18.956 6.9-26.952A4.002 4.002 0 0 1 18.634.952Z"/><path d="M64.043 44.698a4.002 4.002 0 0 1 4.367 2.21l.084.188 30.403 73.4a4 4 0 0 1-7.307 3.25l-.084-.188-3.103-7.49-8.898 8.9a3.985 3.985 0 0 1-2.624 1.166l-.205.005a3.987 3.987 0 0 1-2.828-1.172l-9.849-9.848-9.847 9.848a3.985 3.985 0 0 1-2.624 1.167l-.204.005a3.987 3.987 0 0 1-2.829-1.172l-8.899-8.899-3.102 7.49a4 4 0 0 1-7.391-3.061l30.403-73.4a4.001 4.001 0 0 1 4.495-2.39l.042-.009ZM77.68 101.44l-8.023 8.023 7.02 7.019 8.023-8.022-7.02-7.02Zm-27.353.007-7.019 7.019 8.016 8.016 7.019-7.019-8.016-8.016Zm13.68-13.68-8.023 8.023 8.016 8.016 8.023-8.023-8.016-8.016Zm-8.971-8.971L50.348 90.11l8.001-8.001-3.314-3.314Zm17.933.009-3.305 3.305 7.979 7.979-4.674-11.284ZM64 57.152l-5.666 13.68c.096.073.188.15.278.232l.133.127 5.261 5.261 5.262-5.261c.128-.128.261-.244.4-.351L64 57.152ZM38.503 1.058a4 4 0 0 1 2.7 6.952l.17-.175C35.582 13.625 32 21.625 32 30.462c0 8.838 3.582 16.838 9.374 22.629a4 4 0 0 1-5.659 5.658l-.01.01C28.473 51.52 24 41.526 24 30.485 24 19.567 28.374 9.67 35.466 2.453a3.995 3.995 0 0 1 3.037-1.395ZM89.369.952c1.14 0 2.17.478 2.899 1.244l.005-.006C99.518 9.43 104 19.434 104 30.485c0 10.826-4.3 20.648-11.287 27.85a4 4 0 1 1-6.054-5.213l-.032-.032C92.418 47.299 96 39.299 96 30.462c0-8.73-3.496-16.643-9.164-22.416A4 4 0 0 1 89.368.952Zm-39.282 11.14a4 4 0 0 1 2.59 7.048l.01.009A15.95 15.95 0 0 0 48 30.462a15.95 15.95 0 0 0 4.687 11.315l-.01.01a4 4 0 1 1-5.82 5.47l.173.177A23.925 23.925 0 0 1 40 30.462a23.925 23.925 0 0 1 7.03-16.97l.01.01a3.991 3.991 0 0 1 3.047-1.41Zm27.895.07a3.99 3.99 0 0 1 2.984 1.336l.006-.005A23.925 23.925 0 0 1 88 30.463a23.92 23.92 0 0 1-6.707 16.642l-.3.305a4 4 0 1 1-5.679-5.632v-.002A15.95 15.95 0 0 0 80 30.462a15.95 15.95 0 0 0-4.685-11.312 4.012 4.012 0 0 1-1.333-2.987 4 4 0 0 1 4-4ZM64 22.463a8 8 0 1 1 0 16 8 8 0 0 1 0-16Z"/>
|
|
||||||
</$list>
|
|
||||||
</g></svg>
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
title: $:/core/images/new-journal-button
|
title: $:/core/images/new-journal-button
|
||||||
tags: $:/tags/Image
|
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>
|
||||||
@@ -67,8 +67,6 @@ More/Caption: more
|
|||||||
More/Hint: More actions
|
More/Hint: More actions
|
||||||
NewHere/Caption: new here
|
NewHere/Caption: new here
|
||||||
NewHere/Hint: Create a new tiddler tagged with this one
|
NewHere/Hint: Create a new tiddler tagged with this one
|
||||||
NetworkActivity/Caption: network activity
|
|
||||||
NetworkActivity/Hint: Cancel all network activity
|
|
||||||
NewJournal/Caption: new journal
|
NewJournal/Caption: new journal
|
||||||
NewJournal/Hint: Create a new journal tiddler
|
NewJournal/Hint: Create a new journal tiddler
|
||||||
NewJournalHere/Caption: new journal here
|
NewJournalHere/Caption: new journal here
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ All parameters are optional with safe defaults, and can be specified in any orde
|
|||||||
* ''anon-username'' - the username for signing edits for anonymous users
|
* ''anon-username'' - the username for signing edits for anonymous users
|
||||||
* ''username'' - optional username for basic authentication
|
* ''username'' - optional username for basic authentication
|
||||||
* ''password'' - optional password for basic authentication
|
* ''password'' - optional password for basic authentication
|
||||||
* ''authenticated-user-header'' - optional name of request header to be used for trusted authentication.
|
* ''authenticated-user-header'' - optional name of header to be used for trusted authentication
|
||||||
* ''readers'' - comma-separated list of principals allowed to read from this wiki
|
* ''readers'' - comma-separated list of principals allowed to read from this wiki
|
||||||
* ''writers'' - comma-separated list of principals allowed to write to this wiki
|
* ''writers'' - comma-separated list of principals allowed to write to this wiki
|
||||||
* ''csrf-disable'' - set to "yes" to disable CSRF checks (defaults to "no")
|
* ''csrf-disable'' - set to "yes" to disable CSRF checks (defaults to "no")
|
||||||
|
|||||||
@@ -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:
|
<<.from-version "5.1.20">> Saves the current wiki as a wiki folder, including tiddlers, plugins and configuration:
|
||||||
|
|
||||||
```
|
```
|
||||||
--savewikifolder <wikifolderpath> [<filter>] [ [<name>=<value>] ]*
|
--savewikifolder <wikifolderpath> [<filter>]
|
||||||
```
|
```
|
||||||
|
|
||||||
* The target wiki folder must be empty or non-existent
|
* The target wiki folder must be empty or non-existent
|
||||||
@@ -12,23 +12,8 @@ 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
|
* 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
|
* 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:
|
A common usage is to convert a TiddlyWiki HTML file into a wiki folder:
|
||||||
|
|
||||||
```
|
```
|
||||||
tiddlywiki --load ./mywiki.html --savewikifolder ./mywikifolder
|
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
|
title: $:/language/Help/server
|
||||||
description: (deprecated: see 'listen' command) Provides an HTTP server interface to TiddlyWiki
|
description: Provides an HTTP server interface to TiddlyWiki (deprecated in favour of the new listen command)
|
||||||
|
|
||||||
Legacy command to serve a wiki over HTTP.
|
Legacy command to serve a wiki over HTTP.
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ Encryption/RepeatPassword: Repeat password
|
|||||||
Encryption/PasswordNoMatch: Passwords do not match
|
Encryption/PasswordNoMatch: Passwords do not match
|
||||||
Encryption/SetPassword: Set password
|
Encryption/SetPassword: Set password
|
||||||
Error/Caption: Error
|
Error/Caption: Error
|
||||||
Error/DeserializeOperator/MissingOperand: Filter Error: Missing operand for 'deserialize' operator
|
|
||||||
Error/DeserializeOperator/UnknownDeserializer: Filter Error: Unknown deserializer provided as operand for the 'deserialize' operator
|
|
||||||
Error/Filter: Filter error
|
Error/Filter: Filter error
|
||||||
Error/FilterSyntax: Syntax error in filter expression
|
Error/FilterSyntax: Syntax error in filter expression
|
||||||
Error/FilterRunPrefix: Filter Error: Unknown prefix for filter run
|
Error/FilterRunPrefix: Filter Error: Unknown prefix for filter run
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
title: $:/SiteTitle
|
title: $:/SiteTitle
|
||||||
|
|
||||||
My TiddlyWiki
|
My ~TiddlyWiki
|
||||||
@@ -5,14 +5,7 @@ module-type: command
|
|||||||
|
|
||||||
Command to save the current wiki as a wiki folder
|
Command to save the current wiki as a wiki folder
|
||||||
|
|
||||||
--savewikifolder <wikifolderpath> [ [<name>=<value>] ]*
|
--savewikifolder <wikifolderpath> [<filter>]
|
||||||
|
|
||||||
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(){
|
(function(){
|
||||||
@@ -42,28 +35,14 @@ Command.prototype.execute = function() {
|
|||||||
if(this.params.length < 1) {
|
if(this.params.length < 1) {
|
||||||
return "Missing wiki folder path";
|
return "Missing wiki folder path";
|
||||||
}
|
}
|
||||||
var regFilter = /^[a-zA-Z0-9\.\-_]+=/g, // dynamic parameters
|
var wikifoldermaker = new WikiFolderMaker(this.params[0],this.params[1],this.commander);
|
||||||
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();
|
return wikifoldermaker.save();
|
||||||
};
|
};
|
||||||
|
|
||||||
function WikiFolderMaker(wikiFolderPath,wikiFilter,commander,options) {
|
function WikiFolderMaker(wikiFolderPath,wikiFilter,commander) {
|
||||||
this.wikiFolderPath = wikiFolderPath;
|
this.wikiFolderPath = wikiFolderPath;
|
||||||
this.wikiFilter = wikiFilter;
|
this.wikiFilter = wikiFilter || "[all[tiddlers]]";
|
||||||
this.commander = commander;
|
this.commander = commander;
|
||||||
this.explodePlugins = options.explodePlugins;
|
|
||||||
this.wiki = commander.wiki;
|
this.wiki = commander.wiki;
|
||||||
this.savedPaths = []; // So that we can detect filename clashes
|
this.savedPaths = []; // So that we can detect filename clashes
|
||||||
}
|
}
|
||||||
@@ -114,13 +93,10 @@ WikiFolderMaker.prototype.save = function() {
|
|||||||
self.log("Adding built-in plugin: " + libraryDetails.name);
|
self.log("Adding built-in plugin: " + libraryDetails.name);
|
||||||
newWikiInfo[libraryDetails.type] = newWikiInfo[libraryDetails.type] || [];
|
newWikiInfo[libraryDetails.type] = newWikiInfo[libraryDetails.type] || [];
|
||||||
$tw.utils.pushTop(newWikiInfo[libraryDetails.type],libraryDetails.name);
|
$tw.utils.pushTop(newWikiInfo[libraryDetails.type],libraryDetails.name);
|
||||||
} else if(self.explodePlugins !== "no") {
|
} else {
|
||||||
// A custom plugin
|
// A custom plugin
|
||||||
self.log("Processing custom plugin: " + title);
|
self.log("Processing custom plugin: " + title);
|
||||||
self.saveCustomPlugin(tiddler);
|
self.saveCustomPlugin(tiddler);
|
||||||
} else if(self.explodePlugins === "no") {
|
|
||||||
self.log("Processing custom plugin to tiddlders folder: " + title);
|
|
||||||
self.saveTiddler("tiddlers", tiddler);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Ordinary tiddler
|
// Ordinary tiddler
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ function FramedEngine(options) {
|
|||||||
this.domNode.value = this.value;
|
this.domNode.value = this.value;
|
||||||
}
|
}
|
||||||
// Set the attributes
|
// Set the attributes
|
||||||
if(this.widget.editType && this.widget.editTag !== "textarea") {
|
if(this.widget.editType) {
|
||||||
this.domNode.setAttribute("type",this.widget.editType);
|
this.domNode.setAttribute("type",this.widget.editType);
|
||||||
}
|
}
|
||||||
if(this.widget.editPlaceholder) {
|
if(this.widget.editPlaceholder) {
|
||||||
@@ -118,8 +118,6 @@ FramedEngine.prototype.copyStyles = function() {
|
|||||||
this.domNode.style.margin = "0";
|
this.domNode.style.margin = "0";
|
||||||
// In Chrome setting -webkit-text-fill-color overrides the placeholder text colour
|
// In Chrome setting -webkit-text-fill-color overrides the placeholder text colour
|
||||||
this.domNode.style["-webkit-text-fill-color"] = "currentcolor";
|
this.domNode.style["-webkit-text-fill-color"] = "currentcolor";
|
||||||
// Ensure we don't force text direction to LTR
|
|
||||||
this.domNode.style.removeProperty("direction");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function SimpleEngine(options) {
|
|||||||
this.domNode.value = this.value;
|
this.domNode.value = this.value;
|
||||||
}
|
}
|
||||||
// Set the attributes
|
// Set the attributes
|
||||||
if(this.widget.editType && this.widget.editTag !== "textarea") {
|
if(this.widget.editType) {
|
||||||
this.domNode.setAttribute("type",this.widget.editType);
|
this.domNode.setAttribute("type",this.widget.editType);
|
||||||
}
|
}
|
||||||
if(this.widget.editPlaceholder) {
|
if(this.widget.editPlaceholder) {
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
/*\
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -12,8 +12,6 @@ Adds tiddler filtering methods to the $tw.Wiki object.
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var widgetClass = require("$:/core/modules/widgets/widget.js").widget;
|
|
||||||
|
|
||||||
/* Maximum permitted filter recursion depth */
|
/* Maximum permitted filter recursion depth */
|
||||||
var MAX_FILTER_DEPTH = 300;
|
var MAX_FILTER_DEPTH = 300;
|
||||||
|
|
||||||
@@ -271,7 +269,7 @@ exports.compileFilter = function(filterString) {
|
|||||||
operand.value = self.getTextReference(operand.text,"",currTiddlerTitle);
|
operand.value = self.getTextReference(operand.text,"",currTiddlerTitle);
|
||||||
} else if(operand.variable) {
|
} else if(operand.variable) {
|
||||||
var varTree = $tw.utils.parseFilterVariable(operand.text);
|
var varTree = $tw.utils.parseFilterVariable(operand.text);
|
||||||
operand.value = widgetClass.evaluateVariable(widget,varTree.name,{params: varTree.params, source: source})[0] || "";
|
operand.value = widget.evaluateVariable(varTree.name,{params: varTree.params, source: source})[0] || "";
|
||||||
} else {
|
} else {
|
||||||
operand.value = operand.text;
|
operand.value = operand.text;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/deserialize.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filteroperator
|
|
||||||
Filter operator for deserializing string data into JSON representing tiddlers
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
exports["deserialize"] = function(source,operator,options) {
|
|
||||||
var results = [],
|
|
||||||
deserializer;
|
|
||||||
if(operator.operand) {
|
|
||||||
// Get the deserializer identified by the operand
|
|
||||||
deserializer = $tw.Wiki.tiddlerDeserializerModules[operator.operand];
|
|
||||||
if(deserializer) {
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
var tiddlers;
|
|
||||||
try {
|
|
||||||
tiddlers = deserializer(title);
|
|
||||||
} catch(e) {
|
|
||||||
// Return an empty array if we could not extract any tiddlers
|
|
||||||
tiddlers = [];
|
|
||||||
}
|
|
||||||
results.push(JSON.stringify(tiddlers));
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return [$tw.language.getString("Error/DeserializeOperator/UnknownDeserializer")];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return [$tw.language.getString("Error/DeserializeOperator/MissingOperand")];
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/format/timestamp.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: formatfilteroperator
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter function
|
|
||||||
*/
|
|
||||||
exports.timestamp = function(source,operand,options) {
|
|
||||||
var results = [];
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
if (title.match(/^-?\d+$/)) {
|
|
||||||
var value = new Date(Number(title));
|
|
||||||
results.push($tw.utils.formatDateString(value,operand || "[UTC]YYYY0MM0DD0hh0mm0ss0XXX"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
@@ -17,13 +17,9 @@ Export our filter function
|
|||||||
*/
|
*/
|
||||||
exports.function = function(source,operator,options) {
|
exports.function = function(source,operator,options) {
|
||||||
var functionName = operator.operands[0],
|
var functionName = operator.operands[0],
|
||||||
params = [];
|
variableInfo = options.widget && options.widget.getVariableInfo && options.widget.getVariableInfo(functionName);
|
||||||
$tw.utils.each(operator.operands.slice(1),function(param) {
|
|
||||||
params.push({value: param});
|
|
||||||
});
|
|
||||||
var variableInfo = options.widget && options.widget.getVariableInfo && options.widget.getVariableInfo(functionName,{params: params, source: source});
|
|
||||||
if(variableInfo && variableInfo.srcVariable && variableInfo.srcVariable.isFunctionDefinition) {
|
if(variableInfo && variableInfo.srcVariable && variableInfo.srcVariable.isFunctionDefinition) {
|
||||||
return variableInfo.resultList ? variableInfo.resultList : [variableInfo.text];
|
return options.widget.evaluateVariable(functionName,{params: operator.operands.slice(1), source: source});
|
||||||
}
|
}
|
||||||
// Return the input list if the function wasn't found
|
// Return the input list if the function wasn't found
|
||||||
var results = [];
|
var results = [];
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
/*\
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
|
|
||||||
@@ -21,14 +21,10 @@ Export our filter function
|
|||||||
*/
|
*/
|
||||||
exports["[unknown]"] = function(source,operator,options) {
|
exports["[unknown]"] = function(source,operator,options) {
|
||||||
// Check for a user defined filter operator
|
// Check for a user defined filter operator
|
||||||
if(operator.operator.indexOf(".") !== -1) {
|
if(operator.operator.charAt(0) === ".") {
|
||||||
var params = [];
|
var variableInfo = options.widget && options.widget.getVariableInfo && options.widget.getVariableInfo(operator.operator);
|
||||||
$tw.utils.each(operator.operands,function(param) {
|
if(variableInfo && variableInfo.srcVariable && variableInfo.srcVariable.isFunctionDefinition) {
|
||||||
params.push({value: param});
|
var list = options.widget.evaluateVariable(operator.operator,{params: operator.operands, source: source});
|
||||||
});
|
|
||||||
var variableInfo = options.widget && options.widget.getVariableInfo && options.widget.getVariableInfo(operator.operator,{params: params, source: source});
|
|
||||||
if(variableInfo && variableInfo.srcVariable) {
|
|
||||||
var list = variableInfo.resultList ? variableInfo.resultList : [variableInfo.text];
|
|
||||||
if(operator.prefix === "!") {
|
if(operator.prefix === "!") {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
|
|||||||
@@ -305,11 +305,10 @@ exports.parseAttribute = function(source,pos) {
|
|||||||
start: pos
|
start: pos
|
||||||
};
|
};
|
||||||
// Define our regexps
|
// Define our regexps
|
||||||
var reAttributeName = /([^\/\s>"'`=]+)/g,
|
var reAttributeName = /([^\/\s>"'=]+)/g,
|
||||||
reUnquotedAttribute = /([^\/\s<>"'`=]+)/g,
|
reUnquotedAttribute = /([^\/\s<>"'=]+)/g,
|
||||||
reFilteredValue = /\{\{\{([\S\s]+?)\}\}\}/g,
|
reFilteredValue = /\{\{\{([\S\s]+?)\}\}\}/g,
|
||||||
reIndirectValue = /\{\{([^\}]+)\}\}/g,
|
reIndirectValue = /\{\{([^\}]+)\}\}/g;
|
||||||
reSubstitutedValue = /(?:```([\s\S]*?)```|`([^`]|[\S\s]*?)`)/g;
|
|
||||||
// Skip whitespace
|
// Skip whitespace
|
||||||
pos = $tw.utils.skipWhiteSpace(source,pos);
|
pos = $tw.utils.skipWhiteSpace(source,pos);
|
||||||
// Get the attribute name
|
// Get the attribute name
|
||||||
@@ -362,15 +361,8 @@ exports.parseAttribute = function(source,pos) {
|
|||||||
node.type = "macro";
|
node.type = "macro";
|
||||||
node.value = macroInvocation;
|
node.value = macroInvocation;
|
||||||
} else {
|
} else {
|
||||||
var substitutedValue = $tw.utils.parseTokenRegExp(source,pos,reSubstitutedValue);
|
node.type = "string";
|
||||||
if(substitutedValue) {
|
node.value = "true";
|
||||||
pos = substitutedValue.end;
|
|
||||||
node.type = "substituted";
|
|
||||||
node.rawValue = substitutedValue.match[1] || substitutedValue.match[2];
|
|
||||||
} else {
|
|
||||||
node.type = "string";
|
|
||||||
node.value = "true";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ Instantiate parse rule
|
|||||||
exports.init = function(parser) {
|
exports.init = function(parser) {
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
// Regexp to match
|
// 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;
|
var reEnd;
|
||||||
if(this.match[5]) {
|
if(this.match[5]) {
|
||||||
// If so, the end of the body is marked with \end
|
// If so, the end of the body is marked with \end
|
||||||
reEnd = new RegExp("(\\r?\\n[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
reEnd = new RegExp("(\\r?\\n\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, the end of the definition is marked by the end of the line
|
// Otherwise, the end of the definition is marked by the end of the line
|
||||||
reEnd = /($|\r?\n)/mg;
|
reEnd = /($|\r?\n)/mg;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ exports.parseTag = function(source,pos,options) {
|
|||||||
orderedAttributes: []
|
orderedAttributes: []
|
||||||
};
|
};
|
||||||
// Define our regexps
|
// Define our regexps
|
||||||
var reTagName = /([a-zA-Z0-9\-\$\.]+)/g;
|
var reTagName = /([a-zA-Z0-9\-\$]+)/g;
|
||||||
// Skip whitespace
|
// Skip whitespace
|
||||||
pos = $tw.utils.skipWhiteSpace(source,pos);
|
pos = $tw.utils.skipWhiteSpace(source,pos);
|
||||||
// Look for a less than sign
|
// Look for a less than sign
|
||||||
@@ -138,7 +138,7 @@ exports.parseTag = function(source,pos,options) {
|
|||||||
|
|
||||||
exports.findNextTag = function(source,pos,options) {
|
exports.findNextTag = function(source,pos,options) {
|
||||||
// A regexp for finding candidate HTML tags
|
// A regexp for finding candidate HTML tags
|
||||||
var reLookahead = /<([a-zA-Z\-\$\.]+)/g;
|
var reLookahead = /<([a-zA-Z\-\$]+)/g;
|
||||||
// Find the next candidate
|
// Find the next candidate
|
||||||
reLookahead.lastIndex = pos;
|
reLookahead.lastIndex = pos;
|
||||||
var match = reLookahead.exec(source);
|
var match = reLookahead.exec(source);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ Instantiate parse rule
|
|||||||
exports.init = function(parser) {
|
exports.init = function(parser) {
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
// Regexp to match
|
// Regexp to match
|
||||||
this.matchRegExp = /\\parameters\s*\(([^)]*)\)(\s*\r?\n)?/mg;
|
this.matchRegExp = /^\\parameters\s*\(([^)]*)\)\s*\r?\n/mg;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/parsers/wikiparser/rules/wikilinkprefix.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: wikirule
|
|
||||||
|
|
||||||
Wiki text inline rule for suppressed wiki links. For example:
|
|
||||||
|
|
||||||
```
|
|
||||||
~SuppressedLink
|
|
||||||
```
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
exports.name = "wikilinkprefix";
|
|
||||||
exports.types = {inline: true};
|
|
||||||
|
|
||||||
exports.init = function(parser) {
|
|
||||||
this.parser = parser;
|
|
||||||
// Regexp to match
|
|
||||||
this.matchRegExp = new RegExp($tw.config.textPrimitives.unWikiLink + $tw.config.textPrimitives.wikiLink,"mg");
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Parse the most recent match
|
|
||||||
*/
|
|
||||||
exports.parse = function() {
|
|
||||||
// Get the details of the match
|
|
||||||
var linkText = this.match[0];
|
|
||||||
// Move past the wikilink
|
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
|
||||||
// Return the link without unwikilink character as plain text
|
|
||||||
return [{type: "text", text: linkText.substr(1)}];
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -37,7 +37,7 @@ HeaderAuthenticator.prototype.authenticateRequest = function(request,response,st
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// authenticatedUsername will be undefined for anonymous users
|
// authenticatedUsername will be undefined for anonymous users
|
||||||
state.authenticatedUsername = $tw.utils.decodeURIComponentSafe(username);
|
state.authenticatedUsername = username;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ Startup logic concerned with managing plugins
|
|||||||
// Export name and synchronous status
|
// Export name and synchronous status
|
||||||
exports.name = "plugins";
|
exports.name = "plugins";
|
||||||
exports.after = ["load-modules"];
|
exports.after = ["load-modules"];
|
||||||
exports.before = ["startup"];
|
|
||||||
exports.synchronous = true;
|
exports.synchronous = true;
|
||||||
|
|
||||||
var TITLE_REQUIRE_RELOAD_DUE_TO_PLUGIN_CHANGE = "$:/status/RequireReloadDueToPluginChange";
|
var TITLE_REQUIRE_RELOAD_DUE_TO_PLUGIN_CHANGE = "$:/status/RequireReloadDueToPluginChange";
|
||||||
|
|||||||
@@ -20,39 +20,6 @@ exports.before = ["story"];
|
|||||||
exports.synchronous = true;
|
exports.synchronous = true;
|
||||||
|
|
||||||
exports.startup = function() {
|
exports.startup = function() {
|
||||||
// Install the HTTP client event handler
|
|
||||||
$tw.httpClient = new $tw.utils.HttpClient();
|
|
||||||
var getPropertiesWithPrefix = function(properties,prefix) {
|
|
||||||
var result = Object.create(null);
|
|
||||||
$tw.utils.each(properties,function(value,name) {
|
|
||||||
if(name.indexOf(prefix) === 0) {
|
|
||||||
result[name.substring(prefix.length)] = properties[name];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
$tw.rootWidget.addEventListener("tm-http-request",function(event) {
|
|
||||||
var params = event.paramObject || {};
|
|
||||||
$tw.httpClient.initiateHttpRequest({
|
|
||||||
wiki: event.widget.wiki,
|
|
||||||
url: params.url,
|
|
||||||
method: params.method,
|
|
||||||
body: params.body,
|
|
||||||
binary: params.binary,
|
|
||||||
oncompletion: params.oncompletion,
|
|
||||||
onprogress: params.onprogress,
|
|
||||||
bindStatus: params["bind-status"],
|
|
||||||
bindProgress: params["bind-progress"],
|
|
||||||
variables: getPropertiesWithPrefix(params,"var-"),
|
|
||||||
headers: getPropertiesWithPrefix(params,"header-"),
|
|
||||||
passwordHeaders: getPropertiesWithPrefix(params,"password-header-"),
|
|
||||||
queryStrings: getPropertiesWithPrefix(params,"query-"),
|
|
||||||
passwordQueryStrings: getPropertiesWithPrefix(params,"password-query-")
|
|
||||||
});
|
|
||||||
});
|
|
||||||
$tw.rootWidget.addEventListener("tm-http-cancel-all-requests",function(event) {
|
|
||||||
$tw.httpClient.cancelAllHttpRequests();
|
|
||||||
});
|
|
||||||
// Install the modal message mechanism
|
// Install the modal message mechanism
|
||||||
$tw.modal = new $tw.utils.Modal($tw.wiki);
|
$tw.modal = new $tw.utils.Modal($tw.wiki);
|
||||||
$tw.rootWidget.addEventListener("tm-modal",function(event) {
|
$tw.rootWidget.addEventListener("tm-modal",function(event) {
|
||||||
@@ -74,8 +41,12 @@ exports.startup = function() {
|
|||||||
$tw.rootWidget.addEventListener("tm-focus-selector",function(event) {
|
$tw.rootWidget.addEventListener("tm-focus-selector",function(event) {
|
||||||
var selector = event.param || "",
|
var selector = event.param || "",
|
||||||
element,
|
element,
|
||||||
baseElement = event.event && event.event.target ? event.event.target.ownerDocument : document;
|
doc = event.event && event.event.target ? event.event.target.ownerDocument : document;
|
||||||
element = $tw.utils.querySelectorSafe(selector,baseElement);
|
try {
|
||||||
|
element = doc.querySelector(selector);
|
||||||
|
} catch(e) {
|
||||||
|
console.log("Error in selector: ",selector)
|
||||||
|
}
|
||||||
if(element && element.focus) {
|
if(element && element.focus) {
|
||||||
element.focus(event.paramObject);
|
element.focus(event.paramObject);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ exports.startup = function() {
|
|||||||
if($tw.browser) {
|
if($tw.browser) {
|
||||||
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
|
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
|
||||||
$tw.browser.isFirefox = !!document.mozFullScreenEnabled;
|
$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
|
// Platform detection
|
||||||
$tw.platform = {};
|
$tw.platform = {};
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ function findTitleDomNode(widget,targetClass) {
|
|||||||
targetClass = targetClass || "tc-title";
|
targetClass = targetClass || "tc-title";
|
||||||
var domNode = widget.findFirstDomNode();
|
var domNode = widget.findFirstDomNode();
|
||||||
if(domNode && domNode.querySelector) {
|
if(domNode && domNode.querySelector) {
|
||||||
return $tw.utils.querySelectorSafe("." + targetClass,domNode);
|
return domNode.querySelector("." + targetClass);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -365,25 +365,5 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) {
|
|||||||
return variables;
|
return variables;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Make sure the CSS selector is not invalid
|
|
||||||
*/
|
|
||||||
exports.querySelectorSafe = function(selector,baseElement) {
|
|
||||||
baseElement = baseElement || document;
|
|
||||||
try {
|
|
||||||
return baseElement.querySelector(selector);
|
|
||||||
} catch(e) {
|
|
||||||
console.log("Invalid selector: ",selector);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.querySelectorAllSafe = function(selector,baseElement) {
|
|
||||||
baseElement = baseElement || document;
|
|
||||||
try {
|
|
||||||
return baseElement.querySelectorAll(selector);
|
|
||||||
} catch(e) {
|
|
||||||
console.log("Invalid selector: ",selector);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ exports.makeDraggable = function(options) {
|
|||||||
if(dataTransfer.setDragImage) {
|
if(dataTransfer.setDragImage) {
|
||||||
if(dragImageType === "pill") {
|
if(dragImageType === "pill") {
|
||||||
dataTransfer.setDragImage(dragImage.firstChild,-16,-16);
|
dataTransfer.setDragImage(dragImage.firstChild,-16,-16);
|
||||||
} else if(dragImageType === "blank") {
|
} else if (dragImageType === "blank") {
|
||||||
dragImage.removeChild(dragImage.firstChild);
|
dragImage.removeChild(dragImage.firstChild);
|
||||||
dataTransfer.setDragImage(dragImage,0,0);
|
dataTransfer.setDragImage(dragImage,0,0);
|
||||||
} else {
|
} else {
|
||||||
@@ -106,9 +106,7 @@ exports.makeDraggable = function(options) {
|
|||||||
dataTransfer.setData("text/vnd.tiddler",jsonData);
|
dataTransfer.setData("text/vnd.tiddler",jsonData);
|
||||||
dataTransfer.setData("text/plain",titleString);
|
dataTransfer.setData("text/plain",titleString);
|
||||||
dataTransfer.setData("text/x-moz-url","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
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("URL","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
|
||||||
}
|
}
|
||||||
dataTransfer.setData("Text",titleString);
|
dataTransfer.setData("Text",titleString);
|
||||||
@@ -161,7 +159,7 @@ exports.importDataTransfer = function(dataTransfer,fallbackTitle,callback) {
|
|||||||
if(!$tw.browser.isIE || importDataTypes[t].IECompatible) {
|
if(!$tw.browser.isIE || importDataTypes[t].IECompatible) {
|
||||||
// Get the data
|
// Get the data
|
||||||
var dataType = importDataTypes[t];
|
var dataType = importDataTypes[t];
|
||||||
var data = dataTransfer.getData(dataType.type);
|
var data = dataTransfer.getData(dataType.type);
|
||||||
// Import the tiddlers in the data
|
// Import the tiddlers in the data
|
||||||
if(data !== "" && data !== null) {
|
if(data !== "" && data !== null) {
|
||||||
if($tw.log.IMPORT) {
|
if($tw.log.IMPORT) {
|
||||||
@@ -175,36 +173,6 @@ exports.importDataTransfer = function(dataTransfer,fallbackTitle,callback) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.importPaste = function(item,fallbackTitle,callback) {
|
|
||||||
// Try each provided data type in turn
|
|
||||||
for(var t=0; t<importDataTypes.length; t++) {
|
|
||||||
if(item.type === importDataTypes[t].type) {
|
|
||||||
// Get the data
|
|
||||||
var dataType = importDataTypes[t];
|
|
||||||
|
|
||||||
item.getAsString(function(data){
|
|
||||||
if($tw.log.IMPORT) {
|
|
||||||
console.log("Importing data type '" + dataType.type + "', data: '" + data + "'")
|
|
||||||
}
|
|
||||||
var tiddlerFields = dataType.toTiddlerFieldsArray(data,fallbackTitle);
|
|
||||||
callback(tiddlerFields);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.itemHasValidDataType = function(item) {
|
|
||||||
for(var t=0; t<importDataTypes.length; t++) {
|
|
||||||
if(!$tw.browser.isIE || importDataTypes[t].IECompatible) {
|
|
||||||
if(item.type === importDataTypes[t].type) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var importDataTypes = [
|
var importDataTypes = [
|
||||||
{type: "text/vnd.tiddler", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {
|
{type: "text/vnd.tiddler", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {
|
||||||
return parseJSONTiddlers(data,fallbackTitle);
|
return parseJSONTiddlers(data,fallbackTitle);
|
||||||
@@ -237,13 +205,7 @@ var importDataTypes = [
|
|||||||
return [{title: fallbackTitle, text: data}];
|
return [{title: fallbackTitle, text: data}];
|
||||||
}},
|
}},
|
||||||
{type: "text/uri-list", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {
|
{type: "text/uri-list", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {
|
||||||
// Check for tiddler data URI
|
return [{title: fallbackTitle, text: data}];
|
||||||
var match = $tw.utils.decodeURIComponentSafe(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
|
|
||||||
if(match) {
|
|
||||||
return parseJSONTiddlers(match[1],fallbackTitle);
|
|
||||||
} else {
|
|
||||||
return [{title: fallbackTitle, text: data}]; // As URL string
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ title: $:/core/modules/utils/dom/http.js
|
|||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: utils
|
module-type: utils
|
||||||
|
|
||||||
HTTP support
|
Browser HTTP support
|
||||||
|
|
||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
@@ -13,220 +13,12 @@ HTTP support
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Manage tm-http-request events. Options include:
|
A quick and dirty HTTP function; to be refactored later. Options are:
|
||||||
wiki: Reference to the wiki to be used for state tiddler tracking
|
|
||||||
stateTrackerTitle: Title of tiddler to be used for state tiddler tracking
|
|
||||||
*/
|
|
||||||
function HttpClient(options) {
|
|
||||||
options = options || {};
|
|
||||||
this.nextId = 1;
|
|
||||||
this.wiki = options.wiki || $tw.wiki;
|
|
||||||
this.stateTrackerTitle = options.stateTrackerTitle || "$:/state/http-requests";
|
|
||||||
this.requests = []; // Array of {id: string,request: HttpClientRequest}
|
|
||||||
this.updateRequestTracker();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return the index into this.requests[] corresponding to a given ID. Returns null if not found
|
|
||||||
*/
|
|
||||||
HttpClient.prototype.getRequestIndex = function(targetId) {
|
|
||||||
var targetIndex = null;
|
|
||||||
$tw.utils.each(this.requests,function(requestInfo,index) {
|
|
||||||
if(requestInfo.id === targetId) {
|
|
||||||
targetIndex = index;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return targetIndex;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Update the state tiddler that is tracking the outstanding requests
|
|
||||||
*/
|
|
||||||
HttpClient.prototype.updateRequestTracker = function() {
|
|
||||||
this.wiki.addTiddler({title: this.stateTrackerTitle, text: "" + this.requests.length});
|
|
||||||
};
|
|
||||||
|
|
||||||
HttpClient.prototype.initiateHttpRequest = function(options) {
|
|
||||||
var self = this,
|
|
||||||
id = this.nextId,
|
|
||||||
request = new HttpClientRequest(options);
|
|
||||||
this.nextId += 1;
|
|
||||||
this.requests.push({id: id, request: request});
|
|
||||||
this.updateRequestTracker();
|
|
||||||
request.send(function(err) {
|
|
||||||
var targetIndex = self.getRequestIndex(id);
|
|
||||||
if(targetIndex !== null) {
|
|
||||||
self.requests.splice(targetIndex,1);
|
|
||||||
self.updateRequestTracker();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return id;
|
|
||||||
};
|
|
||||||
|
|
||||||
HttpClient.prototype.cancelAllHttpRequests = function() {
|
|
||||||
var self = this;
|
|
||||||
if(this.requests.length > 0) {
|
|
||||||
for(var t=this.requests.length - 1; t--; t>=0) {
|
|
||||||
var requestInfo = this.requests[t];
|
|
||||||
requestInfo.request.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.requests = [];
|
|
||||||
this.updateRequestTracker();
|
|
||||||
};
|
|
||||||
|
|
||||||
HttpClient.prototype.cancelHttpRequest = function(targetId) {
|
|
||||||
var targetIndex = this.getRequestIndex(targetId);
|
|
||||||
if(targetIndex !== null) {
|
|
||||||
this.requests[targetIndex].request.cancel();
|
|
||||||
this.requests.splice(targetIndex,1);
|
|
||||||
this.updateRequestTracker();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Initiate an HTTP request. Options:
|
|
||||||
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
|
|
||||||
bindProgress: optional title of tiddler to which the progress of the request (0 to 100) should be bound
|
|
||||||
variables: hashmap of variable name to string value passed to action strings
|
|
||||||
headers: hashmap of header name to header value to be sent with the request
|
|
||||||
passwordHeaders: hashmap of header name to password store name to be sent with the request
|
|
||||||
queryStrings: hashmap of query string parameter name to parameter value to be sent with the request
|
|
||||||
passwordQueryStrings: hashmap of query string parameter name to password store name to be sent with the request
|
|
||||||
*/
|
|
||||||
function HttpClientRequest(options) {
|
|
||||||
var self = this;
|
|
||||||
console.log("Initiating an HTTP request",options)
|
|
||||||
this.wiki = options.wiki;
|
|
||||||
this.completionActions = options.oncompletion;
|
|
||||||
this.progressActions = options.onprogress;
|
|
||||||
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) {
|
|
||||||
url = $tw.utils.setQueryStringParameter(url,name,value);
|
|
||||||
});
|
|
||||||
$tw.utils.each(options.passwordQueryStrings,function(value,name) {
|
|
||||||
url = $tw.utils.setQueryStringParameter(url,name,$tw.utils.getPassword(value) || "");
|
|
||||||
});
|
|
||||||
this.url = url;
|
|
||||||
this.requestHeaders = {};
|
|
||||||
$tw.utils.each(options.headers,function(value,name) {
|
|
||||||
self.requestHeaders[name] = value;
|
|
||||||
});
|
|
||||||
$tw.utils.each(options.passwordHeaders,function(value,name) {
|
|
||||||
self.requestHeaders[name] = $tw.utils.getPassword(value) || "";
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpClientRequest.prototype.send = function(callback) {
|
|
||||||
var self = this,
|
|
||||||
setBinding = function(title,text) {
|
|
||||||
if(title) {
|
|
||||||
self.wiki.addTiddler(new $tw.Tiddler({title: title, text: text}));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if(this.url) {
|
|
||||||
setBinding(this.bindStatus,"pending");
|
|
||||||
setBinding(this.bindProgress,"0");
|
|
||||||
// Set the request tracker tiddler
|
|
||||||
var requestTrackerTitle = this.wiki.generateNewTitle("$:/temp/HttpRequest");
|
|
||||||
this.wiki.addTiddler({
|
|
||||||
title: requestTrackerTitle,
|
|
||||||
tags: "$:/tags/HttpRequest",
|
|
||||||
text: JSON.stringify({
|
|
||||||
url: this.url,
|
|
||||||
type: this.method,
|
|
||||||
status: "inprogress",
|
|
||||||
headers: this.requestHeaders,
|
|
||||||
data: this.body
|
|
||||||
})
|
|
||||||
});
|
|
||||||
this.xhr = $tw.utils.httpRequest({
|
|
||||||
url: this.url,
|
|
||||||
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",
|
|
||||||
headers = {};
|
|
||||||
$tw.utils.each(xhr.getAllResponseHeaders().split("\r\n"),function(line) {
|
|
||||||
var pos = line.indexOf(":");
|
|
||||||
if(pos !== -1) {
|
|
||||||
headers[line.substr(0,pos)] = line.substr(pos + 1).trim();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
setBinding(self.bindStatus,completionCode);
|
|
||||||
setBinding(self.bindProgress,"100");
|
|
||||||
var resultVariables = {
|
|
||||||
status: xhr.status.toString(),
|
|
||||||
statusText: xhr.statusText,
|
|
||||||
error: (err || "").toString(),
|
|
||||||
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,
|
|
||||||
}));
|
|
||||||
self.wiki.invokeActionString(self.completionActions,undefined,$tw.utils.extend({},self.variables,resultVariables),{parentWidget: $tw.rootWidget});
|
|
||||||
callback(hasSucceeded ? null : xhr.statusText);
|
|
||||||
// console.log("Back!",err,data,xhr);
|
|
||||||
},
|
|
||||||
progress: function(lengthComputable,loaded,total) {
|
|
||||||
if(lengthComputable) {
|
|
||||||
setBinding(self.bindProgress,"" + Math.floor((loaded/total) * 100))
|
|
||||||
}
|
|
||||||
self.wiki.invokeActionString(self.progressActions,undefined,{
|
|
||||||
lengthComputable: lengthComputable ? "yes" : "no",
|
|
||||||
loaded: loaded,
|
|
||||||
total: total
|
|
||||||
},{parentWidget: $tw.rootWidget});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
HttpClientRequest.prototype.cancel = function() {
|
|
||||||
if(this.xhr) {
|
|
||||||
this.xhr.abort();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.HttpClient = HttpClient;
|
|
||||||
|
|
||||||
/*
|
|
||||||
Make an HTTP request. Options are:
|
|
||||||
url: URL to retrieve
|
url: URL to retrieve
|
||||||
headers: hashmap of headers to send
|
headers: hashmap of headers to send
|
||||||
type: GET, PUT, POST etc
|
type: GET, PUT, POST etc
|
||||||
callback: function invoked with (err,data,xhr)
|
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
|
returnProp: string name of the property to return as first argument of callback
|
||||||
responseType: "text" or "arraybuffer"
|
|
||||||
*/
|
*/
|
||||||
exports.httpRequest = function(options) {
|
exports.httpRequest = function(options) {
|
||||||
var type = options.type || "GET",
|
var type = options.type || "GET",
|
||||||
@@ -279,7 +71,6 @@ exports.httpRequest = function(options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
request.responseType = options.responseType || "text";
|
|
||||||
// Set up the state change handler
|
// Set up the state change handler
|
||||||
request.onreadystatechange = function() {
|
request.onreadystatechange = function() {
|
||||||
if(this.readyState === 4) {
|
if(this.readyState === 4) {
|
||||||
@@ -292,16 +83,8 @@ exports.httpRequest = function(options) {
|
|||||||
options.callback($tw.language.getString("Error/XMLHttpRequest") + ": " + this.status,null,this);
|
options.callback($tw.language.getString("Error/XMLHttpRequest") + ": " + this.status,null,this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Handle progress
|
|
||||||
if(options.progress) {
|
|
||||||
request.onprogress = function(event) {
|
|
||||||
console.log("Progress event",event)
|
|
||||||
options.progress(event.lengthComputable,event.loaded,event.total);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// Make the request
|
// Make the request
|
||||||
request.open(type,url,true);
|
request.open(type,url,true);
|
||||||
// Headers
|
|
||||||
if(headers) {
|
if(headers) {
|
||||||
$tw.utils.each(headers,function(header,headerTitle,object) {
|
$tw.utils.each(headers,function(header,headerTitle,object) {
|
||||||
request.setRequestHeader(headerTitle,header);
|
request.setRequestHeader(headerTitle,header);
|
||||||
@@ -313,7 +96,6 @@ exports.httpRequest = function(options) {
|
|||||||
if(!hasHeader("X-Requested-With") && !isSimpleRequest(type,headers)) {
|
if(!hasHeader("X-Requested-With") && !isSimpleRequest(type,headers)) {
|
||||||
request.setRequestHeader("X-Requested-With","TiddlyWiki");
|
request.setRequestHeader("X-Requested-With","TiddlyWiki");
|
||||||
}
|
}
|
||||||
// Send data
|
|
||||||
try {
|
try {
|
||||||
request.send(data);
|
request.send(data);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
@@ -322,19 +104,4 @@ exports.httpRequest = function(options) {
|
|||||||
return request;
|
return request;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.setQueryStringParameter = function(url,paramName,paramValue) {
|
|
||||||
var URL = $tw.browser ? window.URL : require("url").URL,
|
|
||||||
newUrl;
|
|
||||||
try {
|
|
||||||
newUrl = new URL(url);
|
|
||||||
} catch(e) {
|
|
||||||
}
|
|
||||||
if(newUrl && paramName) {
|
|
||||||
newUrl.searchParams.set(paramName,paramValue || "");
|
|
||||||
return newUrl.toString();
|
|
||||||
} else {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -127,8 +127,8 @@ PageScroller.prototype.scrollIntoView = function(element,callback,options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PageScroller.prototype.scrollSelectorIntoView = function(baseElement,selector,callback,options) {
|
PageScroller.prototype.scrollSelectorIntoView = function(baseElement,selector,callback,options) {
|
||||||
baseElement = baseElement || document;
|
baseElement = baseElement || document.body;
|
||||||
var element = $tw.utils.querySelectorSafe(selector,baseElement);
|
var element = baseElement.querySelector(selector);
|
||||||
if(element) {
|
if(element) {
|
||||||
this.scrollIntoView(element,callback,options);
|
this.scrollIntoView(element,callback,options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,11 +112,11 @@ CheckboxWidget.prototype.getValue = function() {
|
|||||||
var list;
|
var list;
|
||||||
if(this.checkboxListField) {
|
if(this.checkboxListField) {
|
||||||
if($tw.utils.hop(tiddler.fields,this.checkboxListField)) {
|
if($tw.utils.hop(tiddler.fields,this.checkboxListField)) {
|
||||||
list = tiddler.getFieldList(this.checkboxListField) || [];
|
list = tiddler.getFieldList(this.checkboxListField);
|
||||||
} else {
|
} else {
|
||||||
list = $tw.utils.parseStringArray(this.checkboxDefault || "") || [];
|
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 || "")) || [];
|
list = $tw.utils.parseStringArray(this.wiki.extractTiddlerDataItem(tiddler,this.checkboxListIndex,this.checkboxDefault || "")) || [];
|
||||||
} else {
|
} else {
|
||||||
list = this.wiki.filterTiddlers(this.checkboxFilter,this) || [];
|
list = this.wiki.filterTiddlers(this.checkboxFilter,this) || [];
|
||||||
@@ -208,22 +208,16 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
|
|||||||
if(this.checkboxListField || this.checkboxListIndex) {
|
if(this.checkboxListField || this.checkboxListIndex) {
|
||||||
var fieldContents, listContents, oldPos, newPos;
|
var fieldContents, listContents, oldPos, newPos;
|
||||||
if(this.checkboxListField) {
|
if(this.checkboxListField) {
|
||||||
fieldContents = (tiddler ? tiddler.fields[this.checkboxListField] : undefined) || [];
|
fieldContents = tiddler ? tiddler.fields[this.checkboxListField] : undefined;
|
||||||
} else {
|
} else {
|
||||||
fieldContents = this.wiki.extractTiddlerDataItem(this.checkboxTitle,this.checkboxListIndex);
|
fieldContents = this.wiki.extractTiddlerDataItem(this.checkboxTitle,this.checkboxListIndex);
|
||||||
}
|
}
|
||||||
if($tw.utils.isArray(fieldContents)) {
|
if($tw.utils.isArray(fieldContents)) {
|
||||||
// Make a copy so we can modify it without changing original that's refrenced elsewhere
|
// Make a copy so we can modify it without changing original that's refrenced elsewhere
|
||||||
listContents = fieldContents.slice(0);
|
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
|
|
||||||
} else {
|
} else {
|
||||||
// Field was neither an array nor a string; it's probably something that shouldn't become
|
listContents = $tw.utils.parseStringArray(fieldContents) || [];
|
||||||
// an array (such as a date field), so bail out *without* triggering actions
|
// No need to copy since parseStringArray returns a fresh array, not refrenced elsewhere
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
oldPos = notValue ? listContents.indexOf(notValue) : -1;
|
oldPos = notValue ? listContents.indexOf(notValue) : -1;
|
||||||
newPos = value ? listContents.indexOf(value) : -1;
|
newPos = value ? listContents.indexOf(value) : -1;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ DiffTextWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
this.execute();
|
this.execute();
|
||||||
// Create the diff
|
// Create the diff
|
||||||
var dmpObject = new dmp.diff_match_patch(),
|
var dmpObject = new dmp.diff_match_patch(),
|
||||||
diffs = dmpObject.diff_main(this.getAttribute("source",""),this.getAttribute("dest",""));
|
diffs = dmpObject.diff_main(this.getAttribute("source"),this.getAttribute("dest"));
|
||||||
// Apply required cleanup
|
// Apply required cleanup
|
||||||
switch(this.getAttribute("cleanup","semantic")) {
|
switch(this.getAttribute("cleanup","semantic")) {
|
||||||
case "none":
|
case "none":
|
||||||
|
|||||||
@@ -271,20 +271,6 @@ DropZoneWidget.prototype.handlePasteEvent = function(event) {
|
|||||||
callback: readFileCallback,
|
callback: readFileCallback,
|
||||||
deserializer: this.dropzoneDeserializer
|
deserializer: this.dropzoneDeserializer
|
||||||
});
|
});
|
||||||
} else if(item.kind === "string" && !["text/html", "text/plain", "Text"].includes(item.type) && $tw.utils.itemHasValidDataType(item)) {
|
|
||||||
// Try to import the various data types we understand
|
|
||||||
var fallbackTitle = self.wiki.generateNewTitle("Untitled");
|
|
||||||
//Use the deserializer specified if any
|
|
||||||
if(this.dropzoneDeserializer) {
|
|
||||||
item.getAsString(function(str){
|
|
||||||
var tiddlerFields = self.wiki.deserializeTiddlers(null,str,{title: fallbackTitle},{deserializer:self.dropzoneDeserializer});
|
|
||||||
if(tiddlerFields && tiddlerFields.length) {
|
|
||||||
readFileCallback(tiddlerFields);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$tw.utils.importPaste(item,fallbackTitle,readFileCallback);
|
|
||||||
}
|
|
||||||
} else if(item.kind === "string") {
|
} else if(item.kind === "string") {
|
||||||
// Create tiddlers from string items
|
// Create tiddlers from string items
|
||||||
var tiddlerFields;
|
var tiddlerFields;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ ImportVariablesWidget.prototype.execute = function(tiddlerList) {
|
|||||||
this.tiddlerList = tiddlerList || this.wiki.filterTiddlers(this.filter,this);
|
this.tiddlerList = tiddlerList || this.wiki.filterTiddlers(this.filter,this);
|
||||||
// Accumulate the <$set> widgets from each tiddler
|
// Accumulate the <$set> widgets from each tiddler
|
||||||
$tw.utils.each(this.tiddlerList,function(title) {
|
$tw.utils.each(this.tiddlerList,function(title) {
|
||||||
var parser = widgetPointer.wiki.parseTiddler(title,{parseAsInline:true, configTrimWhiteSpace:true});
|
var parser = widgetPointer.wiki.parseTiddler(title,{parseAsInline:true});
|
||||||
if(parser) {
|
if(parser) {
|
||||||
var parseTreeNode = parser.tree[0];
|
var parseTreeNode = parser.tree[0];
|
||||||
while(parseTreeNode && ["setvariable","set","parameters"].indexOf(parseTreeNode.type) !== -1) {
|
while(parseTreeNode && ["setvariable","set","parameters"].indexOf(parseTreeNode.type) !== -1) {
|
||||||
|
|||||||
@@ -92,9 +92,12 @@ LinkCatcherWidget.prototype.handleNavigateEvent = function(event) {
|
|||||||
this.executingActions = false;
|
this.executingActions = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// This is a navigate event generated by the actions of this linkcatcher,
|
// This is a navigate event generated by the actions of this linkcatcher, so we don't trap it again, but just pass it to the parent
|
||||||
// so we don't trap it again, but just pass it to the parent
|
this.parentWidget.dispatchEvent({
|
||||||
this.parentWidget.dispatchEvent(event);
|
type: "tm-navigate",
|
||||||
|
param: event.navigateTo,
|
||||||
|
navigateTo: event.navigateTo
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ MacroCallWidget.prototype.execute = function() {
|
|||||||
var positionalName = 0,
|
var positionalName = 0,
|
||||||
parseTreeNodes = [{
|
parseTreeNodes = [{
|
||||||
type: "transclude",
|
type: "transclude",
|
||||||
isBlock: this.parseTreeNode.isBlock,
|
isBlock: this.parseTreeNode.isBlock
|
||||||
children: this.parseTreeNode.children
|
|
||||||
}];
|
}];
|
||||||
$tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],"$variable",this.macroName);
|
$tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],"$variable",this.macroName);
|
||||||
$tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],"$type",this.parseType);
|
$tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],"$type",this.parseType);
|
||||||
|
|||||||
@@ -119,8 +119,8 @@ ScrollableWidget.prototype.scrollIntoView = function(element,callback,options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ScrollableWidget.prototype.scrollSelectorIntoView = function(baseElement,selector,callback,options) {
|
ScrollableWidget.prototype.scrollSelectorIntoView = function(baseElement,selector,callback,options) {
|
||||||
baseElement = baseElement || document;
|
baseElement = baseElement || document.body;
|
||||||
var element = $tw.utils.querySelectorSafe(selector,baseElement);
|
var element = baseElement.querySelector(selector);
|
||||||
if(element) {
|
if(element) {
|
||||||
this.scrollIntoView(element,callback,options);
|
this.scrollIntoView(element,callback,options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,6 @@ SelectWidget.prototype.execute = function() {
|
|||||||
this.selectDefault = this.getAttribute("default");
|
this.selectDefault = this.getAttribute("default");
|
||||||
this.selectMultiple = this.getAttribute("multiple", false);
|
this.selectMultiple = this.getAttribute("multiple", false);
|
||||||
this.selectSize = this.getAttribute("size");
|
this.selectSize = this.getAttribute("size");
|
||||||
this.selectTabindex = this.getAttribute("tabindex");
|
|
||||||
this.selectTooltip = this.getAttribute("tooltip");
|
this.selectTooltip = this.getAttribute("tooltip");
|
||||||
this.selectFocus = this.getAttribute("focus");
|
this.selectFocus = this.getAttribute("focus");
|
||||||
// Make the child widgets
|
// Make the child widgets
|
||||||
@@ -163,9 +162,6 @@ SelectWidget.prototype.execute = function() {
|
|||||||
if(this.selectSize) {
|
if(this.selectSize) {
|
||||||
$tw.utils.addAttributeToParseTreeNode(selectNode,"size",this.selectSize);
|
$tw.utils.addAttributeToParseTreeNode(selectNode,"size",this.selectSize);
|
||||||
}
|
}
|
||||||
if(this.selectTabindex) {
|
|
||||||
$tw.utils.addAttributeToParseTreeNode(selectNode,"tabindex",this.selectTabindex);
|
|
||||||
}
|
|
||||||
if(this.selectTooltip) {
|
if(this.selectTooltip) {
|
||||||
$tw.utils.addAttributeToParseTreeNode(selectNode,"title",this.selectTooltip);
|
$tw.utils.addAttributeToParseTreeNode(selectNode,"title",this.selectTooltip);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ SlotWidget.prototype.execute = function() {
|
|||||||
var pointer = this.parentWidget,
|
var pointer = this.parentWidget,
|
||||||
depth = this.slotDepth;
|
depth = this.slotDepth;
|
||||||
while(pointer) {
|
while(pointer) {
|
||||||
if(pointer instanceof TranscludeWidget && pointer.hasVisibleSlots()) {
|
if(pointer instanceof TranscludeWidget) {
|
||||||
depth--;
|
depth--;
|
||||||
if(depth <= 0) {
|
if(depth <= 0) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -41,43 +41,27 @@ TranscludeWidget.prototype.execute = function() {
|
|||||||
this.collectAttributes();
|
this.collectAttributes();
|
||||||
this.collectStringParameters();
|
this.collectStringParameters();
|
||||||
this.collectSlotFillParameters();
|
this.collectSlotFillParameters();
|
||||||
// Determine whether we're being used in inline or block mode
|
// Get the parse tree nodes that we are transcluding
|
||||||
var parseAsInline = !this.parseTreeNode.isBlock;
|
var target = this.getTransclusionTarget(),
|
||||||
if(this.transcludeMode === "inline") {
|
parseTreeNodes = target.parseTreeNodes;
|
||||||
parseAsInline = true;
|
this.sourceText = target.text;
|
||||||
} else if(this.transcludeMode === "block") {
|
this.sourceType = target.type;
|
||||||
parseAsInline = false;
|
this.parseAsInline = target.parseAsInline;
|
||||||
}
|
|
||||||
// Set 'thisTiddler'
|
|
||||||
this.setVariable("thisTiddler",this.transcludeTitle);
|
|
||||||
var parseTreeNodes, target;
|
|
||||||
// Process the transclusion according to the output type
|
// Process the transclusion according to the output type
|
||||||
switch(this.transcludeOutput || "text/html") {
|
switch(this.transcludeOutput || "text/html") {
|
||||||
case "text/html":
|
case "text/html":
|
||||||
// Return the parse tree nodes of the target
|
// No further processing required
|
||||||
target = this.parseTransclusionTarget(parseAsInline);
|
|
||||||
this.parseAsInline = target.parseAsInline;
|
|
||||||
parseTreeNodes = target.parseTreeNodes;
|
|
||||||
break;
|
break;
|
||||||
case "text/raw":
|
case "text/raw":
|
||||||
// Just return the raw text
|
// Just return the raw text
|
||||||
target = this.getTransclusionTarget();
|
parseTreeNodes = [{type: "text", text: this.sourceText}];
|
||||||
parseTreeNodes = [{type: "text", text: target.text}];
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// "text/plain" is the plain text result of wikifying the text
|
// text/plain
|
||||||
target = this.parseTransclusionTarget(parseAsInline);
|
var plainText = this.wiki.renderText("text/plain",this.sourceType,this.sourceText,{parentWidget: this});
|
||||||
var widgetNode = this.wiki.makeWidget(target.parser,{
|
parseTreeNodes = [{type: "text", text: plainText}];
|
||||||
parentWidget: this,
|
|
||||||
document: $tw.fakeDocument
|
|
||||||
});
|
|
||||||
var container = $tw.fakeDocument.createElement("div");
|
|
||||||
widgetNode.render(container,null);
|
|
||||||
parseTreeNodes = [{type: "text", text: container.textContent}];
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.sourceText = target.text;
|
|
||||||
this.parserType = target.type;
|
|
||||||
// Set the legacy transclusion context variables only if we're not transcluding a variable
|
// Set the legacy transclusion context variables only if we're not transcluding a variable
|
||||||
if(!this.transcludeVariable) {
|
if(!this.transcludeVariable) {
|
||||||
var recursionMarker = this.makeRecursionMarker();
|
var recursionMarker = this.makeRecursionMarker();
|
||||||
@@ -174,127 +158,114 @@ TranscludeWidget.prototype.collectSlotFillParameters = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get transcluded details as an object {text:,type:}
|
Get transcluded parse tree nodes as an object {parser:,text:,type:}
|
||||||
*/
|
*/
|
||||||
TranscludeWidget.prototype.getTransclusionTarget = function() {
|
TranscludeWidget.prototype.getTransclusionTarget = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var text;
|
// Determine whether we're being used in inline or block mode
|
||||||
// Return the text and type of the target
|
var parseAsInline = !this.parseTreeNode.isBlock;
|
||||||
if(this.hasAttribute("$variable")) {
|
if(this.transcludeMode === "inline") {
|
||||||
if(this.transcludeVariable) {
|
parseAsInline = true;
|
||||||
// Transcluding a variable
|
} else if(this.transcludeMode === "block") {
|
||||||
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()});
|
parseAsInline = false;
|
||||||
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;
|
var parser;
|
||||||
// Get the parse tree
|
// Get the parse tree
|
||||||
if(this.hasAttribute("$variable")) {
|
if(this.transcludeVariable) {
|
||||||
if(this.transcludeVariable) {
|
// Transcluding a variable
|
||||||
// Transcluding a variable
|
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()}),
|
||||||
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()}),
|
srcVariable = variableInfo && variableInfo.srcVariable;
|
||||||
srcVariable = variableInfo && variableInfo.srcVariable;
|
if(srcVariable) {
|
||||||
if(variableInfo.text) {
|
if(srcVariable.isFunctionDefinition) {
|
||||||
if(srcVariable && srcVariable.isFunctionDefinition) {
|
// Function to return parameters by name or position
|
||||||
var result = (variableInfo.resultList ? variableInfo.resultList[0] : variableInfo.text) || "";
|
var fnGetParam = function(name,index) {
|
||||||
parser = {
|
// Parameter names starting with dollar must be escaped to double dollars
|
||||||
tree: [{
|
if(name.charAt(0) === "$") {
|
||||||
type: "text",
|
name = "$" + name;
|
||||||
text: result
|
}
|
||||||
}],
|
// Look for the parameter by name
|
||||||
source: result,
|
if(self.hasAttribute(name)) {
|
||||||
type: "text/vnd.tiddlywiki"
|
return self.getAttribute(name);
|
||||||
|
// Look for the parameter by index
|
||||||
|
} else if(self.hasAttribute(index + "")) {
|
||||||
|
return self.getAttribute(index + "");
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
result = this.evaluateVariable(this.transcludeVariable,{params: fnGetParam})[0] || "";
|
||||||
|
parser = {
|
||||||
|
tree: [{
|
||||||
|
type: "text",
|
||||||
|
text: result
|
||||||
|
}],
|
||||||
|
source: result,
|
||||||
|
type: "text/vnd.tiddlywiki"
|
||||||
|
};
|
||||||
|
if(parseAsInline) {
|
||||||
|
parser.tree[0] = {
|
||||||
|
type: "text",
|
||||||
|
text: result
|
||||||
};
|
};
|
||||||
if(parseAsInline) {
|
} else {
|
||||||
parser.tree[0] = {
|
parser.tree[0] = {
|
||||||
|
type: "element",
|
||||||
|
tag: "p",
|
||||||
|
children: [{
|
||||||
type: "text",
|
type: "text",
|
||||||
text: result
|
text: result
|
||||||
};
|
}]
|
||||||
} else {
|
|
||||||
parser.tree[0] = {
|
|
||||||
type: "element",
|
|
||||||
tag: "p",
|
|
||||||
children: [{
|
|
||||||
type: "text",
|
|
||||||
text: result
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var cacheKey = (parseAsInline ? "inlineParser" : "blockParser") + (this.transcludeType || "");
|
|
||||||
if(variableInfo.isCacheable && srcVariable[cacheKey]) {
|
|
||||||
parser = srcVariable[cacheKey];
|
|
||||||
} else {
|
|
||||||
parser = this.wiki.parseText(this.transcludeType,variableInfo.text || "",{parseAsInline: parseAsInline, configTrimWhiteSpace: srcVariable && srcVariable.configTrimWhiteSpace});
|
|
||||||
if(variableInfo.isCacheable) {
|
|
||||||
srcVariable[cacheKey] = parser;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(parser) {
|
} else {
|
||||||
// Add parameters widget for procedures and custom widgets
|
var cacheKey = (parseAsInline ? "inlineParser" : "blockParser") + (this.transcludeType || "");
|
||||||
if(srcVariable && (srcVariable.isProcedureDefinition || srcVariable.isWidgetDefinition)) {
|
if(variableInfo.isCacheable && srcVariable[cacheKey]) {
|
||||||
parser = {
|
parser = srcVariable[cacheKey];
|
||||||
tree: [
|
} else {
|
||||||
{
|
parser = this.wiki.parseText(this.transcludeType,variableInfo.text || "",{parseAsInline: parseAsInline, configTrimWhiteSpace: srcVariable.configTrimWhiteSpace});
|
||||||
type: "parameters",
|
if(variableInfo.isCacheable) {
|
||||||
children: parser.tree
|
srcVariable[cacheKey] = parser;
|
||||||
}
|
|
||||||
],
|
|
||||||
source: parser.source,
|
|
||||||
type: parser.type
|
|
||||||
}
|
|
||||||
$tw.utils.each(srcVariable.params,function(param) {
|
|
||||||
var name = param.name;
|
|
||||||
// Parameter names starting with dollar must be escaped to double dollars
|
|
||||||
if(name.charAt(0) === "$") {
|
|
||||||
name = "$" + name;
|
|
||||||
}
|
|
||||||
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],name,param["default"])
|
|
||||||
});
|
|
||||||
} 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: [
|
|
||||||
{
|
|
||||||
type: "vars",
|
|
||||||
children: parser.tree
|
|
||||||
}
|
|
||||||
],
|
|
||||||
source: parser.source,
|
|
||||||
type: parser.type
|
|
||||||
}
|
|
||||||
$tw.utils.each(variableInfo.params,function(param) {
|
|
||||||
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],"__" + param.name + "__",param.value)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(parser) {
|
||||||
|
// Add parameters widget for procedures and custom widgets
|
||||||
|
if(srcVariable.isProcedureDefinition || srcVariable.isWidgetDefinition) {
|
||||||
|
parser = {
|
||||||
|
tree: [
|
||||||
|
{
|
||||||
|
type: "parameters",
|
||||||
|
children: parser.tree
|
||||||
|
}
|
||||||
|
],
|
||||||
|
source: parser.source,
|
||||||
|
type: parser.type
|
||||||
|
}
|
||||||
|
$tw.utils.each(srcVariable.params,function(param) {
|
||||||
|
var name = param.name;
|
||||||
|
// Parameter names starting with dollar must be escaped to double dollars
|
||||||
|
if(name.charAt(0) === "$") {
|
||||||
|
name = "$" + name;
|
||||||
|
}
|
||||||
|
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],name,param["default"])
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// For macros and ordinary variables, wrap the parse tree in a vars widget assigning the parameters to variables named "__paramname__"
|
||||||
|
parser = {
|
||||||
|
tree: [
|
||||||
|
{
|
||||||
|
type: "vars",
|
||||||
|
children: parser.tree
|
||||||
|
}
|
||||||
|
],
|
||||||
|
source: parser.source,
|
||||||
|
type: parser.type
|
||||||
|
}
|
||||||
|
$tw.utils.each(variableInfo.params,function(param) {
|
||||||
|
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],"__" + param.name + "__",param.value)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Transcluding a text reference
|
// Transcluding a text reference
|
||||||
@@ -309,13 +280,24 @@ TranscludeWidget.prototype.parseTransclusionTarget = function(parseAsInline) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Return the parse tree
|
// Return the parse tree
|
||||||
return {
|
if(parser) {
|
||||||
parser: parser,
|
return {
|
||||||
parseTreeNodes: parser ? parser.tree : (this.slotFillParseTrees["ts-missing"] || []),
|
parser: parser,
|
||||||
parseAsInline: parseAsInline,
|
parseTreeNodes: parser.tree,
|
||||||
text: parser && parser.source,
|
parseAsInline: parseAsInline,
|
||||||
type: parser && parser.type
|
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
|
||||||
|
};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -398,13 +380,6 @@ TranscludeWidget.prototype.getTransclusionSlotFill = function(name,defaultParseT
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Return whether this transclusion should be visible to the slot widget
|
|
||||||
*/
|
|
||||||
TranscludeWidget.prototype.hasVisibleSlots = function() {
|
|
||||||
return this.getAttribute("$fillignore","no") === "no";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Compose a string comprising the title, field and/or index to identify this transclusion for recursion detection
|
Compose a string comprising the title, field and/or index to identify this transclusion for recursion detection
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -112,18 +112,14 @@ Get the prevailing value of a context variable
|
|||||||
name: name of variable
|
name: name of variable
|
||||||
options: see below
|
options: see below
|
||||||
Options include
|
Options include
|
||||||
|
|
||||||
params: array of {name:, value:} for each parameter
|
params: array of {name:, value:} for each parameter
|
||||||
defaultValue: default value if the variable is not defined
|
defaultValue: default value if the variable is not defined
|
||||||
source: optional source iterator for evaluating function invocations
|
|
||||||
allowSelfAssigned: if true, includes the current widget in the context chain instead of just the parent
|
allowSelfAssigned: if true, includes the current widget in the context chain instead of just the parent
|
||||||
|
|
||||||
Returns an object with the following fields:
|
Returns an object with the following fields:
|
||||||
|
|
||||||
params: array of {name:,value:} or {value:} of parameters to be applied
|
params: array of {name:,value:} of parameters passed to wikitext variables
|
||||||
text: text of variable, with parameters properly substituted
|
text: text of variable, with parameters properly substituted
|
||||||
resultList: result of variable evaluation as an array
|
|
||||||
srcVariable: reference to the object defining the variable
|
|
||||||
*/
|
*/
|
||||||
Widget.prototype.getVariableInfo = function(name,options) {
|
Widget.prototype.getVariableInfo = function(name,options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
@@ -139,8 +135,7 @@ Widget.prototype.getVariableInfo = function(name,options) {
|
|||||||
if(variable) {
|
if(variable) {
|
||||||
var originalValue = variable.value,
|
var originalValue = variable.value,
|
||||||
value = originalValue,
|
value = originalValue,
|
||||||
params = [],
|
params = [];
|
||||||
resultList = [value];
|
|
||||||
// Only substitute parameter and variable references if this variable was defined with the \define pragma
|
// Only substitute parameter and variable references if this variable was defined with the \define pragma
|
||||||
if(variable.isMacroDefinition) {
|
if(variable.isMacroDefinition) {
|
||||||
params = self.resolveVariableParameters(variable.params,actualParams);
|
params = self.resolveVariableParameters(variable.params,actualParams);
|
||||||
@@ -149,28 +144,10 @@ Widget.prototype.getVariableInfo = function(name,options) {
|
|||||||
value = $tw.utils.replaceString(value,new RegExp("\\$" + $tw.utils.escapeRegExp(param.name) + "\\$","mg"),param.value);
|
value = $tw.utils.replaceString(value,new RegExp("\\$" + $tw.utils.escapeRegExp(param.name) + "\\$","mg"),param.value);
|
||||||
});
|
});
|
||||||
value = self.substituteVariableReferences(value,options);
|
value = self.substituteVariableReferences(value,options);
|
||||||
resultList = [value];
|
|
||||||
} else if(variable.isFunctionDefinition) {
|
|
||||||
// Function evaluations
|
|
||||||
params = self.resolveVariableParameters(variable.params,actualParams);
|
|
||||||
var variables = Object.create(null);
|
|
||||||
// Apply default parameter values
|
|
||||||
$tw.utils.each(variable.params,function(param,index) {
|
|
||||||
if(param["default"]) {
|
|
||||||
variables[param.name] = param["default"];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// Parameters are an array of {value:} or {name:, value:} pairs
|
|
||||||
$tw.utils.each(params,function(param) {
|
|
||||||
variables[param.name] = param.value;
|
|
||||||
});
|
|
||||||
resultList = this.wiki.filterTiddlers(value,this.makeFakeWidgetWithVariables(variables),options.source);
|
|
||||||
value = resultList[0] || "";
|
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
text: value,
|
text: value,
|
||||||
params: params,
|
params: params,
|
||||||
resultList: resultList,
|
|
||||||
srcVariable: variable,
|
srcVariable: variable,
|
||||||
isCacheable: originalValue === value
|
isCacheable: originalValue === value
|
||||||
};
|
};
|
||||||
@@ -182,7 +159,7 @@ Widget.prototype.getVariableInfo = function(name,options) {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
text: text,
|
text: text,
|
||||||
resultList: [text]
|
srcVariable: {}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -340,11 +317,62 @@ Widget.prototype.makeFakeWidgetWithVariables = function(variables) {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
makeFakeWidgetWithVariables: self.makeFakeWidgetWithVariables,
|
makeFakeWidgetWithVariables: self.makeFakeWidgetWithVariables,
|
||||||
|
evaluateVariable: self.evaluateVariable,
|
||||||
resolveVariableParameters: self.resolveVariableParameters,
|
resolveVariableParameters: self.resolveVariableParameters,
|
||||||
wiki: self.wiki
|
wiki: self.wiki
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Evaluate a variable and associated actual parameters and result the resulting array.
|
||||||
|
The way that the variable is evaluated depends upon its type:
|
||||||
|
* Functions are evaluated as parameterised filter strings
|
||||||
|
* Macros are returned as plain text with substitution of parameters
|
||||||
|
* Procedures and widgets are returned as plain text
|
||||||
|
|
||||||
|
Options are:
|
||||||
|
params - the actual parameters – may be one of:
|
||||||
|
* an array of values that may be an anonymous string value, or a {name:, value:} pair
|
||||||
|
* a hashmap of {name: value} pairs
|
||||||
|
* a function invoked with parameters (name,index) that returns a parameter value by name or position
|
||||||
|
source - iterator for source tiddlers
|
||||||
|
*/
|
||||||
|
Widget.prototype.evaluateVariable = function(name,options) {
|
||||||
|
options = options || {};
|
||||||
|
var params = options.params || [];
|
||||||
|
// Get the details of the variable (includes processing text substitution for macros
|
||||||
|
var variableInfo = this.getVariableInfo(name,{params: params,defaultValue: ""});
|
||||||
|
// Process function parameters
|
||||||
|
var variables = Object.create(null);
|
||||||
|
if(variableInfo.srcVariable && variableInfo.srcVariable.isFunctionDefinition) {
|
||||||
|
// Apply default parameter values
|
||||||
|
$tw.utils.each(variableInfo.srcVariable.params,function(param,index) {
|
||||||
|
if(param["default"]) {
|
||||||
|
variables[param.name] = param["default"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if($tw.utils.isArray(params)) {
|
||||||
|
// Parameters are an array of values or {name:, value:} pairs
|
||||||
|
$tw.utils.each(this.resolveVariableParameters(variableInfo.srcVariable.params,params),function(param) {
|
||||||
|
variables[param.name] = param.value;
|
||||||
|
});
|
||||||
|
} else if(typeof params === "function") {
|
||||||
|
// Parameters are passed via a function
|
||||||
|
$tw.utils.each(variableInfo.srcVariable.params,function(param,index) {
|
||||||
|
variables[param.name] = params(param.name,index) || param["default"] || "";
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Parameters are a hashmap
|
||||||
|
$tw.utils.each(params,function(value,name) {
|
||||||
|
variables[name] = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return this.wiki.filterTiddlers(variableInfo.text,this.makeFakeWidgetWithVariables(variables),options.source);
|
||||||
|
} else {
|
||||||
|
return [variableInfo.text];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Compute the current values of the attributes of the widget. Returns a hashmap of the names of the attributes that have changed.
|
Compute the current values of the attributes of the widget. Returns a hashmap of the names of the attributes that have changed.
|
||||||
Options include:
|
Options include:
|
||||||
@@ -375,12 +403,16 @@ Widget.prototype.computeAttribute = function(attribute) {
|
|||||||
if(attribute.type === "filtered") {
|
if(attribute.type === "filtered") {
|
||||||
value = this.wiki.filterTiddlers(attribute.filter,this)[0] || "";
|
value = this.wiki.filterTiddlers(attribute.filter,this)[0] || "";
|
||||||
} else if(attribute.type === "indirect") {
|
} else if(attribute.type === "indirect") {
|
||||||
value = this.wiki.getTextReference(attribute.textReference,"",this.getVariable("currentTiddler")) || "";
|
value = this.wiki.getTextReference(attribute.textReference,"",this.getVariable("currentTiddler"));
|
||||||
} else if(attribute.type === "macro") {
|
} else if(attribute.type === "macro") {
|
||||||
var variableInfo = this.getVariableInfo(attribute.value.name,{params: attribute.value.params});
|
var variableInfo = this.getVariableInfo(attribute.value.name,{params: attribute.value.params});
|
||||||
value = variableInfo.text;
|
if(variableInfo.srcVariable && variableInfo.srcVariable.isFunctionDefinition) {
|
||||||
} else if(attribute.type === "substituted") {
|
// It is a function definition. Go through each of the defined parameters, and make a variable with the value of the corresponding provided parameter
|
||||||
value = this.wiki.getSubstitutedText(attribute.rawValue,this) || "";
|
var paramArray = this.resolveVariableParameters(variableInfo.srcVariable.params,attribute.value.params);
|
||||||
|
value = this.evaluateVariable(attribute.value.name,{params: paramArray})[0] || "";
|
||||||
|
} else {
|
||||||
|
value = variableInfo.text;
|
||||||
|
}
|
||||||
} else { // String attribute
|
} else { // String attribute
|
||||||
value = attribute.value;
|
value = attribute.value;
|
||||||
}
|
}
|
||||||
@@ -514,8 +546,8 @@ Widget.prototype.makeChildWidget = function(parseTreeNode,options) {
|
|||||||
var variableDefinitionName = "$" + parseTreeNode.type;
|
var variableDefinitionName = "$" + parseTreeNode.type;
|
||||||
if(this.variables[variableDefinitionName]) {
|
if(this.variables[variableDefinitionName]) {
|
||||||
var isOverrideable = function() {
|
var isOverrideable = function() {
|
||||||
// Widget is overrideable if its name contains a period, or if it is an existing JS widget and we're not in safe mode
|
// Widget is overrideable if it has a double dollar user defined name, or if it is an existing JS widget and we're not in safe mode
|
||||||
return parseTreeNode.type.indexOf(".") !== -1 || (!!self.widgetClasses[parseTreeNode.type] && !$tw.safeMode);
|
return parseTreeNode.type.charAt(0) === "$" || (!!self.widgetClasses[parseTreeNode.type] && !$tw.safeMode);
|
||||||
};
|
};
|
||||||
if(!parseTreeNode.isNotRemappable && isOverrideable()) {
|
if(!parseTreeNode.isNotRemappable && isOverrideable()) {
|
||||||
var variableInfo = this.getVariableInfo(variableDefinitionName,{allowSelfAssigned: true});
|
var variableInfo = this.getVariableInfo(variableDefinitionName,{allowSelfAssigned: true});
|
||||||
@@ -797,20 +829,6 @@ Widget.prototype.allowActionPropagation = function() {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Evaluate a variable with parameters. This is a static convenience method that attempts to evaluate a variable as a function, returning an array of strings
|
|
||||||
*/
|
|
||||||
Widget.evaluateVariable = function(widget,name,options) {
|
|
||||||
var result;
|
|
||||||
if(widget.getVariableInfo) {
|
|
||||||
var variableInfo = widget.getVariableInfo(name,options);
|
|
||||||
result = variableInfo.resultList || [variableInfo.text];
|
|
||||||
} else {
|
|
||||||
result = [widget.getVariable(name)];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.widget = Widget;
|
exports.widget = Widget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1063,34 +1063,6 @@ exports.getTextReferenceParserInfo = function(title,field,index,options) {
|
|||||||
return parserInfo;
|
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
|
Make a widget tree for a parse tree
|
||||||
parser: parser object
|
parser: parser object
|
||||||
@@ -1177,7 +1149,7 @@ exports.makeTranscludeWidget = function(title,options) {
|
|||||||
if(options.importVariables) {
|
if(options.importVariables) {
|
||||||
parseTreeImportVariables.attributes.filter.value = options.importVariables;
|
parseTreeImportVariables.attributes.filter.value = options.importVariables;
|
||||||
} else if(options.importPageMacros) {
|
} else if(options.importPageMacros) {
|
||||||
parseTreeImportVariables.attributes.filter.value = this.getTiddlerText("$:/core/config/GlobalImportFilter");
|
parseTreeImportVariables.attributes.filter.value = "[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]";
|
||||||
}
|
}
|
||||||
parseTreeDiv.tree[0].children.push(parseTreeImportVariables);
|
parseTreeDiv.tree[0].children.push(parseTreeImportVariables);
|
||||||
parseTreeImportVariables.children.push(parseTreeTransclude);
|
parseTreeImportVariables.children.push(parseTreeTransclude);
|
||||||
@@ -1443,14 +1415,6 @@ exports.checkTiddlerText = function(title,targetText,options) {
|
|||||||
return text === targetText;
|
return text === targetText;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Execute an action string without an associated context widget
|
|
||||||
*/
|
|
||||||
exports.invokeActionString = function(actions,event,variables,options) {
|
|
||||||
var widget = this.makeWidget(null,{parentWidget: options.parentWidget});
|
|
||||||
widget.invokeActionString(actions,null,event,variables);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Read an array of browser File objects, invoking callback(tiddlerFieldsArray) once they're all read
|
Read an array of browser File objects, invoking callback(tiddlerFieldsArray) once they're all read
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ modal-footer-background: #f5f5f5
|
|||||||
modal-footer-border: #dddddd
|
modal-footer-border: #dddddd
|
||||||
modal-header-border: #eeeeee
|
modal-header-border: #eeeeee
|
||||||
muted-foreground: #bbb
|
muted-foreground: #bbb
|
||||||
network-activity-foreground: #448844
|
|
||||||
notification-background: #ffffdd
|
notification-background: #ffffdd
|
||||||
notification-border: #999999
|
notification-border: #999999
|
||||||
page-background: #f4f4f4
|
page-background: #f4f4f4
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ tags: $:/tags/Exporter
|
|||||||
description: {{$:/language/Exporters/StaticRiver}}
|
description: {{$:/language/Exporters/StaticRiver}}
|
||||||
extension: .html
|
extension: .html
|
||||||
|
|
||||||
\define tv-config-static() yes
|
|
||||||
\define tv-wikilink-template() #$uri_encoded$
|
\define tv-wikilink-template() #$uri_encoded$
|
||||||
\define tv-config-toolbar-icons() no
|
\define tv-config-toolbar-icons() no
|
||||||
\define tv-config-toolbar-text() no
|
\define tv-config-toolbar-text() no
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ title: $:/core/templates/exporters/StaticRiver/Content
|
|||||||
\define renderContent()
|
\define renderContent()
|
||||||
{{{ $(exportFilter)$ ||$:/core/templates/static-tiddler}}}
|
{{{ $(exportFilter)$ ||$:/core/templates/static-tiddler}}}
|
||||||
\end
|
\end
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||||
<<renderContent>>
|
<<renderContent>>
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ condition: [<count>compare:lte[1]]
|
|||||||
\define renderContent()
|
\define renderContent()
|
||||||
{{{ $(exportFilter)$ +[limit[1]] ||$:/core/templates/tid-tiddler}}}
|
{{{ $(exportFilter)$ +[limit[1]] ||$:/core/templates/tid-tiddler}}}
|
||||||
\end
|
\end
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||||
<<renderContent>>
|
<<renderContent>>
|
||||||
@@ -1,14 +1,11 @@
|
|||||||
title: $:/core/save/all-external-js
|
title: $:/core/save/all-external-js
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||||
\define saveTiddlerFilter()
|
\define saveTiddlerFilter()
|
||||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||||
\end
|
\end
|
||||||
|
|
||||||
<!-- Important: core library is provided by serving URI encoded $:/core/templates/tiddlywiki5.js -->
|
|
||||||
\define defaultCoreURL() %24%3A%2Fcore%2Ftemplates%2Ftiddlywiki5.js
|
\define defaultCoreURL() %24%3A%2Fcore%2Ftemplates%2Ftiddlywiki5.js
|
||||||
|
|
||||||
<$let coreURL={{{ [[coreURL]is[variable]then<coreURL>else<defaultCoreURL>] }}}>
|
<$let coreURL={{{ [[coreURL]is[variable]then<coreURL>else<defaultCoreURL>] }}}>
|
||||||
{{$:/core/templates/tiddlywiki5-external-js.html}}
|
{{$:/core/templates/tiddlywiki5-external-js.html}}
|
||||||
</$let>
|
</$let>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
title: $:/core/save/offline-external-js
|
title: $:/core/save/offline-external-js
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||||
\define saveTiddlerFilter()
|
\define saveTiddlerFilter()
|
||||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||||
\end
|
\end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
title: $:/core/save/all
|
title: $:/core/save/all
|
||||||
|
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||||
\define saveTiddlerFilter()
|
\define saveTiddlerFilter()
|
||||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||||
\end
|
\end
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
title: $:/core/templates/server/static.tiddler.html
|
title: $:/core/templates/server/static.tiddler.html
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
\define tv-config-static() yes
|
|
||||||
\define tv-wikilink-template() $uri_encoded$
|
\define tv-wikilink-template() $uri_encoded$
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: $:/core/templates/single.tiddler.window
|
|||||||
\define containerClasses()
|
\define containerClasses()
|
||||||
tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$
|
tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$
|
||||||
\end
|
\end
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||||
|
|
||||||
<$vars
|
<$vars
|
||||||
tv-config-toolbar-icons={{$:/config/Toolbar/Icons}}
|
tv-config-toolbar-icons={{$:/config/Toolbar/Icons}}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
title: $:/core/templates/static.template.html
|
title: $:/core/templates/static.template.html
|
||||||
type: text/vnd.tiddlywiki-html
|
type: text/vnd.tiddlywiki-html
|
||||||
|
|
||||||
\define tv-config-static() yes
|
|
||||||
\define tv-wikilink-template() static/$uri_doubleencoded$.html
|
\define tv-wikilink-template() static/$uri_doubleencoded$.html
|
||||||
\define tv-config-toolbar-icons() no
|
\define tv-config-toolbar-icons() no
|
||||||
\define tv-config-toolbar-text() no
|
\define tv-config-toolbar-text() no
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
title: $:/core/templates/static.tiddler.html
|
title: $:/core/templates/static.tiddler.html
|
||||||
|
|
||||||
\define tv-wikilink-template() $uri_doubleencoded$.html
|
\define tv-wikilink-template() $uri_doubleencoded$.html
|
||||||
\define tv-config-static() yes
|
|
||||||
\define tv-config-toolbar-icons() no
|
\define tv-config-toolbar-icons() no
|
||||||
\define tv-config-toolbar-text() no
|
\define tv-config-toolbar-text() no
|
||||||
\define tv-config-toolbar-class() tc-btn-invisible
|
\define tv-config-toolbar-class() tc-btn-invisible
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||||
`<!doctype html>
|
`<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
code-body: yes
|
|
||||||
title: $:/core/ui/AlertTemplate
|
title: $:/core/ui/AlertTemplate
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
|||||||
@@ -30,15 +30,15 @@ Block transclusions are shown in red, and inline transclusions are shown in gree
|
|||||||
<!-- Look for a parameter starting with $ to determine if we are in legacy mode -->
|
<!-- Look for a parameter starting with $ to determine if we are in legacy mode -->
|
||||||
<$list filter="[<@params>jsonindexes[]] :filter[<currentTiddler>prefix[$]] +[limit[1]]" variable="ignore" emptyMessage="""
|
<$list filter="[<@params>jsonindexes[]] :filter[<currentTiddler>prefix[$]] +[limit[1]]" variable="ignore" emptyMessage="""
|
||||||
<!-- Legacy mode: we render the transclusion without a dollar sign for recursionMarker and mode -->
|
<!-- Legacy mode: we render the transclusion without a dollar sign for recursionMarker and mode -->
|
||||||
<$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" recursionMarker="no" mode=<<mode>> $$fillignore="yes">
|
<$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" recursionMarker="no" mode=<<mode>>>
|
||||||
<!-- Reach back up to the grandparent transclusion to get the correct slot value -->
|
<!-- Reach back up to the grandparent transclusion to get the correct slot value -->
|
||||||
<$slot $name="ts-raw"/>
|
<$slot $name="ts-raw" $depth="2"/>
|
||||||
</$genesis>
|
</$genesis>
|
||||||
""">
|
""">
|
||||||
<!-- Non-legacy mode: we use dollar signs for the recursionMarker and mode -->
|
<!-- Non-legacy mode: we use dollar signs for the recursionMarker and mode -->
|
||||||
<$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" $$recursionMarker="no" $$mode=<<mode>> $$fillignore="yes">
|
<$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" $$recursionMarker="no" $$mode=<<mode>>>
|
||||||
<!-- Reach back up to the grandparent transclusion to get the correct slot fill value -->
|
<!-- Reach back up to the grandparent transclusion to get the correct slot fill value -->
|
||||||
<$slot $name="ts-raw"/>
|
<$slot $name="ts-raw" $depth="2"/>
|
||||||
</$genesis>
|
</$genesis>
|
||||||
</$list>
|
</$list>
|
||||||
</$genesis>
|
</$genesis>
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ $:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$
|
|||||||
</div>
|
</div>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -2,6 +2,18 @@ title: $:/core/ui/ControlPanel/Settings
|
|||||||
tags: $:/tags/ControlPanel
|
tags: $:/tags/ControlPanel
|
||||||
caption: {{$:/language/ControlPanel/Settings/Caption}}
|
caption: {{$:/language/ControlPanel/Settings/Caption}}
|
||||||
|
|
||||||
<div class="tc-control-panel">
|
\define lingo-base() $:/language/ControlPanel/Settings/
|
||||||
<$macrocall $name="tabs" tabsList="[all[shadows+tiddlers]tag[$:/tags/ControlPanel/SettingsTab]!has[draft.of]]" default="$:/core/ui/ControlPanel/Settings/TiddlyWiki" explicitState="$:/state/tab--697582678"/>
|
|
||||||
</div>
|
<<lingo Hint>>
|
||||||
|
|
||||||
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Settings]]">
|
||||||
|
|
||||||
|
<div style="border-top:1px solid #eee;">
|
||||||
|
|
||||||
|
!! <$link><$transclude field="caption"/></$link>
|
||||||
|
|
||||||
|
<$transclude/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</$list>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
code-body: yes
|
|
||||||
title: $:/core/ui/EditTemplate
|
title: $:/core/ui/EditTemplate
|
||||||
|
|
||||||
\define delete-edittemplate-state-tiddlers()
|
\define delete-edittemplate-state-tiddlers()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ title: $:/core/ui/EditTemplate/body/preview/output
|
|||||||
tags: $:/tags/EditPreview
|
tags: $:/tags/EditPreview
|
||||||
caption: {{$:/language/EditTemplate/Body/Preview/Type/Output}}
|
caption: {{$:/language/EditTemplate/Body/Preview/Type/Output}}
|
||||||
|
|
||||||
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Macro/View/Body]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global/View]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global/View/Body]!is[draft]]
|
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!has[draft.of]] [all[shadows+tiddlers]tag[$:/tags/Macro/View/Body]!has[draft.of]]
|
||||||
<$set name="tv-tiddler-preview" value="yes">
|
<$set name="tv-tiddler-preview" value="yes">
|
||||||
|
|
||||||
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/ViewTemplateBodyFilter]!is[draft]get[text]] :and[!is[blank]else[$:/core/ui/ViewTemplate/body/default]] }}} />
|
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/ViewTemplateBodyFilter]!is[draft]get[text]] :and[!is[blank]else[$:/core/ui/ViewTemplate/body/default]] }}} />
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ color:$(foregroundColor)$;
|
|||||||
\define tag-body-inner(colour,fallbackTarget,colourA,colourB,icon,tagField:"tags")
|
\define tag-body-inner(colour,fallbackTarget,colourA,colourB,icon,tagField:"tags")
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$vars foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">> backgroundColor="""$colour$""">
|
<$vars foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">> backgroundColor="""$colour$""">
|
||||||
<span style=<<tag-styles>> class="tc-tag-label tc-tag-list-item tc-small-gap-right" data-tag-title=<<currentTiddler>>>
|
<span style=<<tag-styles>> class="tc-tag-label tc-tag-list-item tc-small-gap-right">
|
||||||
<$transclude tiddler="""$icon$"""/><$view field="title" format="text"/>
|
<$transclude tiddler="""$icon$"""/><$view field="title" format="text" />
|
||||||
<$button class="tc-btn-invisible tc-remove-tag-button" style=<<tag-styles>>><$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter="-[{!!title}]"/>{{$:/core/images/close-button}}</$button>
|
<$button class="tc-btn-invisible tc-remove-tag-button" style=<<tag-styles>>><$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter="-[{!!title}]"/>{{$:/core/images/close-button}}</$button>
|
||||||
</span>
|
</span>
|
||||||
</$vars>
|
</$vars>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ title: $:/core/ui/EditorToolbar/link-dropdown
|
|||||||
|
|
||||||
\define external-link()
|
\define external-link()
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$button class="tc-btn-invisible tc-btn-mini" style="width: auto; display: inline-block; background-colour: inherit;" actions=<<add-link-actions>>>
|
<$button class="tc-btn-invisible" style="width: auto; display: inline-block; background-colour: inherit;" actions=<<add-link-actions>>>
|
||||||
{{$:/core/images/chevron-right}}
|
{{$:/core/images/chevron-right}}
|
||||||
</$button>
|
</$button>
|
||||||
\end
|
\end
|
||||||
@@ -45,7 +45,7 @@ title: $:/core/ui/EditorToolbar/link-dropdown
|
|||||||
<$reveal tag="span" state=<<storeTitle>> type="nomatch" text="">
|
<$reveal tag="span" state=<<storeTitle>> type="nomatch" text="">
|
||||||
<<external-link>>
|
<<external-link>>
|
||||||
 
|
 
|
||||||
<$button class="tc-btn-invisible tc-btn-mini" style="width: auto; display: inline-block; background-colour: inherit;">
|
<$button class="tc-btn-invisible" style="width: auto; display: inline-block; background-colour: inherit;">
|
||||||
<<cancel-search-actions>><$set name="cssEscapedTitle" value={{{ [<storyTiddler>escapecss[]] }}}><$action-sendmessage $message="tm-focus-selector" $param=<<get-focus-selector>>/></$set>
|
<<cancel-search-actions>><$set name="cssEscapedTitle" value={{{ [<storyTiddler>escapecss[]] }}}><$action-sendmessage $message="tm-focus-selector" $param=<<get-focus-selector>>/></$set>
|
||||||
{{$:/core/images/close-button}}
|
{{$:/core/images/close-button}}
|
||||||
</$button>
|
</$button>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
title: $:/core/ui/ImportPreviews/Text
|
title: $:/core/ui/ImportPreviews/Text
|
||||||
tags: $:/tags/ImportPreview
|
tags: $:/tags/ImportPreview
|
||||||
caption: {{$:/language/Import/Listing/Preview/Text}}
|
caption: {{$:/language/Import/Listing/Preview/Text}}
|
||||||
code-body: yes
|
|
||||||
|
|
||||||
<$transclude tiddler=<<currentTiddler>> subtiddler=<<payloadTiddler>> mode="block"/>
|
<$transclude tiddler=<<currentTiddler>> subtiddler=<<payloadTiddler>> mode="block"/>
|
||||||
|
|||||||
@@ -3,14 +3,15 @@ tags: $:/tags/MoreSideBar
|
|||||||
caption: {{$:/language/SideBar/Tags/Caption}}
|
caption: {{$:/language/SideBar/Tags/Caption}}
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
|
||||||
<$let tv-config-toolbar-icons="yes" tv-config-toolbar-text="yes" tv-config-toolbar-class="">
|
<$let tv-config-toolbar-icons="yes" tv-config-toolbar-text="yes" tv-config-toolbar-class="">
|
||||||
<div class="tc-tiny-v-gap-bottom">
|
<div class="tc-tiny-v-gap-bottom">
|
||||||
{{$:/core/ui/Buttons/tag-manager}}
|
{{$:/core/ui/Buttons/tag-manager}}
|
||||||
</div>
|
</div>
|
||||||
</$let>
|
</$let>
|
||||||
<$list filter={{$:/core/Filters/AllTags!!filter}}>
|
<$list filter={{$:/core/Filters/AllTags!!filter}}>
|
||||||
<div class="tc-tiny-v-gap-bottom">
|
<div class="tc-tiny-v-gap-bottom">
|
||||||
<$transclude tiddler="$:/core/ui/TagTemplate"/>
|
<$transclude tiddler="$:/core/ui/TagTemplate"/>
|
||||||
</div>
|
</div>
|
||||||
</$list>
|
</$list>
|
||||||
<hr class="tc-untagged-separator">
|
<hr class="tc-untagged-separator">
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
title: $:/core/ui/Buttons/network-activity
|
|
||||||
tags: $:/tags/PageControls
|
|
||||||
caption: {{$:/core/images/network-activity}} {{$:/language/Buttons/NetworkActivity/Caption}}
|
|
||||||
description: {{$:/language/Buttons/NetworkActivity/Hint}}
|
|
||||||
|
|
||||||
\whitespace trim
|
|
||||||
<$button message="tm-http-cancel-all-requests" tooltip={{$:/language/Buttons/NetworkActivity/Hint}} aria-label={{$:/language/Buttons/NetworkActivity/Caption}} class=<<tv-config-toolbar-class>>>
|
|
||||||
<$list filter="[<tv-config-toolbar-icons>match[yes]]">
|
|
||||||
{{$:/core/images/network-activity}}
|
|
||||||
</$list>
|
|
||||||
<$list filter="[<tv-config-toolbar-text>match[yes]]">
|
|
||||||
<span class="tc-btn-text">
|
|
||||||
<$text text={{$:/language/Buttons/NetworkActivity/Caption}}/>
|
|
||||||
</span>
|
|
||||||
</$list>
|
|
||||||
</$button>
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
title: $:/core/ui/PageStylesheet
|
title: $:/core/ui/PageStylesheet
|
||||||
code-body: yes
|
|
||||||
|
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
|
||||||
<$set name="currentTiddler" value={{$:/language}}>
|
<$set name="currentTiddler" value={{$:/language}}>
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ title: $:/core/ui/PageTemplate
|
|||||||
name: {{$:/language/PageTemplate/Name}}
|
name: {{$:/language/PageTemplate/Name}}
|
||||||
description: {{$:/language/PageTemplate/Description}}
|
description: {{$:/language/PageTemplate/Description}}
|
||||||
icon: $:/core/images/layout-button
|
icon: $:/core/images/layout-button
|
||||||
code-body: yes
|
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||||
|
|
||||||
<$vars
|
<$vars
|
||||||
tv-config-toolbar-icons={{$:/config/Toolbar/Icons}}
|
tv-config-toolbar-icons={{$:/config/Toolbar/Icons}}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
title: $:/core/ui/RootTemplate
|
title: $:/core/ui/RootTemplate
|
||||||
code-body: yes
|
|
||||||
|
|
||||||
<$transclude tiddler={{{ [{$:/layout}has[text]] ~[[$:/core/ui/PageTemplate]] }}} mode="inline"/>
|
<$transclude tiddler={{{ [{$:/layout}has[text]] ~[[$:/core/ui/PageTemplate]] }}} mode="inline"/>
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ $button$
|
|||||||
<div class="tc-sidebar-tab-open">
|
<div class="tc-sidebar-tab-open">
|
||||||
<$list filter="[list<tv-story-list>]" history=<<tv-history-list>> storyview="pop">
|
<$list filter="[list<tv-story-list>]" history=<<tv-history-list>> storyview="pop">
|
||||||
<div class="tc-sidebar-tab-open-item">
|
<div class="tc-sidebar-tab-open-item">
|
||||||
<$macrocall $name="droppable-item" button="<$button message='tm-close-tiddler' tooltip={{$:/language/Buttons/Close/Hint}} aria-label={{$:/language/Buttons/Close/Caption}} class='tc-btn-invisible tc-btn-mini tc-small-gap-right'>{{$:/core/images/close-button}}</$button><$link/>"/>
|
<$macrocall $name="droppable-item" button="<$button message='tm-close-tiddler' tooltip={{$:/language/Buttons/Close/Hint}} aria-label={{$:/language/Buttons/Close/Caption}} class='tc-btn-invisible tc-btn-mini tc-small-gap-right'>{{$:/core/images/close-button}}</$button><$link to={{!!title}}><$view field='title'/></$link>"/>
|
||||||
</div>
|
</div>
|
||||||
</$list>
|
</$list>
|
||||||
<$tiddler tiddler="">
|
<$tiddler tiddler="">
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
title: $:/core/ui/StoryTiddlerTemplate
|
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]] }}} />
|
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/StoryTiddlerTemplateFilter]!is[draft]get[text]] :and[!is[blank]else{$:/config/ui/ViewTemplate}] }}} />
|
||||||
|
|||||||
@@ -2,29 +2,22 @@ title: $:/core/ui/TagPickerTagTemplate
|
|||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$button class=<<button-classes>> tag="a" tooltip={{$:/language/EditTemplate/Tags/Add/Button/Hint}}>
|
<$button class=<<button-classes>> tag="a" tooltip={{$:/language/EditTemplate/Tags/Add/Button/Hint}}>
|
||||||
<$list filter="[<saveTiddler>minlength[1]]">
|
<$list filter="[<saveTiddler>minlength[1]]">
|
||||||
<$action-listops $tiddler=<<saveTiddler>> $field=<<tagField>> $subfilter="[<tag>]"/>
|
<$action-listops $tiddler=<<saveTiddler>> $field=<<tagField>> $subfilter="[<tag>]"/>
|
||||||
</$list>
|
</$list>
|
||||||
<$set name="currentTiddlerCSSEscaped" value={{{ [<saveTiddler>escapecss[]] }}}>
|
<$set name="currentTiddlerCSSEscaped" value={{{ [<saveTiddler>escapecss[]] }}}>
|
||||||
<$action-sendmessage $message="tm-focus-selector" $param=<<get-tagpicker-focus-selector>> preventScroll="true"/>
|
<$action-sendmessage $message="tm-focus-selector" $param=<<get-tagpicker-focus-selector>> preventScroll="true"/>
|
||||||
</$set>
|
</$set>
|
||||||
<<delete-tag-state-tiddlers>>
|
<<delete-tag-state-tiddlers>>
|
||||||
<$list filter="[<refreshTitle>minlength[1]]">
|
<$list filter="[<refreshTitle>minlength[1]]">
|
||||||
<$action-setfield $tiddler=<<refreshTitle>> text="yes"/>
|
<$action-setfield $tiddler=<<refreshTitle>> text="yes"/>
|
||||||
</$list>
|
</$list>
|
||||||
<<actions>>
|
<<actions>>
|
||||||
<$set name="backgroundColor"
|
<$set name="backgroundColor" value={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}>
|
||||||
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>>>
|
||||||
<$wikify name="foregroundColor"
|
{{||$:/core/ui/TiddlerIcon}}<$view field="title" format="text"/>
|
||||||
text="""<$macrocall $name="contrastcolour" target=<<backgroundColor>> fallbackTarget=<<fallbackTarget>> colourA=<<colourA>> colourB=<<colourB>>/>"""
|
</span>
|
||||||
>
|
</$wikify>
|
||||||
<span class="tc-tag-label tc-btn-invisible"
|
</$set>
|
||||||
style=<<tag-pill-styles>>
|
|
||||||
data-tag-title=<<currentTiddler>>
|
|
||||||
>
|
|
||||||
{{||$:/core/ui/TiddlerIcon}}<$view field="title" format="text"/>
|
|
||||||
</span>
|
|
||||||
</$wikify>
|
|
||||||
</$set>
|
|
||||||
</$button>
|
</$button>
|
||||||
|
|||||||
@@ -3,23 +3,16 @@ title: $:/core/ui/TagTemplate
|
|||||||
\whitespace trim
|
\whitespace trim
|
||||||
<span class="tc-tag-list-item" data-tag-title=<<currentTiddler>>>
|
<span class="tc-tag-list-item" data-tag-title=<<currentTiddler>>>
|
||||||
<$set name="transclusion" value=<<currentTiddler>>>
|
<$set name="transclusion" value=<<currentTiddler>>>
|
||||||
<$macrocall $name="tag-pill-body"
|
<$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'"""/>
|
||||||
tag=<<currentTiddler>>
|
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" position="below" animate="yes" class="tc-drop-down">
|
||||||
icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}}
|
<$set name="tv-show-missing-links" value="yes">
|
||||||
colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}
|
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
|
||||||
palette={{$:/palette}}
|
</$set>
|
||||||
element-tag="$button"
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TagDropdown]!has[draft.of]]" variable="listItem">
|
||||||
element-attributes="""popup=<<qualify "$:/state/popup/tag">> dragFilter="[all[current]tagging[]]" tag='span'"""
|
<$transclude tiddler=<<listItem>>/>
|
||||||
/>
|
</$list>
|
||||||
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" position="below" animate="yes" class="tc-drop-down">
|
<hr>
|
||||||
<$set name="tv-show-missing-links" value="yes">
|
<$macrocall $name="list-tagged-draggable" tag=<<currentTiddler>>/>
|
||||||
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
|
</$reveal>
|
||||||
</$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>
|
</$set>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
title: $:/core/ui/ViewTemplate
|
title: $:/core/ui/ViewTemplate
|
||||||
code-body: yes
|
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
\define folded-state()
|
\define folded-state()
|
||||||
$:/state/folded/$(currentTiddler)$
|
$:/state/folded/$(currentTiddler)$
|
||||||
\end
|
\end
|
||||||
\define cancel-delete-tiddler-actions(message) <$action-sendmessage $message="tm-$message$-tiddler"/>
|
\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]]
|
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!has[draft.of]]
|
||||||
<$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify "$:/state/popup/tiddler-info">>>
|
<$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify "$:/state/popup/tiddler-info">>>
|
||||||
<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">
|
<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">
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem">
|
||||||
<$transclude tiddler=<<listItem>>/>
|
<$transclude tiddler=<<listItem>>/>
|
||||||
</$list>
|
</$list>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
title: $:/core/ui/ViewTemplate/body
|
title: $:/core/ui/ViewTemplate/body
|
||||||
tags: $:/tags/ViewTemplate
|
tags: $:/tags/ViewTemplate
|
||||||
|
|
||||||
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View/Body]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global/View/Body]!is[draft]]
|
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View/Body]!has[draft.of]]
|
||||||
|
|
||||||
<$reveal tag="div" class="tc-tiddler-body" type="nomatch" stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes">
|
<$reveal tag="div" class="tc-tiddler-body" type="nomatch" stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes">
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
title: $:/core/ui/ViewTemplate/body/default
|
title: $:/core/ui/ViewTemplate/body/default
|
||||||
code-body: yes
|
|
||||||
|
|
||||||
<$transclude>
|
<$transclude>
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
title: $:/core/config/GlobalImportFilter
|
|
||||||
text: [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global]!is[draft]]
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
title: $:/config/OfficialPluginLibrary
|
title: $:/config/OfficialPluginLibrary
|
||||||
tags: $:/tags/PluginLibrary
|
tags: $:/tags/PluginLibrary
|
||||||
url: https://tiddlywiki.com/library/v5.3.2/index.html
|
url: https://tiddlywiki.com/library/v5.2.8/index.html
|
||||||
caption: {{$:/language/OfficialPluginLibrary}}
|
caption: {{$:/language/OfficialPluginLibrary}}
|
||||||
|
|
||||||
{{$:/language/OfficialPluginLibrary/Hint}}
|
{{$:/language/OfficialPluginLibrary/Hint}}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ core/ui/Buttons/language: hide
|
|||||||
core/ui/Buttons/tag-manager: hide
|
core/ui/Buttons/tag-manager: hide
|
||||||
core/ui/Buttons/manager: hide
|
core/ui/Buttons/manager: hide
|
||||||
core/ui/Buttons/more-page-actions: hide
|
core/ui/Buttons/more-page-actions: hide
|
||||||
core/ui/Buttons/network-activity: hide
|
|
||||||
core/ui/Buttons/new-journal: hide
|
core/ui/Buttons/new-journal: hide
|
||||||
core/ui/Buttons/new-image: hide
|
core/ui/Buttons/new-image: hide
|
||||||
core/ui/Buttons/palette: hide
|
core/ui/Buttons/palette: hide
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ title: $:/config/ViewTemplateBodyFilters/
|
|||||||
tags: $:/tags/ViewTemplateBodyFilter
|
tags: $:/tags/ViewTemplateBodyFilter
|
||||||
|
|
||||||
stylesheet: [tag[$:/tags/Stylesheet]then[$:/core/ui/ViewTemplate/body/rendered-plain-text]]
|
stylesheet: [tag[$:/tags/Stylesheet]then[$:/core/ui/ViewTemplate/body/rendered-plain-text]]
|
||||||
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[$:/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]]
|
||||||
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]]
|
code-body: [field:code-body[yes]then[$:/core/ui/ViewTemplate/body/code]]
|
||||||
import: [field:plugin-type[import]then[$:/core/ui/ViewTemplate/body/import]]
|
import: [field:plugin-type[import]then[$:/core/ui/ViewTemplate/body/import]]
|
||||||
plugin: [has[plugin-type]then[$:/core/ui/ViewTemplate/body/plugin]]
|
plugin: [has[plugin-type]then[$:/core/ui/ViewTemplate/body/plugin]]
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
title: $:/config/WikiParserRules/Inline/wikilink
|
title: $:/config/WikiParserRules/Inline/wikilink
|
||||||
|
|
||||||
disable
|
enable
|
||||||
@@ -9,51 +9,26 @@ color:$(foregroundColor)$;
|
|||||||
|
|
||||||
<!-- This has no whitespace trim to avoid modifying $actions$. Closing tags omitted for brevity. -->
|
<!-- 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)
|
\define tag-pill-inner(tag,icon,colour,fallbackTarget,colourA,colourB,element-tag,element-attributes,actions)
|
||||||
\whitespace trim
|
<$vars
|
||||||
<$let
|
|
||||||
foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">>
|
foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">>
|
||||||
backgroundColor=<<__colour__>>
|
backgroundColor="""$colour$"""
|
||||||
>
|
><$element-tag$
|
||||||
<$element-tag$
|
|
||||||
$element-attributes$
|
$element-attributes$
|
||||||
class="tc-tag-label tc-btn-invisible"
|
class="tc-tag-label tc-btn-invisible"
|
||||||
style=<<tag-pill-styles>>
|
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
|
\end
|
||||||
|
|
||||||
\define tag-pill-body(tag,icon,colour,palette,element-tag,element-attributes,actions)
|
\define tag-pill-body(tag,icon,colour,palette,element-tag,element-attributes,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$"""/>
|
||||||
<$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
|
\end
|
||||||
|
|
||||||
\define tag-pill(tag,element-tag:"span",element-attributes:"",actions:"")
|
\define tag-pill(tag,element-tag:"span",element-attributes:"",actions:"")
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<span class="tc-tag-list-item" data-tag-title=<<__tag__>>>
|
<span class="tc-tag-list-item" data-tag-title=<<__tag__>>>
|
||||||
<$let currentTiddler=<<__tag__>>>
|
<$let currentTiddler=<<__tag__>>>
|
||||||
<$macrocall $name="tag-pill-body"
|
<$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$"""/>
|
||||||
tag=<<__tag__>>
|
</$let>
|
||||||
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>
|
</span>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ tags: $:/tags/Macro
|
|||||||
|
|
||||||
\define toc-caption()
|
\define toc-caption()
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<span class="tc-toc-caption tc-tiny-gap-left">
|
<span class="tc-toc-caption">
|
||||||
<$set name="tv-wikilinks" value="no">
|
<$set name="tv-wikilinks" value="no">
|
||||||
<$transclude field="caption">
|
<$transclude field="caption">
|
||||||
<$view field="title"/>
|
<$view field="title"/>
|
||||||
@@ -19,9 +19,9 @@ tags: $:/tags/Macro
|
|||||||
\define toc-body(tag,sort:"",itemClassFilter,exclude,path)
|
\define toc-body(tag,sort:"",itemClassFilter,exclude,path)
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<ol class="tc-toc">
|
<ol class="tc-toc">
|
||||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
|
||||||
<$let item=<<currentTiddler>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
<$let item=<<currentTiddler>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
||||||
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
<$set name="excluded" filter="""[enlist<__exclude__>] [<__tag__>]""">
|
||||||
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
||||||
<li class=<<toc-item-class>>>
|
<li class=<<toc-item-class>>>
|
||||||
<$list filter="[all[current]toc-link[no]]" emptyMessage="<$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}><<toc-caption>></$link>">
|
<$list filter="[all[current]toc-link[no]]" emptyMessage="<$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}><<toc-caption>></$link>">
|
||||||
@@ -36,8 +36,8 @@ tags: $:/tags/Macro
|
|||||||
</ol>
|
</ol>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define toc(tag,sort:"",itemClassFilter:"", exclude)
|
\define toc(tag,sort:"",itemClassFilter:"")
|
||||||
<$macrocall $name="toc-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<__exclude__>>/>
|
<$macrocall $name="toc-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> />
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define toc-linked-expandable-body(tag,sort:"",itemClassFilter,exclude,path)
|
\define toc-linked-expandable-body(tag,sort:"",itemClassFilter,exclude,path)
|
||||||
@@ -75,7 +75,7 @@ tags: $:/tags/Macro
|
|||||||
<li class=<<toc-item-class>>>
|
<li class=<<toc-item-class>>>
|
||||||
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
||||||
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
||||||
<$transclude tiddler=<<toc-closed-icon>> />
|
<$transclude tiddler=<<toc-closed-icon>> />
|
||||||
<<toc-caption>>
|
<<toc-caption>>
|
||||||
</$button>
|
</$button>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
@@ -100,9 +100,9 @@ tags: $:/tags/Macro
|
|||||||
\define toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path)
|
\define toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path)
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$let tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
<$let tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
||||||
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
<$set name="excluded" filter="""[enlist<__exclude__>] [<__tag__>]""">
|
||||||
<ol class="tc-toc toc-expandable">
|
<ol class="tc-toc toc-expandable">
|
||||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
|
||||||
<$list filter="[all[current]toc-link[no]]" emptyMessage=<<toc-expandable-empty-message>> >
|
<$list filter="[all[current]toc-link[no]]" emptyMessage=<<toc-expandable-empty-message>> >
|
||||||
<$macrocall $name="toc-unlinked-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="""itemClassFilter""" exclude=<<excluded>> path=<<path>> />
|
<$macrocall $name="toc-unlinked-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="""itemClassFilter""" exclude=<<excluded>> path=<<path>> />
|
||||||
</$list>
|
</$list>
|
||||||
@@ -145,7 +145,7 @@ tags: $:/tags/Macro
|
|||||||
<$qualify name="toc-state" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>
|
<$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">
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
||||||
<li class=<<toc-item-class>>>
|
<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><span class="toc-item-muted"><<toc-caption>></span>""">
|
<$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>">
|
||||||
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
||||||
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
||||||
<$transclude tiddler=<<toc-closed-icon>> />
|
<$transclude tiddler=<<toc-closed-icon>> />
|
||||||
@@ -174,9 +174,9 @@ tags: $:/tags/Macro
|
|||||||
\define toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path)
|
\define toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path)
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$let tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
<$let tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
||||||
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
<$set name="excluded" filter="[enlist<__exclude__>] [<__tag__>]">
|
||||||
<ol class="tc-toc toc-selective-expandable">
|
<ol class="tc-toc toc-selective-expandable">
|
||||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
|
||||||
<$list filter="[all[current]toc-link[no]]" variable="ignore" emptyMessage=<<toc-selective-expandable-empty-message>> >
|
<$list filter="[all[current]toc-link[no]]" variable="ignore" emptyMessage=<<toc-selective-expandable-empty-message>> >
|
||||||
<$macrocall $name="toc-unlinked-selective-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>>/>
|
<$macrocall $name="toc-unlinked-selective-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>>/>
|
||||||
</$list>
|
</$list>
|
||||||
@@ -186,13 +186,13 @@ tags: $:/tags/Macro
|
|||||||
</$let>
|
</$let>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude)
|
\define toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"")
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$tiddler tiddler={{{ [<__selectedTiddler__>get[text]] }}}>
|
<$tiddler tiddler={{{ [<__selectedTiddler__>get[text]] }}}>
|
||||||
<div class="tc-tabbed-table-of-contents">
|
<div class="tc-tabbed-table-of-contents">
|
||||||
<$linkcatcher to=<<__selectedTiddler__>>>
|
<$linkcatcher to=<<__selectedTiddler__>>>
|
||||||
<div class="tc-table-of-contents">
|
<div class="tc-table-of-contents">
|
||||||
<$macrocall $name="toc-selective-expandable" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="[all[current]] -[<__selectedTiddler__>get[text]]" exclude=<<__exclude__>>/>
|
<$macrocall $name="toc-selective-expandable" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="[all[current]] -[<__selectedTiddler__>get[text]]"/>
|
||||||
</div>
|
</div>
|
||||||
</$linkcatcher>
|
</$linkcatcher>
|
||||||
<div class="tc-tabbed-table-of-contents-content">
|
<div class="tc-tabbed-table-of-contents-content">
|
||||||
@@ -210,9 +210,9 @@ tags: $:/tags/Macro
|
|||||||
</$tiddler>
|
</$tiddler>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define toc-tabbed-internal-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude)
|
\define toc-tabbed-internal-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"")
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$linkcatcher to=<<__selectedTiddler__>>>
|
<$linkcatcher to=<<__selectedTiddler__>>>
|
||||||
<$macrocall $name="toc-tabbed-external-nav" tag=<<__tag__>> sort=<<__sort__>> selectedTiddler=<<__selectedTiddler__>> unselectedText=<<__unselectedText__>> missingText=<<__missingText__>> template=<<__template__>> exclude=<<__exclude__>> />
|
<$macrocall $name="toc-tabbed-external-nav" tag=<<__tag__>> sort=<<__sort__>> selectedTiddler=<<__selectedTiddler__>> unselectedText=<<__unselectedText__>> missingText=<<__missingText__>> template=<<__template__>>/>
|
||||||
</$linkcatcher>
|
</$linkcatcher>
|
||||||
\end
|
\end
|
||||||
|
|||||||
@@ -3,26 +3,14 @@ tags: $:/tags/Macro
|
|||||||
|
|
||||||
\define translink(title,mode:"block")
|
\define translink(title,mode:"block")
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$list filter="[<__mode__>match[block]]">
|
<div style="border:1px solid #ccc; padding: 0.5em; background: black; foreground; white;">
|
||||||
<div class="tc-translink">
|
|
||||||
<div>
|
|
||||||
<$link to="""$title$""">
|
|
||||||
<h1><$text text="""$title$"""/></h1>
|
|
||||||
</$link>
|
|
||||||
<$transclude tiddler="""$title$""" mode="block">
|
|
||||||
<$set name="currentTiddler" value="""$title$"""><$transclude tiddler="$:/language/MissingTiddler/Hint"/></$set>
|
|
||||||
</$transclude>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</$list>
|
|
||||||
<$list filter="[<__mode__>match[inline]]">
|
|
||||||
<span class="tc-translink">
|
|
||||||
<$link to="""$title$""">
|
<$link to="""$title$""">
|
||||||
<$text text="""$title$"""/>
|
<$text text="""$title$"""/>
|
||||||
</$link>
|
</$link>
|
||||||
 (<$transclude tiddler="""$title$""" mode="inline">
|
<div style="border:1px solid #ccc; padding: 0.5em; background: white; foreground; black;">
|
||||||
<$set name="currentTiddler" value="""$title$"""><$transclude tiddler="$:/language/MissingTiddler/Hint"/></$set>
|
<$transclude tiddler="""$title$""" mode="$mode$">
|
||||||
</$transclude>)
|
"<$text text="""$title$"""/>" is missing
|
||||||
</span>
|
</$transclude>
|
||||||
</$list>
|
</div>
|
||||||
|
</div>
|
||||||
\end
|
\end
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
title: $:/tags/PageControls
|
title: $:/tags/PageControls
|
||||||
list: [[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/fold-all]] [[$:/core/ui/Buttons/unfold-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/new-journal]] [[$:/core/ui/Buttons/new-image]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/export-page]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/advanced-search]] [[$:/core/ui/Buttons/manager]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/palette]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/layout]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/timestamp]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/print]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/refresh]] [[$:/core/ui/Buttons/network-activity]] [[$:/core/ui/Buttons/more-page-actions]]
|
list: [[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/fold-all]] [[$:/core/ui/Buttons/unfold-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/new-journal]] [[$:/core/ui/Buttons/new-image]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/export-page]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/advanced-search]] [[$:/core/ui/Buttons/manager]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/palette]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/layout]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/timestamp]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/print]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/refresh]] [[$:/core/ui/Buttons/more-page-actions]]
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
title: $:/tags/ViewTemplateBodyFilter
|
title: $:/tags/ViewTemplateBodyFilter
|
||||||
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
|
list: $:/config/ViewTemplateBodyFilters/hide-body $:/config/ViewTemplateBodyFilters/code-body $:/config/ViewTemplateBodyFilters/stylesheet $:/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",
|
"file": "../../../tw5.com/tiddlers/images/New Release Banner.png",
|
||||||
"fields": {
|
"fields": {
|
||||||
"type": "image/jpeg",
|
"type": "image/jpg",
|
||||||
"title": "New Release Banner",
|
"title": "New Release Banner",
|
||||||
"tags": "picture"
|
"tags": "picture"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
created: 20230601123245916
|
|
||||||
modified: 20230601125015463
|
|
||||||
title: Widget `destroy` method examples
|
|
||||||
type: text/vnd.tiddlywiki
|
|
||||||
|
|
||||||
!! When using a v-dom library
|
|
||||||
|
|
||||||
Virtual DOM libraries manages its internal state and apply state to DOM periodically, this is so called [["controlled" component|https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components]]. When Tiddlywiki remove a DOM element controlled by a v-dom library, it may throws error.
|
|
||||||
|
|
||||||
So when creating a plugin providing v-dom library binding, you need to tell v-dom library (for example, React.js) the DOM element is removed. We will use `destroy` method for this.
|
|
||||||
|
|
||||||
```js
|
|
||||||
render() {
|
|
||||||
// ...other render related code
|
|
||||||
if (this.root === undefined || this.containerElement === undefined) {
|
|
||||||
// initialize the v-dom library
|
|
||||||
this.root = ReactDom.createRoot(document.createElement('div'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
destroy() {
|
|
||||||
// end the lifecycle of v-dom library
|
|
||||||
this.root && this.root.unmount();
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
The `destroy` method will be called by parent widget. If you widget don't have any child widget, you can just write your own tear down logic. If it may have some child widget, don't forget to call original `destroy` method in the `Widget` class to destroy children widgets.
|
|
||||||
|
|
||||||
```js
|
|
||||||
Widget.prototype.destroy();
|
|
||||||
this.root && this.root.unmount();
|
|
||||||
/** if you are using ESNext
|
|
||||||
super.destroy();
|
|
||||||
this.root?.unmount();
|
|
||||||
*/
|
|
||||||
```
|
|
||||||
@@ -2,7 +2,7 @@ modified: 20141013085608911
|
|||||||
tags: Mechanisms
|
tags: Mechanisms
|
||||||
title: TestingMechanism
|
title: TestingMechanism
|
||||||
|
|
||||||
TiddlyWiki5 incorporates the Jasmine JavaScript testing framework (see https://jasmine.github.io/). It allows the same tests to be run both in the browser and under Node.js.
|
TiddlyWiki5 incorporates the Jasmine JavaScript testing framework (see http://pivotal.github.io/jasmine/). It allows the same tests to be run both in the browser and under Node.js.
|
||||||
|
|
||||||
! TiddlyWiki5 Testing Components
|
! TiddlyWiki5 Testing Components
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
created: 20131101130700000
|
|
||||||
modified: 20230601130631884
|
|
||||||
tags: dev moduletypes
|
|
||||||
title: WidgetModules
|
title: WidgetModules
|
||||||
type: text/vnd.tiddlywiki
|
tags: dev moduletypes
|
||||||
|
created: 201311011307
|
||||||
|
modified: 201311011307
|
||||||
|
|
||||||
! Introduction
|
! Introduction
|
||||||
|
|
||||||
@@ -79,10 +78,4 @@ The individual methods defined by the widget object are documented in the source
|
|||||||
!! Widget `refreshChildren` method
|
!! Widget `refreshChildren` method
|
||||||
!! Widget `findNextSiblingDomNode` method
|
!! Widget `findNextSiblingDomNode` method
|
||||||
!! Widget `findFirstDomNode` method
|
!! Widget `findFirstDomNode` method
|
||||||
!! Widget `destroy` method
|
|
||||||
|
|
||||||
<<.from-version "5.3.0">> Gets called when any parent widget is unmounted from the widget tree.
|
|
||||||
|
|
||||||
[[Examples|Widget `destroy` method examples]]
|
|
||||||
|
|
||||||
!! Widget `removeChildDomNodes` method
|
!! Widget `removeChildDomNodes` method
|
||||||
|
|||||||
@@ -15,10 +15,6 @@
|
|||||||
<div id="draggable" draggable="true">
|
<div id="draggable" draggable="true">
|
||||||
Drag me to a TiddlyWiki window
|
Drag me to a TiddlyWiki window
|
||||||
</div>
|
</div>
|
||||||
<button id="copy">
|
|
||||||
Click to copy two tiddlers to the clipboard
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
@@ -34,18 +30,6 @@
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("copy").addEventListener("click",function(event) {
|
|
||||||
|
|
||||||
function listener(event) {
|
|
||||||
event.clipboardData.setData("URL","data:text/vnd.tiddler," + encodeURIComponent(JSON.stringify(tiddlerData)));
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener("copy",listener);
|
|
||||||
document.execCommand("copy");
|
|
||||||
document.removeEventListener("copy",listener);
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
title: $:/config/WikiParserRules/Inline/wikilink
|
|
||||||
|
|
||||||
enable
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
created: 20150117152612000
|
|
||||||
modified: 20230325101137075
|
|
||||||
tags: $:/tags/Stylesheet
|
|
||||||
title: $:/editions/tw5.com/doc-styles
|
|
||||||
type: text/vnd.tiddlywiki
|
|
||||||
|
|
||||||
a.doc-from-version.tc-tiddlylink {
|
|
||||||
display: inline-block;
|
|
||||||
border-radius: 1em;
|
|
||||||
background: <<colour muted-foreground>>;
|
|
||||||
color: <<colour background>>;
|
|
||||||
fill: <<colour background>>;
|
|
||||||
padding: 0 0.4em;
|
|
||||||
font-size: 0.7em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 1.5;
|
|
||||||
vertical-align: text-bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.doc-deprecated-version.tc-tiddlylink {
|
|
||||||
display: inline-block;
|
|
||||||
border-radius: 1em;
|
|
||||||
background: red;
|
|
||||||
color: <<colour background>>;
|
|
||||||
fill: <<colour background>>;
|
|
||||||
padding: 0 0.4em;
|
|
||||||
font-size: 0.7em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 1.5;
|
|
||||||
vertical-align: text-bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
.doc-deprecated-version svg,
|
|
||||||
.doc-from-version svg {
|
|
||||||
width: 1em;
|
|
||||||
height: 1em;
|
|
||||||
vertical-align: text-bottom;
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
code-body: yes
|
|
||||||
created: 20161008085627406
|
|
||||||
modified: 20221007122259593
|
|
||||||
tags: $:/tags/Macro
|
|
||||||
title: $:/editions/tw5.com/version-macros
|
|
||||||
type: text/vnd.tiddlywiki
|
|
||||||
|
|
||||||
\define .from-version(version)
|
|
||||||
<$link to={{{ [<__version__>addprefix[Release ]] }}} class="doc-from-version">{{$:/core/images/warning}} New in: <$text text=<<__version__>>/></$link>
|
|
||||||
\end
|
|
||||||
|
|
||||||
\define .deprecated-since(version, superseded:"TODO-Link")
|
|
||||||
<$link to="Deprecated - What does it mean" class="doc-deprecated-version tc-btn-invisible">{{$:/core/images/warning}} Deprecated since: <$text text=<<__version__>>/></$link> (see <$link to=<<__superseded__>>><$text text=<<__superseded__>>/></$link>)
|
|
||||||
\end
|
|
||||||
@@ -5,7 +5,7 @@ title: $:/core/ui/ViewTemplate
|
|||||||
$:/state/folded/$(currentTiddler)$
|
$:/state/folded/$(currentTiddler)$
|
||||||
\end
|
\end
|
||||||
\define cancel-delete-tiddler-actions(message) <$action-sendmessage $message="tm-$message$-tiddler"/>
|
\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]]
|
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!has[draft.of]]
|
||||||
<$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify "$:/state/popup/tiddler-info">>>
|
<$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify "$:/state/popup/tiddler-info">>>
|
||||||
<div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{ 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[ ]] }}}>
|
<div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{ 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[ ]] }}}>
|
||||||
<$set name="state" value={{{ [[$:/state/viewtemplate/visibility/]addsuffix<currentTiddler>] }}}>
|
<$set name="state" value={{{ [[$:/state/viewtemplate/visibility/]addsuffix<currentTiddler>] }}}>
|
||||||
|
|||||||
@@ -12,9 +12,6 @@
|
|||||||
"empty": [
|
"empty": [
|
||||||
"--render","$:/core/save/all","empty.html","text/plain",
|
"--render","$:/core/save/all","empty.html","text/plain",
|
||||||
"--render","$:/core/save/all","empty.hta","text/plain"],
|
"--render","$:/core/save/all","empty.hta","text/plain"],
|
||||||
"emptyexternalcore": [
|
|
||||||
"--render","$:/core/save/offline-external-js","empty-external-core.html","text/plain",
|
|
||||||
"--render","$:/core/templates/tiddlywiki5.js","[[tiddlywikicore-]addsuffix<version>addsuffix[.js]]","text/plain"],
|
|
||||||
"externalimages": [
|
"externalimages": [
|
||||||
"--savetiddlers","[is[image]]","images",
|
"--savetiddlers","[is[image]]","images",
|
||||||
"--setfield","[is[image]]","_canonical_uri","$:/core/templates/canonical-uri-external-image","text/plain",
|
"--setfield","[is[image]]","_canonical_uri","$:/core/templates/canonical-uri-external-image","text/plain",
|
||||||
@@ -23,7 +20,7 @@
|
|||||||
"static": [
|
"static": [
|
||||||
"--render","$:/core/templates/static.template.html","static.html","text/plain",
|
"--render","$:/core/templates/static.template.html","static.html","text/plain",
|
||||||
"--render","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
|
"--render","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
|
||||||
"--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain",
|
"--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain",
|
||||||
"--render","$:/core/templates/static.template.css","static/static.css","text/plain"]
|
"--render","$:/core/templates/static.template.css","static/static.css","text/plain"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user