1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-07-15 08:12:45 +00:00

Compare commits

..

43 Commits

Author SHA1 Message Date
Jeremy Ruston 769969f69f Prepare for merging 2024-05-20 11:29:43 +01:00
Jeremy Ruston 7ca70c94d4 Merge branch 'master' into testcase-widget 2024-05-20 11:25:55 +01:00
Jeremy Ruston eb4e9d86ac Fix handling of currentTiddler variable
Fixes problem reported by @btheado in https://github.com/Jermolene/TiddlyWiki5/pull/7817#issuecomment-2103704468
2024-05-15 12:37:25 +01:00
Jeremy Ruston 4234aa968e "Test case" should be two words 2024-05-09 08:16:30 +01:00
Jeremy Ruston 5a7f958c64 Don't reference the geospatial plugin 2024-05-08 22:13:45 +01:00
Jeremy Ruston 3751a883f5 Use the view template body for failing tests 2024-05-08 22:13:33 +01:00
Jeremy Ruston 5c34d273bd Rename $:/core/ui/testcases/DefaultTemplate/SourceTabs from $:/core/ui/testcases/DefaultTemplate/Source 2024-05-08 22:13:21 +01:00
Jeremy Ruston 4f19f0a66b Docs update 2024-05-08 18:03:24 +01:00
Jeremy Ruston 70f68c7cc2 Simplify template 2024-05-08 18:03:16 +01:00
Jeremy Ruston 400514f52f Remove obsolete code comments 2024-05-08 18:03:07 +01:00
Jeremy Ruston 6b7cf37f36 Cleanup comments 2024-05-08 18:02:55 +01:00
Jeremy Ruston edc6661948 Documentation improvements 2024-05-08 17:50:27 +01:00
Jeremy Ruston 8207b80f9f Add support for narrative tiddlers in test cases 2024-05-08 13:26:14 +01:00
Jeremy Ruston 53908b792e Wording tweak 2024-05-08 13:25:26 +01:00
Jeremy Ruston a856d0b322 Docs update for 648855e8a5 2024-05-07 19:13:14 +01:00
Jeremy Ruston 648855e8a5 Links in testcase output switch to the tab containing that tiddler
Thanks to @btheado for the suggestion
2024-05-07 19:09:38 +01:00
Jeremy Ruston 83ebfc67fb Fix data widget not refreshing 2024-05-07 18:33:53 +01:00
Jeremy Ruston d5b7bc7d41 DataWidget docs typo 2024-05-06 21:56:49 +01:00
Jeremy Ruston 00ac5503d9 Extend testcase default template so that the display format can be chosen
It is selected by setting the variable "displayFormat"
2024-05-06 21:56:35 +01:00
Jeremy Ruston 43fe5e9523 Don't expect our intentionally failing test to pass 2024-05-06 15:43:17 +01:00
Jeremy Ruston 0db4c44939 Clearer testcases for data widget, and docs tweaks 2024-05-06 15:37:03 +01:00
Jeremy Ruston ff03a1bfc4 Add testcase convenience procedure 2024-05-06 15:36:26 +01:00
Jeremy Ruston 1d89c7925a Update data widget to display its content in JSON 2024-05-06 15:34:42 +01:00
Jeremy Ruston e378c6c4c9 Run the new tw5.com testcases in the test edition 2024-05-06 15:34:12 +01:00
Jeremy Ruston e8a3ffdffc Styling tweaks 2024-05-05 22:25:55 +01:00
Jeremy Ruston 6b4bd4728a Docs improvements 2024-05-05 21:55:07 +01:00
Jeremy Ruston 08913314c5 Styling tweaks 2024-05-05 21:54:53 +01:00
Jeremy Ruston 39d463337b Make testcase tiddler tempalte link to itself 2024-05-05 21:54:11 +01:00
Jeremy Ruston d361a1e3cf Whitespace fixes 2024-05-05 19:34:48 +01:00
Jeremy Ruston 4758b6afb9 Test edition should display testcases 2024-05-05 13:55:21 +01:00
Jeremy Ruston fa9e643e54 Add a view template body template to render testcase tiddlers 2024-05-05 13:55:06 +01:00
Jeremy Ruston 1be73ad664 Add testcases to control panel 2024-05-05 13:54:45 +01:00
Jeremy Ruston 57e74a0ad5 Extend the testcase widget to run tests 2024-05-05 13:54:02 +01:00
Jeremy Ruston 22ad43954e Use different background colours for nested testcase widgets 2024-05-05 13:45:41 +01:00
Jeremy Ruston 17e939fa2c Don't duplicate "description" field in test cases 2024-05-02 22:37:26 +01:00
Jeremy Ruston f0d6779dd3 Merge branch 'master' into testcase-widget 2024-05-02 14:13:19 +01:00
Jeremy Ruston 44010812bd Merge branch 'master' into testcase-widget 2023-12-11 15:21:15 +00:00
Jeremy Ruston 2c07310cd3 Merge branch 'master' into testcase-widget 2023-11-21 12:39:45 +00:00
Jeremy Ruston a32d5143ae Fix crash with unset $tiddler attribute on <$data> widget
Thanks @CodaCodr
2023-10-31 16:52:22 +00:00
Jeremy Ruston 5eae32d762 Fix whitespace and indenting
Thanks @pmario
2023-10-31 13:56:19 +00:00
Jeremy Ruston 81f1994bbf Merge branch 'master' into testcase-widget 2023-10-31 13:54:55 +00:00
Jeremy Ruston 86507baa60 Add note to preview build 2023-10-27 14:30:07 +01:00
Jeremy Ruston 497c56d3fa Initial Commit 2023-10-26 16:56:15 +01:00
467 changed files with 894 additions and 24868 deletions
+1 -12
View File
@@ -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.5 TW5_BUILD_VERSION=v5.3.3
fi fi
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]" echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
@@ -393,17 +393,6 @@ node $TW5_BUILD_TIDDLYWIKI \
--rendertiddler $:/core/save/empty plugins/tiddlywiki/highlight/empty.html text/plain \ --rendertiddler $:/core/save/empty plugins/tiddlywiki/highlight/empty.html text/plain \
|| exit 1 || exit 1
# /plugins/tiddlywiki/geospatial/index.html Demo wiki with geospatial plugin
# /plugins/tiddlywiki/geospatial/empty.html Empty wiki with geospatial plugin
node $TW5_BUILD_TIDDLYWIKI \
./editions/geospatialdemo \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/geospatial/index.html text/plain \
--rendertiddler $:/core/save/empty plugins/tiddlywiki/geospatial/empty.html text/plain \
|| exit 1
###################################################### ######################################################
# #
# Language editions # Language editions
+22 -25
View File
@@ -142,15 +142,15 @@ $tw.utils.each = function(object,callback) {
var next,f,length; var next,f,length;
if(object) { if(object) {
if(Object.prototype.toString.call(object) == "[object Array]") { if(Object.prototype.toString.call(object) == "[object Array]") {
for(f=0, length=object.length; f<length; f++) { for (f=0, length=object.length; f<length; f++) {
next = callback(object[f],f,object); next = callback(object[f],f,object);
if(next === false) { if(next === false) {
break; break;
} }
} }
} else { } else {
var keys = Object.keys(object); var keys = Object.keys(object);
for(f=0, length=keys.length; f<length; f++) { for (f=0, length=keys.length; f<length; f++) {
var key = keys[f]; var key = keys[f];
next = callback(object[key],key,object); next = callback(object[key],key,object);
if(next === false) { if(next === false) {
@@ -275,7 +275,7 @@ Extend an object with the properties from a list of source objects
$tw.utils.extend = function(object /*, sourceObjectList */) { $tw.utils.extend = function(object /*, sourceObjectList */) {
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) { $tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
if(source) { if(source) {
for(var p in source) { for (var p in source) {
object[p] = source[p]; object[p] = source[p];
} }
} }
@@ -289,7 +289,7 @@ Fill in any null or undefined properties of an object with the properties from a
$tw.utils.deepDefaults = function(object /*, sourceObjectList */) { $tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) { $tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
if(source) { if(source) {
for(var p in source) { for (var p in source) {
if(object[p] === null || object[p] === undefined) { if(object[p] === null || object[p] === undefined) {
object[p] = source[p]; object[p] = source[p];
} }
@@ -893,8 +893,8 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
} else { } else {
/* /*
CommonJS optional require.main property: CommonJS optional require.main property:
In a browser we offer a fake main module which points back to the boot function In a browser we offer a fake main module which points back to the boot function
(Theoretically, this may allow TW to eventually load itself as a module in the browser) (Theoretically, this may allow TW to eventually load itself as a module in the browser)
*/ */
Object.defineProperty(sandbox.require, "main", { Object.defineProperty(sandbox.require, "main", {
value: (typeof(require) !== "undefined") ? require.main : {TiddlyWiki: _boot}, value: (typeof(require) !== "undefined") ? require.main : {TiddlyWiki: _boot},
@@ -936,9 +936,9 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
moduleInfo.exports = moduleInfo.definition; moduleInfo.exports = moduleInfo.definition;
} }
} catch(e) { } catch(e) {
if(e instanceof SyntaxError) { if (e instanceof SyntaxError) {
var line = e.lineNumber || e.line; // Firefox || Safari var line = e.lineNumber || e.line; // Firefox || Safari
if(typeof(line) != "undefined" && line !== null) { if (typeof(line) != "undefined" && line !== null) {
$tw.utils.error("Syntax error in boot module " + name + ":" + line + ":\n" + e.stack); $tw.utils.error("Syntax error in boot module " + name + ":" + line + ":\n" + e.stack);
} else if(!$tw.browser) { } else if(!$tw.browser) {
// this is the only way to get node.js to display the line at which the syntax error appeared, // this is the only way to get node.js to display the line at which the syntax error appeared,
@@ -1533,7 +1533,7 @@ Define all modules stored in ordinary tiddlers
$tw.Wiki.prototype.defineTiddlerModules = function() { $tw.Wiki.prototype.defineTiddlerModules = function() {
this.each(function(tiddler,title) { this.each(function(tiddler,title) {
if(tiddler.hasField("module-type")) { if(tiddler.hasField("module-type")) {
switch(tiddler.fields.type) { switch (tiddler.fields.type) {
case "application/javascript": case "application/javascript":
// We only define modules that haven't already been defined, because in the browser modules in system tiddlers are defined in inline script // We only define modules that haven't already been defined, because in the browser modules in system tiddlers are defined in inline script
if(!$tw.utils.hop($tw.modules.titles,tiddler.fields.title)) { if(!$tw.utils.hop($tw.modules.titles,tiddler.fields.title)) {
@@ -2043,7 +2043,7 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
arrayOfFiles = arrayOfFiles || []; arrayOfFiles = arrayOfFiles || [];
var files = fs.readdirSync(dirPath); var files = fs.readdirSync(dirPath);
files.forEach(function(file) { files.forEach(function(file) {
if(recurse && fs.statSync(dirPath + path.sep + file).isDirectory()) { if (recurse && fs.statSync(dirPath + path.sep + file).isDirectory()) {
arrayOfFiles = getAllFiles(dirPath + path.sep + file, recurse, arrayOfFiles); arrayOfFiles = getAllFiles(dirPath + path.sep + file, recurse, arrayOfFiles);
} else if(fs.statSync(dirPath + path.sep + file).isFile()){ } else if(fs.statSync(dirPath + path.sep + file).isFile()){
arrayOfFiles.push(path.join(dirPath, path.sep, file)); arrayOfFiles.push(path.join(dirPath, path.sep, file));
@@ -2188,16 +2188,13 @@ Returns an array of search paths
*/ */
$tw.getLibraryItemSearchPaths = function(libraryPath,envVar) { $tw.getLibraryItemSearchPaths = function(libraryPath,envVar) {
var pluginPaths = [path.resolve($tw.boot.corePath,libraryPath)], var pluginPaths = [path.resolve($tw.boot.corePath,libraryPath)],
env;
if(envVar) {
env = process.env[envVar]; env = process.env[envVar];
if(env) { if(env) {
env.split(path.delimiter).map(function(item) { env.split(path.delimiter).map(function(item) {
if(item) { if(item) {
pluginPaths.push(item); pluginPaths.push(item);
} }
}); });
}
} }
return pluginPaths; return pluginPaths;
}; };
@@ -2283,7 +2280,7 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
} }
$tw.wiki.addTiddlers(tiddlerFile.tiddlers); $tw.wiki.addTiddlers(tiddlerFile.tiddlers);
}); });
if($tw.boot.wikiPath == wikiPath) { if ($tw.boot.wikiPath == wikiPath) {
// Save the original tiddler file locations if requested // Save the original tiddler file locations if requested
var output = {}, relativePath, fileInfo; var output = {}, relativePath, fileInfo;
for(var title in $tw.boot.files) { for(var title in $tw.boot.files) {
@@ -2637,14 +2634,14 @@ $tw.boot.doesTaskMatchPlatform = function(taskModule) {
var platforms = taskModule.platforms; var platforms = taskModule.platforms;
if(platforms) { if(platforms) {
for(var t=0; t<platforms.length; t++) { for(var t=0; t<platforms.length; t++) {
switch(platforms[t]) { switch (platforms[t]) {
case "browser": case "browser":
if($tw.browser) { if ($tw.browser) {
return true; return true;
} }
break; break;
case "node": case "node":
if($tw.node) { if ($tw.node) {
return true; return true;
} }
break; break;
@@ -2727,7 +2724,7 @@ Invoke the hook by key
$tw.hooks.invokeHook = function(hookName /*, value,... */) { $tw.hooks.invokeHook = function(hookName /*, value,... */) {
var args = Array.prototype.slice.call(arguments,1); var args = Array.prototype.slice.call(arguments,1);
if($tw.utils.hop($tw.hooks.names,hookName)) { if($tw.utils.hop($tw.hooks.names,hookName)) {
for(var i = 0; i < $tw.hooks.names[hookName].length; i++) { for (var i = 0; i < $tw.hooks.names[hookName].length; i++) {
args[0] = $tw.hooks.names[hookName][i].apply(null,args); args[0] = $tw.hooks.names[hookName][i].apply(null,args);
} }
} }
+3
View File
@@ -0,0 +1,3 @@
title: $:/library/sjcl.js
type: application/javascript
library: yes
-32
View File
@@ -1,32 +0,0 @@
{
"tiddlers": [
{
"file": "sjcl.js",
"fields": {
"title": "$:/library/sjcl.js",
"type": "application/javascript",
"library": "yes"
},
"prefix": "(function(define) {\n",
"suffix": "\n})(function (_,defined){window.sjcl = defined()})\n"
},
{
"file": "boot.js",
"fields": {
"title": "$:/boot/boot.js",
"type": "application/javascript"
}
},
{
"file": "bootprefix.js",
"fields": {
"title": "$:/boot/bootprefix.js",
"type": "application/javascript"
}
},
{
"file": "boot.css.tid",
"isTiddlerFile": true
}
]
}
+1 -1
View File
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
title: $:/core/images/standard-layout title: $:/core/images/default-layout
tags: $:/tags/Image tags: $:/tags/Image
\parameters (size:"22pt") \parameters (size:"22pt")
<svg width=<<size>> height=<<size>> class="tc-image-standard-layout tc-image-button" viewBox="0 0 128 128"> <svg width=<<size>> height=<<size>> class="tc-image-default-layout tc-image-button" viewBox="0 0 128 128">
<path d="M71.93 72A8.07 8.07 0 0 1 80 80.07v7.86A8.071 8.071 0 0 1 71.93 96H8.07A8.067 8.067 0 0 1 0 87.93v-7.86A8.072 8.072 0 0 1 8.07 72h63.86Zm0 32a8.07 8.07 0 0 1 8.07 8.07v7.86a8.071 8.071 0 0 1-8.07 8.07H8.07A8.067 8.067 0 0 1 0 119.93v-7.86A8.072 8.072 0 0 1 8.07 104h63.86Zm0-104A8.068 8.068 0 0 1 80 8.07v47.86A8.073 8.073 0 0 1 71.93 64H8.07A8.07 8.07 0 0 1 0 55.93V8.07A8.072 8.072 0 0 1 8.07 0h63.86Zm48 0c2.14 0 4.193.85 5.706 2.364A8.067 8.067 0 0 1 128 8.07v111.86c0 2.14-.85 4.193-2.364 5.706A8.067 8.067 0 0 1 119.93 128H96.07c-2.14 0-4.193-.85-5.706-2.364A8.067 8.067 0 0 1 88 119.93V8.07c0-2.14.85-4.193 2.364-5.706A8.067 8.067 0 0 1 96.07 0h23.86ZM116 24h-16a3.995 3.995 0 0 0-2.828 1.172 3.995 3.995 0 0 0 0 5.656A3.995 3.995 0 0 0 100 32h16a3.995 3.995 0 0 0 2.828-1.172 3.995 3.995 0 0 0 0-5.656A3.995 3.995 0 0 0 116 24Z"/> <path d="M71.93 72A8.07 8.07 0 0 1 80 80.07v7.86A8.071 8.071 0 0 1 71.93 96H8.07A8.067 8.067 0 0 1 0 87.93v-7.86A8.072 8.072 0 0 1 8.07 72h63.86Zm0 32a8.07 8.07 0 0 1 8.07 8.07v7.86a8.071 8.071 0 0 1-8.07 8.07H8.07A8.067 8.067 0 0 1 0 119.93v-7.86A8.072 8.072 0 0 1 8.07 104h63.86Zm0-104A8.068 8.068 0 0 1 80 8.07v47.86A8.073 8.073 0 0 1 71.93 64H8.07A8.07 8.07 0 0 1 0 55.93V8.07A8.072 8.072 0 0 1 8.07 0h63.86Zm48 0c2.14 0 4.193.85 5.706 2.364A8.067 8.067 0 0 1 128 8.07v111.86c0 2.14-.85 4.193-2.364 5.706A8.067 8.067 0 0 1 119.93 128H96.07c-2.14 0-4.193-.85-5.706-2.364A8.067 8.067 0 0 1 88 119.93V8.07c0-2.14.85-4.193 2.364-5.706A8.067 8.067 0 0 1 96.07 0h23.86ZM116 24h-16a3.995 3.995 0 0 0-2.828 1.172 3.995 3.995 0 0 0 0 5.656A3.995 3.995 0 0 0 100 32h16a3.995 3.995 0 0 0 2.828-1.172 3.995 3.995 0 0 0 0-5.656A3.995 3.995 0 0 0 116 24Z"/>
</svg> </svg>
-5
View File
@@ -1,5 +0,0 @@
title: $:/core/images/input-button
tags: $:/tags/Image
\parameters (size:"22pt")
<svg width=<<size>> height=<<size>> class="tc-image-input-button tc-image-button" viewBox="0 0 22 22"><path d="M1.375 22h19.249c.365 0 .716-.145.973-.404v.001c.258-.257.404-.607.403-.972v-11a1.376 1.376 0 0 0-2.75 0v9.625H2.75V9.625a1.376 1.376 0 0 0-2.75 0v11C0 21.384.617 22 1.375 22Z"/><path d="m9.732 11.904-1.541-1.541a1.375 1.375 0 1 0-1.944 1.944l3.887 3.888c.258.258.608.402.973.402h-.001c.353 0 .705-.134.974-.402l3.888-3.889a1.376 1.376 0 0 0 .001-1.944 1.377 1.377 0 0 0-1.946 0l-1.541 1.542V1.376a1.375 1.375 0 1 0-2.75 0v10.528Z"/></svg>
-2
View File
@@ -104,8 +104,6 @@ ShowSideBar/Caption: show sidebar
ShowSideBar/Hint: Show sidebar ShowSideBar/Hint: Show sidebar
TagManager/Caption: tag manager TagManager/Caption: tag manager
TagManager/Hint: Open tag manager TagManager/Hint: Open tag manager
TestCaseImport/Caption: import tiddlers
TestCaseImport/Hint: Import tiddlers
Timestamp/Caption: timestamps Timestamp/Caption: timestamps
Timestamp/Hint: Choose whether modifications update timestamps Timestamp/Hint: Choose whether modifications update timestamps
Timestamp/On/Caption: timestamps are on Timestamp/On/Caption: timestamps are on
@@ -65,10 +65,6 @@ sidebar-tab-foreground-selected: Sidebar tab foreground for selected tabs
sidebar-tab-foreground: Sidebar tab foreground sidebar-tab-foreground: Sidebar tab foreground
sidebar-tiddler-link-foreground-hover: Sidebar tiddler link foreground hover sidebar-tiddler-link-foreground-hover: Sidebar tiddler link foreground hover
sidebar-tiddler-link-foreground: Sidebar tiddler link foreground sidebar-tiddler-link-foreground: Sidebar tiddler link foreground
stability-stable: Badge for stability level "stable"
stability-experimental: Badge for stability level "experimental"
stability-deprecated: Badge for stability level "deprecated"
stability-legacy: Badge for stability level "legacy"
testcase-accent-level-1: Test case accent colour with no nesting testcase-accent-level-1: Test case accent colour with no nesting
testcase-accent-level-2: Test case accent colour with 2nd level nesting testcase-accent-level-2: Test case accent colour with 2nd level nesting
testcase-accent-level-3: Test case accent colour with 3rd level nesting or higher testcase-accent-level-3: Test case accent colour with 3rd level nesting or higher
-1
View File
@@ -30,7 +30,6 @@ name: The human readable name associated with a plugin tiddler
parent-plugin: For a plugin, specifies which plugin of which it is a sub-plugin parent-plugin: For a plugin, specifies which plugin of which it is a sub-plugin
plugin-priority: A numerical value indicating the priority of a plugin tiddler plugin-priority: A numerical value indicating the priority of a plugin tiddler
plugin-type: The type of plugin in a plugin tiddler plugin-type: The type of plugin in a plugin tiddler
stability: The development status of a plugin: deprecated, experimental, stable, or legacy
revision: The revision of the tiddler held at the server revision: The revision of the tiddler held at the server
released: Date of a TiddlyWiki release released: Date of a TiddlyWiki release
source: The source URL associated with a tiddler source: The source URL associated with a tiddler
+1 -1
View File
@@ -70,7 +70,7 @@ No: No
OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library
OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team. OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
PageTemplate/Description: the default ~TiddlyWiki layout PageTemplate/Description: the default ~TiddlyWiki layout
PageTemplate/Name: Standard Layout PageTemplate/Name: Default ~PageTemplate
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect
RecentChanges/DateFormat: DDth MMM YYYY RecentChanges/DateFormat: DDth MMM YYYY
Shortcuts/Input/AdvancedSearch/Hint: Open the ~AdvancedSearch panel from within the sidebar search field Shortcuts/Input/AdvancedSearch/Hint: Open the ~AdvancedSearch panel from within the sidebar search field
+26 -1
View File
@@ -27,8 +27,33 @@ var Command = function(params,commander,callback) {
Command.prototype.execute = function() { Command.prototype.execute = function() {
var wiki = this.commander.wiki, var wiki = this.commander.wiki,
fs = require("fs"),
path = require("path"),
upgradeLibraryTitle = this.params[0] || UPGRADE_LIBRARY_TITLE, upgradeLibraryTitle = this.params[0] || UPGRADE_LIBRARY_TITLE,
tiddlers = $tw.utils.getAllPlugins(); tiddlers = {};
// Collect up the library plugins
var collectPlugins = function(folder) {
var pluginFolders = $tw.utils.getSubdirectories(folder) || [];
for(var p=0; p<pluginFolders.length; p++) {
if(!$tw.boot.excludeRegExp.test(pluginFolders[p])) {
pluginFields = $tw.loadPluginFolder(path.resolve(folder,"./" + pluginFolders[p]));
if(pluginFields && pluginFields.title) {
tiddlers[pluginFields.title] = pluginFields;
}
}
}
},
collectPublisherPlugins = function(folder) {
var publisherFolders = $tw.utils.getSubdirectories(folder) || [];
for(var t=0; t<publisherFolders.length; t++) {
if(!$tw.boot.excludeRegExp.test(publisherFolders[t])) {
collectPlugins(path.resolve(folder,"./" + publisherFolders[t]));
}
}
};
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.pluginsPath,$tw.config.pluginsEnvVar),collectPublisherPlugins);
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.themesPath,$tw.config.themesEnvVar),collectPublisherPlugins);
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.languagesPath,$tw.config.languagesEnvVar),collectPlugins);
// Save the upgrade library tiddler // Save the upgrade library tiddler
var pluginFields = { var pluginFields = {
title: upgradeLibraryTitle, title: upgradeLibraryTitle,
+3 -3
View File
@@ -16,11 +16,11 @@ Filter operator for returning all the backtranscludes from a tiddler
Export our filter function Export our filter function
*/ */
exports.backtranscludes = function(source,operator,options) { exports.backtranscludes = function(source,operator,options) {
var results = new $tw.utils.LinkedList(); var results = [];
source(function(tiddler,title) { source(function(tiddler,title) {
results.pushTop(options.wiki.getTiddlerBacktranscludes(title)); $tw.utils.pushTop(results,options.wiki.getTiddlerBacktranscludes(title));
}); });
return results.makeTiddlerIterator(options.wiki); return results;
}; };
})(); })();
+3 -6
View File
@@ -127,7 +127,7 @@ function diffPartsToChars(text1,text2,mode) {
if(lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : (lineHash[line] !== undefined)) { if(lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : (lineHash[line] !== undefined)) {
chars += String.fromCharCode(lineHash[line]); chars += String.fromCharCode(lineHash[line]);
} else { } else {
if(lineArrayLength == maxLines) { if (lineArrayLength == maxLines) {
line = text.substring(lineStart); line = text.substring(lineStart);
lineEnd = text.length; lineEnd = text.length;
} }
@@ -217,10 +217,7 @@ exports.splitregexp = function(source,operator,options) {
return ["RegExp error: " + ex]; return ["RegExp error: " + ex];
} }
source(function(tiddler,title) { source(function(tiddler,title) {
var parts = title.split(regExp).map(function(part){ Array.prototype.push.apply(result,title.split(regExp));
return part || ""; // make sure it's a string
});
Array.prototype.push.apply(result,parts);
}); });
return result; return result;
}; };
@@ -267,7 +264,7 @@ exports.pad = function(source,operator,options) {
} else { } else {
var padString = "", var padString = "",
padStringLength = targetLength - title.length; padStringLength = targetLength - title.length;
while(padStringLength > padString.length) { while (padStringLength > padString.length) {
padString += fill; padString += fill;
} }
//make sure we do not exceed the specified length //make sure we do not exceed the specified length
+1 -1
View File
@@ -20,7 +20,7 @@ exports.transcludes = function(source,operator,options) {
source(function(tiddler,title) { source(function(tiddler,title) {
results.pushTop(options.wiki.getTiddlerTranscludes(title)); results.pushTop(options.wiki.getTiddlerTranscludes(title));
}); });
return results.makeTiddlerIterator(options.wiki); return results.toArray();
}; };
})(); })();
+1 -4
View File
@@ -70,12 +70,9 @@ BackSubIndexer.prototype.rebuild = function() {
* Get things that is being referenced in the text, e.g. tiddler names in the link syntax. * Get things that is being referenced in the text, e.g. tiddler names in the link syntax.
*/ */
BackSubIndexer.prototype._getTarget = function(tiddler) { BackSubIndexer.prototype._getTarget = function(tiddler) {
if(this.wiki.isBinaryTiddler(tiddler.fields.text)) {
return [];
}
var parser = this.wiki.parseText(tiddler.fields.type, tiddler.fields.text, {}); var parser = this.wiki.parseText(tiddler.fields.type, tiddler.fields.text, {});
if(parser) { if(parser) {
return this.wiki[this.extractor](parser.tree, tiddler.fields.title); return this.wiki[this.extractor](parser.tree);
} }
return []; return [];
} }
+1 -1
View File
@@ -114,7 +114,7 @@ exports.parseStringLiteral = function(source,pos) {
var match = reString.exec(source); var match = reString.exec(source);
if(match && match.index === pos) { if(match && match.index === pos) {
node.value = match[1] !== undefined ? match[1] :( node.value = match[1] !== undefined ? match[1] :(
match[2] !== undefined ? match[2] : match[3] match[2] !== undefined ? match[2] : match[3]
); );
node.end = pos + match[0].length; node.end = pos + match[0].length;
return node; return node;
@@ -29,16 +29,13 @@ exports.init = function(parser) {
exports.parse = function() { exports.parse = function() {
var reEnd = /(\r?\n```$)/mg; var reEnd = /(\r?\n```$)/mg;
var languageStart = this.parser.pos + 3,
languageEnd = languageStart + this.match[1].length;
// Move past the match // Move past the match
this.parser.pos = this.matchRegExp.lastIndex; this.parser.pos = this.matchRegExp.lastIndex;
// Look for the end of the block // Look for the end of the block
reEnd.lastIndex = this.parser.pos; reEnd.lastIndex = this.parser.pos;
var match = reEnd.exec(this.parser.source), var match = reEnd.exec(this.parser.source),
text, text;
codeStart = this.parser.pos;
// Process the block // Process the block
if(match) { if(match) {
text = this.parser.source.substring(this.parser.pos,match.index); text = this.parser.source.substring(this.parser.pos,match.index);
@@ -51,8 +48,8 @@ exports.parse = function() {
return [{ return [{
type: "codeblock", type: "codeblock",
attributes: { attributes: {
code: {type: "string", value: text, start: codeStart, end: this.parser.pos}, code: {type: "string", value: text},
language: {type: "string", value: this.match[1], start: languageStart, end: languageEnd} language: {type: "string", value: this.match[1]}
} }
}]; }];
}; };
@@ -33,8 +33,7 @@ exports.parse = function() {
// Look for the end marker // Look for the end marker
reEnd.lastIndex = this.parser.pos; reEnd.lastIndex = this.parser.pos;
var match = reEnd.exec(this.parser.source), var match = reEnd.exec(this.parser.source),
text, text;
start = this.parser.pos;
// Process the text // Process the text
if(match) { if(match) {
text = this.parser.source.substring(this.parser.pos,match.index); text = this.parser.source.substring(this.parser.pos,match.index);
@@ -48,9 +47,7 @@ exports.parse = function() {
tag: "code", tag: "code",
children: [{ children: [{
type: "text", type: "text",
text: text, text: text
start: start,
end: this.parser.pos
}] }]
}]; }];
}; };
@@ -31,7 +31,6 @@ exports.init = function(parser) {
exports.parse = function() { exports.parse = function() {
// Move past the match // Move past the match
var start = this.parser.pos;
this.parser.pos = this.matchRegExp.lastIndex; this.parser.pos = this.matchRegExp.lastIndex;
// Create the link unless it is suppressed // Create the link unless it is suppressed
if(this.match[0].substr(0,1) === "~") { if(this.match[0].substr(0,1) === "~") {
@@ -47,7 +46,7 @@ exports.parse = function() {
rel: {type: "string", value: "noopener noreferrer"} rel: {type: "string", value: "noopener noreferrer"}
}, },
children: [{ children: [{
type: "text", text: this.match[0], start: start, end: this.parser.pos type: "text", text: this.match[0]
}] }]
}]; }];
} }
@@ -31,16 +31,6 @@ exports.init = function(parser) {
exports.parse = function() { exports.parse = function() {
// Move past the match // Move past the match
var filterStart = this.parser.pos + 3;
var filterEnd = filterStart + this.match[1].length;
var toolTipStart = filterEnd + 1;
var toolTipEnd = toolTipStart + (this.match[2] ? this.match[2].length : 0);
var templateStart = toolTipEnd + 2;
var templateEnd = templateStart + (this.match[3] ? this.match[3].length : 0);
var styleStart = templateEnd + 2;
var styleEnd = styleStart + (this.match[4] ? this.match[4].length : 0);
var classesStart = styleEnd + 1;
var classesEnd = classesStart + (this.match[5] ? this.match[5].length : 0);
this.parser.pos = this.matchRegExp.lastIndex; this.parser.pos = this.matchRegExp.lastIndex;
// Get the match details // Get the match details
var filter = this.match[1], var filter = this.match[1],
@@ -52,21 +42,21 @@ exports.parse = function() {
var node = { var node = {
type: "list", type: "list",
attributes: { attributes: {
filter: {type: "string", value: filter, start: filterStart, end: filterEnd}, filter: {type: "string", value: filter}
}, },
isBlock: true isBlock: true
}; };
if(tooltip) { if(tooltip) {
node.attributes.tooltip = {type: "string", value: tooltip, start: toolTipStart, end: toolTipEnd}; node.attributes.tooltip = {type: "string", value: tooltip};
} }
if(template) { if(template) {
node.attributes.template = {type: "string", value: template, start: templateStart, end: templateEnd}; node.attributes.template = {type: "string", value: template};
} }
if(style) { if(style) {
node.attributes.style = {type: "string", value: style, start: styleStart, end: styleEnd}; node.attributes.style = {type: "string", value: style};
} }
if(classes) { if(classes) {
node.attributes.itemClass = {type: "string", value: classes.split(".").join(" "), start: classesStart, end: classesEnd}; node.attributes.itemClass = {type: "string", value: classes.split(".").join(" ")};
} }
return [node]; return [node];
}; };
@@ -30,16 +30,6 @@ exports.init = function(parser) {
}; };
exports.parse = function() { exports.parse = function() {
var filterStart = this.parser.pos + 3;
var filterEnd = filterStart + this.match[1].length;
var toolTipStart = filterEnd + 1;
var toolTipEnd = toolTipStart + (this.match[2] ? this.match[2].length : 0);
var templateStart = toolTipEnd + 2;
var templateEnd = templateStart + (this.match[3] ? this.match[3].length : 0);
var styleStart = templateEnd + 2;
var styleEnd = styleStart + (this.match[4] ? this.match[4].length : 0);
var classesStart = styleEnd + 1;
var classesEnd = classesStart + (this.match[5] ? this.match[5].length : 0);
// Move past the match // Move past the match
this.parser.pos = this.matchRegExp.lastIndex; this.parser.pos = this.matchRegExp.lastIndex;
// Get the match details // Get the match details
@@ -52,20 +42,20 @@ exports.parse = function() {
var node = { var node = {
type: "list", type: "list",
attributes: { attributes: {
filter: {type: "string", value: filter, start: filterStart, end: filterEnd}, filter: {type: "string", value: filter}
} }
}; };
if(tooltip) { if(tooltip) {
node.attributes.tooltip = {type: "string", value: tooltip, start: toolTipStart, end: toolTipEnd}; node.attributes.tooltip = {type: "string", value: tooltip};
} }
if(template) { if(template) {
node.attributes.template = {type: "string", value: template, start: templateStart, end: templateEnd}; node.attributes.template = {type: "string", value: template};
} }
if(style) { if(style) {
node.attributes.style = {type: "string", value: style, start: styleStart, end: styleEnd}; node.attributes.style = {type: "string", value: style};
} }
if(classes) { if(classes) {
node.attributes.itemClass = {type: "string", value: classes.split(".").join(" "), start: classesStart, end: classesEnd}; node.attributes.itemClass = {type: "string", value: classes.split(".").join(" ")};
} }
return [node]; return [node];
}; };
@@ -45,11 +45,10 @@ exports.parse = function() {
reEnd.lastIndex = this.parser.pos; reEnd.lastIndex = this.parser.pos;
match = reEnd.exec(this.parser.source); match = reEnd.exec(this.parser.source);
if(match) { if(match) {
var start = this.parser.pos;
this.parser.pos = reEnd.lastIndex; this.parser.pos = reEnd.lastIndex;
// Add a line break if the terminator was a line break // Add a line break if the terminator was a line break
if(match[2]) { if(match[2]) {
tree.push({type: "element", tag: "br", start: start, end: this.parser.pos}); tree.push({type: "element", tag: "br"});
} }
} }
} while(match && !match[1]); } while(match && !match[1]);
@@ -30,17 +30,15 @@ exports.parse = function() {
// Move past the !s // Move past the !s
this.parser.pos = this.matchRegExp.lastIndex; this.parser.pos = this.matchRegExp.lastIndex;
// Parse any classes, whitespace and then the heading itself // Parse any classes, whitespace and then the heading itself
var classStart = this.parser.pos;
var classes = this.parser.parseClasses(); var classes = this.parser.parseClasses();
var classEnd = this.parser.pos;
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true}); this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
var tree = this.parser.parseInlineRun(/(\r?\n)/mg); var tree = this.parser.parseInlineRun(/(\r?\n)/mg);
// Return the heading // Return the heading
return [{ return [{
type: "element", type: "element",
tag: "h" + headingLevel, tag: "h" + headingLevel,
attributes: { attributes: {
"class": {type: "string", value: classes.join(" "), start: classStart, end: classEnd} "class": {type: "string", value: classes.join(" ")}
}, },
children: tree children: tree
}]; }];
@@ -44,10 +44,6 @@ Parse the most recent match
exports.parse = function() { exports.parse = function() {
// Retrieve the most recent match so that recursive calls don't overwrite it // Retrieve the most recent match so that recursive calls don't overwrite it
var tag = this.nextTag; var tag = this.nextTag;
if (!tag.isSelfClosing) {
tag.openTagStart = tag.start;
tag.openTagEnd = tag.end;
}
this.nextTag = null; this.nextTag = null;
// Advance the parser position to past the tag // Advance the parser position to past the tag
this.parser.pos = tag.end; this.parser.pos = tag.end;
@@ -64,27 +60,6 @@ exports.parse = function() {
var reEnd = new RegExp("(" + reEndString + ")","mg"); var reEnd = new RegExp("(" + reEndString + ")","mg");
tag.children = this.parser.parseInlineRun(reEnd,{eatTerminator: true}); tag.children = this.parser.parseInlineRun(reEnd,{eatTerminator: true});
} }
tag.end = this.parser.pos;
tag.closeTagEnd = tag.end;
if (tag.closeTagEnd === tag.openTagEnd || this.parser.source[tag.closeTagEnd - 1] !== '>') {
tag.closeTagStart = tag.end;
} else {
tag.closeTagStart = tag.closeTagEnd - 2;
var closeTagMinPos = tag.children.length > 0 ? tag.children[tag.children.length-1].end : tag.openTagEnd;
if (!Number.isSafeInteger(closeTagMinPos)) closeTagMinPos = tag.openTagEnd;
while (tag.closeTagStart >= closeTagMinPos) {
var char = this.parser.source[tag.closeTagStart];
if (char === '>') {
tag.closeTagStart = -1;
break;
}
if (char === '<') break;
tag.closeTagStart -= 1;
}
if (tag.closeTagStart < closeTagMinPos) {
tag.closeTagStart = tag.end;
}
}
} }
// Return the tag // Return the tag
return [tag]; return [tag];
@@ -122,9 +122,9 @@ exports.parseImage = function(source,pos) {
} }
pos = token.end; pos = token.end;
if(token.match[1]) { if(token.match[1]) {
node.attributes.tooltip = {type: "string", value: token.match[1].trim(),start: token.start,end:token.start + token.match[1].length - 1}; node.attributes.tooltip = {type: "string", value: token.match[1].trim()};
} }
node.attributes.source = {type: "string", value: (token.match[2] || "").trim(), start: token.start + (token.match[1] ? token.match[1].length : 0), end: token.end - 2}; node.attributes.source = {type: "string", value: (token.match[2] || "").trim()};
// Update the end position // Update the end position
node.end = pos; node.end = pos;
return node; return node;
@@ -38,14 +38,13 @@ exports.parse = function() {
// Parse the filter terminated by a line break // Parse the filter terminated by a line break
var reMatch = /(.*)(?:$|\r?\n)/mg; var reMatch = /(.*)(?:$|\r?\n)/mg;
reMatch.lastIndex = this.parser.pos; reMatch.lastIndex = this.parser.pos;
var filterStart = this.parser.source;
var match = reMatch.exec(this.parser.source); var match = reMatch.exec(this.parser.source);
this.parser.pos = reMatch.lastIndex; this.parser.pos = reMatch.lastIndex;
// Parse tree nodes to return // Parse tree nodes to return
return [{ return [{
type: "importvariables", type: "importvariables",
attributes: { attributes: {
filter: {type: "string", value: match[1], start: filterStart, end: this.parser.pos} filter: {type: "string", value: match[1]}
}, },
children: [] children: []
}]; }];
+4 -29
View File
@@ -74,7 +74,6 @@ exports.parse = function() {
// Match the list marker // Match the list marker
var reMatch = /([\*#;:>]+)/mg; var reMatch = /([\*#;:>]+)/mg;
reMatch.lastIndex = this.parser.pos; reMatch.lastIndex = this.parser.pos;
var start = this.parser.pos;
var match = reMatch.exec(this.parser.source); var match = reMatch.exec(this.parser.source);
if(!match || match.index !== this.parser.pos) { if(!match || match.index !== this.parser.pos) {
break; break;
@@ -95,21 +94,9 @@ exports.parse = function() {
} }
// Construct the list element or reuse the previous one at this level // Construct the list element or reuse the previous one at this level
if(listStack.length <= t) { if(listStack.length <= t) {
var listElement = { var listElement = {type: "element", tag: listInfo.listTag, children: [
type: "element", {type: "element", tag: listInfo.itemTag, children: []}
tag: listInfo.listTag, ]};
children: [
{
type: "element",
tag: listInfo.itemTag,
children: [],
start: start,
end: this.parser.pos,
}
],
start: start,
end: this.parser.pos,
};
// Link this list element into the last child item of the parent list item // Link this list element into the last child item of the parent list item
if(t) { if(t) {
var prevListItem = listStack[t-1].children[listStack[t-1].children.length-1]; var prevListItem = listStack[t-1].children[listStack[t-1].children.length-1];
@@ -118,33 +105,21 @@ exports.parse = function() {
// Save this element in the stack // Save this element in the stack
listStack[t] = listElement; listStack[t] = listElement;
} else if(t === (match[0].length - 1)) { } else if(t === (match[0].length - 1)) {
listStack[t].children.push({ listStack[t].children.push({type: "element", tag: listInfo.itemTag, children: []});
type: "element",
tag: listInfo.itemTag,
children: [],
start: start,
end: this.parser.pos,
});
} }
} }
if(listStack.length > match[0].length) { if(listStack.length > match[0].length) {
listStack.splice(match[0].length,listStack.length - match[0].length); listStack.splice(match[0].length,listStack.length - match[0].length);
} }
// Process the body of the list item into the last list item // Process the body of the list item into the last list item
var classStart = this.parser.pos;
var lastListChildren = listStack[listStack.length-1].children, var lastListChildren = listStack[listStack.length-1].children,
lastListItem = lastListChildren[lastListChildren.length-1], lastListItem = lastListChildren[lastListChildren.length-1],
classes = this.parser.parseClasses(); classes = this.parser.parseClasses();
var classEnd = this.parser.pos;
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true}); this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
var tree = this.parser.parseInlineRun(/(\r?\n)/mg); var tree = this.parser.parseInlineRun(/(\r?\n)/mg);
lastListItem.children.push.apply(lastListItem.children,tree); lastListItem.children.push.apply(lastListItem.children,tree);
lastListItem.end = this.parser.pos;
listStack[listStack.length-1].end = this.parser.pos;
if(classes.length > 0) { if(classes.length > 0) {
$tw.utils.addClassToParseTreeNode(lastListItem,classes.join(" ")); $tw.utils.addClassToParseTreeNode(lastListItem,classes.join(" "));
lastListItem.attributes.class.start = classStart;
lastListItem.attributes.class.end = classEnd;
} }
// Consume any whitespace following the list item // Consume any whitespace following the list item
this.parser.skipWhitespace(); this.parser.skipWhitespace();
@@ -96,20 +96,15 @@ exports.parseLink = function(source,pos) {
splitPos = null; splitPos = null;
} }
// Pull out the tooltip and URL // Pull out the tooltip and URL
var tooltip, URL, urlStart; var tooltip, URL;
textNode.start = pos;
if(splitPos) { if(splitPos) {
urlStart = splitPos + 1;
URL = source.substring(splitPos + 1,closePos).trim(); URL = source.substring(splitPos + 1,closePos).trim();
textNode.text = source.substring(pos,splitPos).trim(); textNode.text = source.substring(pos,splitPos).trim();
textNode.end = splitPos;
} else { } else {
urlStart = pos;
URL = source.substring(pos,closePos).trim(); URL = source.substring(pos,closePos).trim();
textNode.text = URL; textNode.text = URL;
textNode.end = closePos;
} }
node.attributes.href = {type: "string", value: URL, start: urlStart, end: closePos}; node.attributes.href = {type: "string", value: URL};
node.attributes.target = {type: "string", value: "_blank"}; node.attributes.target = {type: "string", value: "_blank"};
node.attributes.rel = {type: "string", value: "noopener noreferrer"}; node.attributes.rel = {type: "string", value: "noopener noreferrer"};
// Update the end position // Update the end position
@@ -29,39 +29,32 @@ exports.init = function(parser) {
exports.parse = function() { exports.parse = function() {
// Move past the match // Move past the match
var start = this.parser.pos + 2;
this.parser.pos = this.matchRegExp.lastIndex; this.parser.pos = this.matchRegExp.lastIndex;
// Process the link // Process the link
var text = this.match[1], var text = this.match[1],
link = this.match[2] || text, link = this.match[2] || text;
textEndPos = this.parser.source.indexOf("|", start);
if (textEndPos < 0 || textEndPos > this.matchRegExp.lastIndex) {
textEndPos = this.matchRegExp.lastIndex - 2;
}
var linkStart = this.match[2] ? (start + this.match[1].length + 1) : start;
var linkEnd = linkStart + link.length;
if($tw.utils.isLinkExternal(link)) { if($tw.utils.isLinkExternal(link)) {
return [{ return [{
type: "element", type: "element",
tag: "a", tag: "a",
attributes: { attributes: {
href: {type: "string", value: link, start: linkStart, end: linkEnd}, href: {type: "string", value: link},
"class": {type: "string", value: "tc-tiddlylink-external"}, "class": {type: "string", value: "tc-tiddlylink-external"},
target: {type: "string", value: "_blank"}, target: {type: "string", value: "_blank"},
rel: {type: "string", value: "noopener noreferrer"} rel: {type: "string", value: "noopener noreferrer"}
}, },
children: [{ children: [{
type: "text", text: text, start: start, end: textEndPos type: "text", text: text
}] }]
}]; }];
} else { } else {
return [{ return [{
type: "link", type: "link",
attributes: { attributes: {
to: {type: "string", value: link, start: linkStart, end: linkEnd} to: {type: "string", value: link}
}, },
children: [{ children: [{
type: "text", text: text, start: start, end: textEndPos type: "text", text: text
}] }]
}]; }];
} }
@@ -28,13 +28,9 @@ exports.parse = function() {
// Move past the <s // Move past the <s
this.parser.pos = this.matchRegExp.lastIndex; this.parser.pos = this.matchRegExp.lastIndex;
// Parse any classes, whitespace and then the optional cite itself // Parse any classes, whitespace and then the optional cite itself
var classStart = this.parser.pos;
classes.push.apply(classes, this.parser.parseClasses()); classes.push.apply(classes, this.parser.parseClasses());
var classEnd = this.parser.pos;
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true}); this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
var citeStart = this.parser.pos;
var cite = this.parser.parseInlineRun(/(\r?\n)/mg); var cite = this.parser.parseInlineRun(/(\r?\n)/mg);
var citeEnd = this.parser.pos;
// before handling the cite, parse the body of the quote // before handling the cite, parse the body of the quote
var tree = this.parser.parseBlocks(reEndString); var tree = this.parser.parseBlocks(reEndString);
// If we got a cite, put it before the text // If we got a cite, put it before the text
@@ -42,24 +38,18 @@ exports.parse = function() {
tree.unshift({ tree.unshift({
type: "element", type: "element",
tag: "cite", tag: "cite",
children: cite, children: cite
start: citeStart,
end: citeEnd
}); });
} }
// Parse any optional cite // Parse any optional cite
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true}); this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
citeStart = this.parser.pos;
cite = this.parser.parseInlineRun(/(\r?\n)/mg); cite = this.parser.parseInlineRun(/(\r?\n)/mg);
citeEnd = this.parser.pos;
// If we got a cite, push it // If we got a cite, push it
if(cite.length > 0) { if(cite.length > 0) {
tree.push({ tree.push({
type: "element", type: "element",
tag: "cite", tag: "cite",
children: cite, children: cite
start: citeStart,
end: citeEnd
}); });
} }
// Return the blockquote element // Return the blockquote element
@@ -67,7 +57,7 @@ exports.parse = function() {
type: "element", type: "element",
tag: "blockquote", tag: "blockquote",
attributes: { attributes: {
class: { type: "string", value: classes.join(" "), start: classStart, end: classEnd }, class: { type: "string", value: classes.join(" ") },
}, },
children: tree children: tree
}]; }];
@@ -29,11 +29,10 @@ exports.init = function(parser) {
exports.parse = function() { exports.parse = function() {
var match = this.match[0]; var match = this.match[0];
// Move past the match // Move past the match
var start = this.parser.pos;
this.parser.pos = this.matchRegExp.lastIndex; this.parser.pos = this.matchRegExp.lastIndex;
// Create the link unless it is suppressed // Create the link unless it is suppressed
if(match.substr(0,1) === "~") { if(match.substr(0,1) === "~") {
return [{type: "text", text: match.substr(1), start: start+1, end: this.parser.pos}]; return [{type: "text", text: match.substr(1)}];
} else { } else {
return [{ return [{
type: "link", type: "link",
@@ -42,12 +41,10 @@ exports.parse = function() {
}, },
children: [{ children: [{
type: "text", type: "text",
text: match, text: match
start: start,
end: this.parser.pos
}] }]
}]; }];
} }
}; };
})(); })();
@@ -150,7 +150,7 @@ exports.parse = function() {
} else { } else {
// Otherwise, create a new row if this one is of a different type // Otherwise, create a new row if this one is of a different type
if(rowType !== currRowType) { if(rowType !== currRowType) {
rowContainer = {type: "element", tag: rowContainerTypes[rowType], children: [], start: this.parser.pos, end: this.parser.pos}; rowContainer = {type: "element", tag: rowContainerTypes[rowType], children: []};
table.children.push(rowContainer); table.children.push(rowContainer);
currRowType = rowType; currRowType = rowType;
} }
@@ -178,7 +178,6 @@ exports.parse = function() {
// Increment the row count // Increment the row count
rowCount++; rowCount++;
} }
rowContainer.end = this.parser.pos;
} }
rowMatch = rowRegExp.exec(this.parser.source); rowMatch = rowRegExp.exec(this.parser.source);
} }
@@ -46,7 +46,6 @@ exports.parse = function() {
renderType = this.match[2]; renderType = this.match[2];
// Move past the match // Move past the match
this.parser.pos = this.matchRegExp.lastIndex; this.parser.pos = this.matchRegExp.lastIndex;
var start = this.parser.pos;
// Look for the end of the block // Look for the end of the block
reEnd.lastIndex = this.parser.pos; reEnd.lastIndex = this.parser.pos;
var match = reEnd.exec(this.parser.source), var match = reEnd.exec(this.parser.source),
@@ -75,9 +74,7 @@ exports.parse = function() {
tag: "pre", tag: "pre",
children: [{ children: [{
type: "text", type: "text",
text: text, text: text
start: start,
end: this.parser.pos
}] }]
}]; }];
} }
@@ -36,7 +36,6 @@ exports.parse = function() {
// Get the details of the match // Get the details of the match
var linkText = this.match[0]; var linkText = this.match[0];
// Move past the macro call // Move past the macro call
var start = this.parser.pos;
this.parser.pos = this.matchRegExp.lastIndex; this.parser.pos = this.matchRegExp.lastIndex;
// If the link starts with the unwikilink character then just output it as plain text // If the link starts with the unwikilink character then just output it as plain text
if(linkText.substr(0,1) === $tw.config.textPrimitives.unWikiLink) { if(linkText.substr(0,1) === $tw.config.textPrimitives.unWikiLink) {
@@ -58,9 +57,7 @@ exports.parse = function() {
}, },
children: [{ children: [{
type: "text", type: "text",
text: linkText, text: linkText
start: start,
end: this.parser.pos
}] }]
}]; }];
}; };
+5 -39
View File
@@ -91,11 +91,6 @@ var WikiParser = function(type,text,options) {
} else { } else {
topBranch.push.apply(topBranch,this.parseBlocks()); topBranch.push.apply(topBranch,this.parseBlocks());
} }
// Build rules' name map
this.usingRuleMap = {};
$tw.utils.each(this.pragmaRules, function (ruleInfo) { self.usingRuleMap[ruleInfo.rule.name] = Object.getPrototypeOf(ruleInfo.rule); });
$tw.utils.each(this.blockRules, function (ruleInfo) { self.usingRuleMap[ruleInfo.rule.name] = Object.getPrototypeOf(ruleInfo.rule); });
$tw.utils.each(this.inlineRules, function (ruleInfo) { self.usingRuleMap[ruleInfo.rule.name] = Object.getPrototypeOf(ruleInfo.rule); });
// Return the parse tree // Return the parse tree
}; };
@@ -214,13 +209,8 @@ WikiParser.prototype.parsePragmas = function() {
break; break;
} }
// Process the pragma rule // Process the pragma rule
var start = this.pos;
var subTree = nextMatch.rule.parse(); var subTree = nextMatch.rule.parse();
if(subTree.length > 0) { if(subTree.length > 0) {
// Set the start and end positions of the pragma rule if
if (subTree[0].start === undefined) subTree[0].start = start;
if (subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
$tw.utils.each(subTree, function (node) { node.rule = nextMatch.rule.name; });
// Quick hack; we only cope with a single parse tree node being returned, which is true at the moment // Quick hack; we only cope with a single parse tree node being returned, which is true at the moment
currentTreeBranch.push.apply(currentTreeBranch,subTree); currentTreeBranch.push.apply(currentTreeBranch,subTree);
subTree[0].children = []; subTree[0].children = [];
@@ -245,15 +235,7 @@ WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
// Look for a block rule that applies at the current position // Look for a block rule that applies at the current position
var nextMatch = this.findNextMatch(this.blockRules,this.pos); var nextMatch = this.findNextMatch(this.blockRules,this.pos);
if(nextMatch && nextMatch.matchIndex === this.pos) { if(nextMatch && nextMatch.matchIndex === this.pos) {
var start = this.pos; return nextMatch.rule.parse();
var subTree = nextMatch.rule.parse();
// Set the start and end positions of the first and last blocks if they're not already set
if (subTree.length > 0) {
if (subTree[0].start === undefined) subTree[0].start = start;
if (subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
}
$tw.utils.each(subTree, function (node) { node.rule = nextMatch.rule.name; });
return subTree;
} }
// Treat it as a paragraph if we didn't find a block rule // Treat it as a paragraph if we didn't find a block rule
var start = this.pos; var start = this.pos;
@@ -350,16 +332,7 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
this.pos = nextMatch.matchIndex; this.pos = nextMatch.matchIndex;
} }
// Process the run rule // Process the run rule
var start = this.pos; tree.push.apply(tree,nextMatch.rule.parse());
var subTree = nextMatch.rule.parse();
// Set the start and end positions of the first and last child if they're not already set
if (subTree.length > 0) {
// Set the start and end positions of the first and last child if they're not already set
if (subTree[0].start === undefined) subTree[0].start = start;
if (subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
}
$tw.utils.each(subTree, function (node) { node.rule = nextMatch.rule.name; });
tree.push.apply(tree,subTree);
// Look for the next run rule // Look for the next run rule
nextMatch = this.findNextMatch(this.inlineRules,this.pos); nextMatch = this.findNextMatch(this.inlineRules,this.pos);
} }
@@ -410,15 +383,7 @@ WikiParser.prototype.parseInlineRunTerminatedExtended = function(terminatorRegEx
this.pos = inlineRuleMatch.matchIndex; this.pos = inlineRuleMatch.matchIndex;
} }
// Process the inline rule // Process the inline rule
var start = this.pos; tree.push.apply(tree,inlineRuleMatch.rule.parse());
var subTree = inlineRuleMatch.rule.parse();
// Set the start and end positions of the first and last child if they're not already set
if (subTree.length > 0) {
if (subTree[0].start === undefined) subTree[0].start = start;
if (subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
}
$tw.utils.each(subTree, function (node) { node.rule = inlineRuleMatch.rule.name; });
tree.push.apply(tree,subTree);
// Look for the next inline rule // Look for the next inline rule
inlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos); inlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos);
// Look for the next terminator match // Look for the next terminator match
@@ -444,7 +409,7 @@ WikiParser.prototype.pushTextWidget = function(array,text,start,end) {
text = $tw.utils.trim(text); text = $tw.utils.trim(text);
} }
if(text) { if(text) {
array.push({type: "text", text: text, start: start, end: end}); array.push({type: "text", text: text, start: start, end: end});
} }
}; };
@@ -497,3 +462,4 @@ WikiParser.prototype.amendRules = function(type,names) {
exports["text/vnd.tiddlywiki"] = WikiParser; exports["text/vnd.tiddlywiki"] = WikiParser;
})(); })();
+3 -7
View File
@@ -95,7 +95,6 @@ function SaverHandler(options) {
if($tw.browser) { if($tw.browser) {
$tw.rootWidget.addEventListener("tm-save-wiki",function(event) { $tw.rootWidget.addEventListener("tm-save-wiki",function(event) {
self.saveWiki({ self.saveWiki({
wiki: event.widget.wiki,
template: event.param, template: event.param,
downloadType: "text/plain", downloadType: "text/plain",
variables: event.paramObject variables: event.paramObject
@@ -103,7 +102,6 @@ function SaverHandler(options) {
}); });
$tw.rootWidget.addEventListener("tm-download-file",function(event) { $tw.rootWidget.addEventListener("tm-download-file",function(event) {
self.saveWiki({ self.saveWiki({
wiki: event.widget.wiki,
method: "download", method: "download",
template: event.param, template: event.param,
downloadType: "text/plain", downloadType: "text/plain",
@@ -149,22 +147,20 @@ Save the wiki contents. Options are:
method: "save", "autosave" or "download" method: "save", "autosave" or "download"
template: the tiddler containing the template to save template: the tiddler containing the template to save
downloadType: the content type for the saved file downloadType: the content type for the saved file
wiki: optional wiki, overriding the default wiki specified in the constructor
*/ */
SaverHandler.prototype.saveWiki = function(options) { SaverHandler.prototype.saveWiki = function(options) {
options = options || {}; options = options || {};
var self = this, var self = this,
wiki = options.wiki || this.wiki,
method = options.method || "save"; method = options.method || "save";
// Ignore autosave if disabled // Ignore autosave if disabled
if(method === "autosave" && ($tw.config.disableAutoSave || wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes")) { if(method === "autosave" && ($tw.config.disableAutoSave || this.wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes")) {
return false; return false;
} }
var variables = options.variables || {}, var variables = options.variables || {},
template = (options.template || template = (options.template ||
wiki.getTiddlerText("$:/config/SaveWikiButton/Template","$:/core/save/all")).trim(), this.wiki.getTiddlerText("$:/config/SaveWikiButton/Template","$:/core/save/all")).trim(),
downloadType = options.downloadType || "text/plain", downloadType = options.downloadType || "text/plain",
text = wiki.renderTiddler(downloadType,template,options), text = this.wiki.renderTiddler(downloadType,template,options),
callback = function(err) { callback = function(err) {
if(err) { if(err) {
alert($tw.language.getString("Error/WhileSaving") + ":\n\n" + err); alert($tw.language.getString("Error/WhileSaving") + ":\n\n" + err);
+1 -3
View File
@@ -37,9 +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
if(username) { state.authenticatedUsername = $tw.utils.decodeURIComponentSafe(username);
state.authenticatedUsername = $tw.utils.decodeURIComponentSafe(username);
}
return true; return true;
} }
}; };
+1 -1
View File
@@ -61,7 +61,7 @@ exports.startup = function() {
// Collect the shadow tiddlers of any modified plugins // Collect the shadow tiddlers of any modified plugins
$tw.utils.each(changes.modifiedPlugins,function(pluginTitle) { $tw.utils.each(changes.modifiedPlugins,function(pluginTitle) {
var pluginInfo = $tw.wiki.getPluginInfo(pluginTitle); var pluginInfo = $tw.wiki.getPluginInfo(pluginTitle);
if(pluginInfo && pluginInfo.tiddlers) { if(pluginInfo) {
$tw.utils.each(Object.keys(pluginInfo.tiddlers),function(title) { $tw.utils.each(Object.keys(pluginInfo.tiddlers),function(title) {
changedShadowTiddlers[title] = false; changedShadowTiddlers[title] = false;
}); });
+1 -5
View File
@@ -29,11 +29,7 @@ var THROTTLE_REFRESH_TIMEOUT = 400;
exports.startup = function() { exports.startup = function() {
// Set up the title // Set up the title
$tw.titleWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_TITLE_TITLE, { $tw.titleWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_TITLE_TITLE,{document: $tw.fakeDocument, parseAsInline: true});
document: $tw.fakeDocument,
parseAsInline: true,
importPageMacros: true,
});
$tw.titleContainer = $tw.fakeDocument.createElement("div"); $tw.titleContainer = $tw.fakeDocument.createElement("div");
$tw.titleWidgetNode.render($tw.titleContainer,null); $tw.titleWidgetNode.render($tw.titleContainer,null);
document.title = $tw.titleContainer.textContent; document.title = $tw.titleContainer.textContent;
+2 -10
View File
@@ -39,7 +39,6 @@ exports.startup = function() {
method: params.method, method: params.method,
body: params.body, body: params.body,
binary: params.binary, binary: params.binary,
useDefaultHeaders: params.useDefaultHeaders,
oncompletion: params.oncompletion, oncompletion: params.oncompletion,
onprogress: params.onprogress, onprogress: params.onprogress,
bindStatus: params["bind-status"], bindStatus: params["bind-status"],
@@ -48,11 +47,7 @@ exports.startup = function() {
headers: getPropertiesWithPrefix(params,"header-"), headers: getPropertiesWithPrefix(params,"header-"),
passwordHeaders: getPropertiesWithPrefix(params,"password-header-"), passwordHeaders: getPropertiesWithPrefix(params,"password-header-"),
queryStrings: getPropertiesWithPrefix(params,"query-"), queryStrings: getPropertiesWithPrefix(params,"query-"),
passwordQueryStrings: getPropertiesWithPrefix(params,"password-query-"), passwordQueryStrings: getPropertiesWithPrefix(params,"password-query-")
basicAuthUsername: params["basic-auth-username"],
basicAuthUsernameFromStore: params["basic-auth-username-from-store"],
basicAuthPassword: params["basic-auth-password"],
basicAuthPasswordFromStore: params["basic-auth-password-from-store"]
}); });
}); });
$tw.rootWidget.addEventListener("tm-http-cancel-all-requests",function(event) { $tw.rootWidget.addEventListener("tm-http-cancel-all-requests",function(event) {
@@ -73,10 +68,7 @@ exports.startup = function() {
}); });
// Install the copy-to-clipboard mechanism // Install the copy-to-clipboard mechanism
$tw.rootWidget.addEventListener("tm-copy-to-clipboard",function(event) { $tw.rootWidget.addEventListener("tm-copy-to-clipboard",function(event) {
$tw.utils.copyToClipboard(event.param,{ $tw.utils.copyToClipboard(event.param);
successNotification: event.paramObject && event.paramObject.successNotification,
failureNotification: event.paramObject && event.paramObject.failureNotification
});
}); });
// Install the tm-focus-selector message // Install the tm-focus-selector message
$tw.rootWidget.addEventListener("tm-focus-selector",function(event) { $tw.rootWidget.addEventListener("tm-focus-selector",function(event) {
+4 -14
View File
@@ -93,9 +93,7 @@ exports.startup = function() {
updateAddressBar: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_UPDATE_ADDRESS_BAR,"yes").trim() === "yes" ? "permalink" : "none", updateAddressBar: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_UPDATE_ADDRESS_BAR,"yes").trim() === "yes" ? "permalink" : "none",
updateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,"no").trim(), updateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,"no").trim(),
targetTiddler: event.param || event.tiddlerTitle, targetTiddler: event.param || event.tiddlerTitle,
copyToClipboard: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_COPY_TO_CLIPBOARD,"yes").trim() === "yes" ? "permalink" : "none", copyToClipboard: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_COPY_TO_CLIPBOARD,"yes").trim() === "yes" ? "permalink" : "none"
successNotification: event.paramObject && event.paramObject.successNotification,
failureNotification: event.paramObject && event.paramObject.failureNotification
}); });
}); });
// Listen for the tm-permaview message // Listen for the tm-permaview message
@@ -104,9 +102,7 @@ exports.startup = function() {
updateAddressBar: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_UPDATE_ADDRESS_BAR,"yes").trim() === "yes" ? "permaview" : "none", updateAddressBar: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_UPDATE_ADDRESS_BAR,"yes").trim() === "yes" ? "permaview" : "none",
updateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,"no").trim(), updateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,"no").trim(),
targetTiddler: event.param || event.tiddlerTitle, targetTiddler: event.param || event.tiddlerTitle,
copyToClipboard: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_COPY_TO_CLIPBOARD,"yes").trim() === "yes" ? "permaview" : "none", copyToClipboard: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_COPY_TO_CLIPBOARD,"yes").trim() === "yes" ? "permaview" : "none"
successNotification: event.paramObject && event.paramObject.successNotification,
failureNotification: event.paramObject && event.paramObject.failureNotification
}); });
}); });
} }
@@ -181,8 +177,6 @@ options.updateAddressBar: "permalink", "permaview" or "no" (defaults to "permavi
options.updateHistory: "yes" or "no" (defaults to "no") options.updateHistory: "yes" or "no" (defaults to "no")
options.copyToClipboard: "permalink", "permaview" or "no" (defaults to "no") options.copyToClipboard: "permalink", "permaview" or "no" (defaults to "no")
options.targetTiddler: optional title of target tiddler for permalink options.targetTiddler: optional title of target tiddler for permalink
options.successNotification: optional title of tiddler to use as the notification in case of success
options.failureNotification: optional title of tiddler to use as the notification in case of failure
*/ */
function updateLocationHash(options) { function updateLocationHash(options) {
// Get the story and the history stack // Get the story and the history stack
@@ -211,18 +205,14 @@ function updateLocationHash(options) {
break; break;
} }
// Copy URL to the clipboard // Copy URL to the clipboard
var url = "";
switch(options.copyToClipboard) { switch(options.copyToClipboard) {
case "permalink": case "permalink":
url = $tw.utils.getLocationPath() + "#" + encodeURIComponent(targetTiddler); $tw.utils.copyToClipboard($tw.utils.getLocationPath() + "#" + encodeURIComponent(targetTiddler));
break; break;
case "permaview": case "permaview":
url = $tw.utils.getLocationPath() + "#" + encodeURIComponent(targetTiddler) + ":" + encodeURIComponent($tw.utils.stringifyList(storyList)); $tw.utils.copyToClipboard($tw.utils.getLocationPath() + "#" + encodeURIComponent(targetTiddler) + ":" + encodeURIComponent($tw.utils.stringifyList(storyList)));
break; break;
} }
if(url) {
$tw.utils.copyToClipboard(url,{successNotification: options.successNotification, failureNotification: options.failureNotification});
}
// Only change the location hash if we must, thus avoiding unnecessary onhashchange events // Only change the location hash if we must, thus avoiding unnecessary onhashchange events
if($tw.utils.getLocationHash() !== $tw.locationHash) { if($tw.utils.getLocationHash() !== $tw.locationHash) {
if(options.updateHistory === "yes") { if(options.updateHistory === "yes") {
+1 -3
View File
@@ -292,9 +292,7 @@ exports.copyToClipboard = function(text,options) {
} catch (err) { } catch (err) {
} }
if(!options.doNotNotify) { if(!options.doNotNotify) {
var successNotification = options.successNotification || "$:/language/Notifications/CopiedToClipboard/Succeeded", $tw.notifier.display(succeeded ? "$:/language/Notifications/CopiedToClipboard/Succeeded" : "$:/language/Notifications/CopiedToClipboard/Failed");
failureNotification = options.failureNotification || "$:/language/Notifications/CopiedToClipboard/Failed"
$tw.notifier.display(succeeded ? successNotification : failureNotification);
} }
document.body.removeChild(textArea); document.body.removeChild(textArea);
}; };
+5 -17
View File
@@ -69,7 +69,7 @@ HttpClient.prototype.cancelAllHttpRequests = function() {
for(var t=this.requests.length - 1; t--; t>=0) { for(var t=this.requests.length - 1; t--; t>=0) {
var requestInfo = this.requests[t]; var requestInfo = this.requests[t];
requestInfo.request.cancel(); requestInfo.request.cancel();
} }
} }
this.requests = []; this.requests = [];
this.updateRequestTracker(); this.updateRequestTracker();
@@ -100,10 +100,6 @@ 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 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 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 passwordQueryStrings: hashmap of query string parameter name to password store name to be sent with the request
basicAuthUsername: plain username for basic authentication
basicAuthUsernameFromStore: name of password store entry containing username
basicAuthPassword: plain password for basic authentication
basicAuthPasswordFromStore: name of password store entry containing password
*/ */
function HttpClientRequest(options) { function HttpClientRequest(options) {
var self = this; var self = this;
@@ -116,7 +112,6 @@ function HttpClientRequest(options) {
this.method = options.method || "GET"; this.method = options.method || "GET";
this.body = options.body || ""; this.body = options.body || "";
this.binary = options.binary || ""; this.binary = options.binary || "";
this.useDefaultHeaders = options.useDefaultHeaders !== "false" ? true : false,
this.variables = options.variables; this.variables = options.variables;
var url = options.url; var url = options.url;
$tw.utils.each(options.queryStrings,function(value,name) { $tw.utils.each(options.queryStrings,function(value,name) {
@@ -133,11 +128,6 @@ function HttpClientRequest(options) {
$tw.utils.each(options.passwordHeaders,function(value,name) { $tw.utils.each(options.passwordHeaders,function(value,name) {
self.requestHeaders[name] = $tw.utils.getPassword(value) || ""; self.requestHeaders[name] = $tw.utils.getPassword(value) || "";
}); });
this.basicAuthUsername = options.basicAuthUsername || (options.basicAuthUsernameFromStore && $tw.utils.getPassword(options.basicAuthUsernameFromStore)) || "";
this.basicAuthPassword = options.basicAuthPassword || (options.basicAuthPasswordFromStore && $tw.utils.getPassword(options.basicAuthPasswordFromStore)) || "";
if(this.basicAuthUsername && this.basicAuthPassword) {
this.requestHeaders.Authorization = "Basic " + $tw.utils.base64Encode(this.basicAuthUsername + ":" + this.basicAuthPassword);
}
} }
HttpClientRequest.prototype.send = function(callback) { HttpClientRequest.prototype.send = function(callback) {
@@ -166,7 +156,6 @@ HttpClientRequest.prototype.send = function(callback) {
this.xhr = $tw.utils.httpRequest({ this.xhr = $tw.utils.httpRequest({
url: this.url, url: this.url,
type: this.method, type: this.method,
useDefaultHeaders: this.useDefaultHeaders,
headers: this.requestHeaders, headers: this.requestHeaders,
data: this.body, data: this.body,
returnProp: this.binary === "" ? "responseText" : "response", returnProp: this.binary === "" ? "responseText" : "response",
@@ -242,8 +231,7 @@ Make an HTTP request. Options are:
exports.httpRequest = function(options) { exports.httpRequest = function(options) {
var type = options.type || "GET", var type = options.type || "GET",
url = options.url, url = options.url,
useDefaultHeaders = options.useDefaultHeaders !== false ? true : false, headers = options.headers || {accept: "application/json"},
headers = options.headers || (useDefaultHeaders ? {accept: "application/json"} : {}),
hasHeader = function(targetHeader) { hasHeader = function(targetHeader) {
targetHeader = targetHeader.toLowerCase(); targetHeader = targetHeader.toLowerCase();
var result = false; var result = false;
@@ -269,7 +257,7 @@ exports.httpRequest = function(options) {
if(hasHeader("Content-Type") && ["application/x-www-form-urlencoded","multipart/form-data","text/plain"].indexOf(getHeader["Content-Type"]) === -1) { if(hasHeader("Content-Type") && ["application/x-www-form-urlencoded","multipart/form-data","text/plain"].indexOf(getHeader["Content-Type"]) === -1) {
return false; return false;
} }
return true; return true;
}, },
returnProp = options.returnProp || "responseText", returnProp = options.returnProp || "responseText",
request = new XMLHttpRequest(), request = new XMLHttpRequest(),
@@ -319,10 +307,10 @@ exports.httpRequest = function(options) {
request.setRequestHeader(headerTitle,header); request.setRequestHeader(headerTitle,header);
}); });
} }
if(data && !hasHeader("Content-Type") && useDefaultHeaders) { if(data && !hasHeader("Content-Type")) {
request.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); request.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
} }
if(!hasHeader("X-Requested-With") && !isSimpleRequest(type,headers) && useDefaultHeaders) { if(!hasHeader("X-Requested-With") && !isSimpleRequest(type,headers)) {
request.setRequestHeader("X-Requested-With","TiddlyWiki"); request.setRequestHeader("X-Requested-With","TiddlyWiki");
} }
// Send data // Send data
-23
View File
@@ -1,23 +0,0 @@
/*\
title: $:/core/modules/utils/errors.js
type: application/javascript
module-type: utils
Custom errors for TiddlyWiki.
\*/
(function(){
function TranscludeRecursionError() {
Error.apply(this,arguments);
this.signatures = Object.create(null);
};
/* Maximum permitted depth of the widget tree for recursion detection */
TranscludeRecursionError.MAX_WIDGET_TREE_DEPTH = 1000;
TranscludeRecursionError.prototype = Object.create(Error);
exports.TranscludeRecursionError = TranscludeRecursionError;
})();
+2 -2
View File
@@ -42,7 +42,7 @@ var TW_TextNode = function(text) {
this.textContent = text + ""; this.textContent = text + "";
}; };
Object.setPrototypeOf(TW_TextNode.prototype,TW_Node.prototype); Object.setPrototypeOf(TW_TextNode,TW_Node.prototype);
Object.defineProperty(TW_TextNode.prototype, "nodeType", { Object.defineProperty(TW_TextNode.prototype, "nodeType", {
get: function() { get: function() {
@@ -67,7 +67,7 @@ var TW_Element = function(tag,namespace) {
this.namespaceURI = namespace || "http://www.w3.org/1999/xhtml"; this.namespaceURI = namespace || "http://www.w3.org/1999/xhtml";
}; };
Object.setPrototypeOf(TW_Element.prototype,TW_Node.prototype); Object.setPrototypeOf(TW_Element,TW_Node.prototype);
Object.defineProperty(TW_Element.prototype, "style", { Object.defineProperty(TW_Element.prototype, "style", {
get: function() { get: function() {
-52
View File
@@ -1,52 +0,0 @@
/*\
title: $:/core/modules/utils/repository.js
type: application/javascript
module-type: utils
Utilities for working with the TiddlyWiki repository file structure
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Get an object containing all the plugins as a hashmap by title of the JSON representation of the plugin
Options:
ignoreEnvironmentVariables: defaults to false
*/
exports.getAllPlugins = function(options) {
options = options || {};
var fs = require("fs"),
path = require("path"),
tiddlers = {};
// Collect up the library plugins
var collectPlugins = function(folder) {
var pluginFolders = $tw.utils.getSubdirectories(folder) || [];
for(var p=0; p<pluginFolders.length; p++) {
if(!$tw.boot.excludeRegExp.test(pluginFolders[p])) {
var pluginFields = $tw.loadPluginFolder(path.resolve(folder,"./" + pluginFolders[p]));
if(pluginFields && pluginFields.title) {
tiddlers[pluginFields.title] = pluginFields;
}
}
}
},
collectPublisherPlugins = function(folder) {
var publisherFolders = $tw.utils.getSubdirectories(folder) || [];
for(var t=0; t<publisherFolders.length; t++) {
if(!$tw.boot.excludeRegExp.test(publisherFolders[t])) {
collectPlugins(path.resolve(folder,"./" + publisherFolders[t]));
}
}
};
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.pluginsPath,options.ignoreEnvironmentVariables ? undefined : $tw.config.pluginsEnvVar),collectPublisherPlugins);
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.themesPath,options.ignoreEnvironmentVariables ? undefined : $tw.config.themesEnvVar),collectPublisherPlugins);
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.languagesPath,options.ignoreEnvironmentVariables ? undefined : $tw.config.languagesEnvVar),collectPlugins);
return tiddlers;
};
})();
+1 -1
View File
@@ -825,7 +825,7 @@ options.length .. number of characters returned defaults to 64
*/ */
exports.sha256 = function(str, options) { exports.sha256 = function(str, options) {
options = options || {} options = options || {}
return $tw.sjcl.codec.hex.fromBits($tw.sjcl.hash.sha256.hash(str)).substr(0,options.length || 64); return sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(str)).substr(0,options.length || 64);
} }
/* /*
+1 -6
View File
@@ -66,12 +66,7 @@ LogWidget.prototype.log = function() {
}); });
for(var v in this.variables) { for(var v in this.variables) {
var variable = this.parentWidget && this.parentWidget.variables[v]; allVars[v] = this.getVariable(v,{defaultValue:""});
if(variable && variable.isFunctionDefinition) {
allVars[v] = variable.value;
} else {
allVars[v] = this.getVariable(v,{defaultValue:""});
}
} }
if(this.filter) { if(this.filter) {
filteredVars = this.wiki.compileFilter(this.filter).call(this.wiki,this.wiki.makeTiddlerIterator(allVars)); filteredVars = this.wiki.compileFilter(this.filter).call(this.wiki,this.wiki.makeTiddlerIterator(allVars));
+1 -1
View File
@@ -262,7 +262,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
*/ */
ButtonWidget.prototype.refresh = function(changedTiddlers) { ButtonWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes(); var changedAttributes = this.computeAttributes();
if(changedAttributes.tooltip || changedAttributes.actions || changedAttributes.to || changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes.selectedClass || changedAttributes.style || changedAttributes.dragFilter || changedAttributes.dragTiddler || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup]) || (this.popupTitle && changedTiddlers[this.popupTitle]) || changedAttributes.popupAbsCoords || changedAttributes.setTitle || changedAttributes.setField || changedAttributes.setIndex || changedAttributes.popupTitle || changedAttributes.disabled || changedAttributes["default"]) { if(changedAttributes.actions || changedAttributes.to || changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes.selectedClass || changedAttributes.style || changedAttributes.dragFilter || changedAttributes.dragTiddler || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup]) || (this.popupTitle && changedTiddlers[this.popupTitle]) || changedAttributes.popupAbsCoords || changedAttributes.setTitle || changedAttributes.setField || changedAttributes.setIndex || changedAttributes.popupTitle || changedAttributes.disabled || changedAttributes["default"]) {
this.refreshSelf(); this.refreshSelf();
return true; return true;
} else { } else {
+25 -64
View File
@@ -31,49 +31,34 @@ DataWidget.prototype.render = function(parent,nextSibling) {
this.parentDomNode = parent; this.parentDomNode = parent;
this.computeAttributes(); this.computeAttributes();
this.execute(); this.execute();
this.dataPayload = this.computeDataTiddlerValues(); // Array of $tw.Tiddler objects var jsonPayload = JSON.stringify(this.readDataTiddlerValues(),null,4);
this.domNode = this.document.createTextNode(this.readDataTiddlerValuesAsJson()); var textNode = this.document.createTextNode(jsonPayload);
parent.insertBefore(this.domNode,nextSibling); parent.insertBefore(textNode,nextSibling);
this.domNodes.push(this.domNode); this.domNodes.push(textNode);
}; };
/* /*
Compute the internal state of the widget Compute the internal state of the widget
*/ */
DataWidget.prototype.execute = function() { DataWidget.prototype.execute = function() {
// Nothing to do here // Construct the child widgets
this.makeChildWidgets();
}; };
/* /*
Read the tiddler value(s) from a data widget as an array of tiddler field objects (not $tw.Tiddler objects) Read the tiddler value(s) from a data widget must be called after the .render() method
*/ */
DataWidget.prototype.readDataTiddlerValues = function() { DataWidget.prototype.readDataTiddlerValues = function() {
var results = [];
$tw.utils.each(this.dataPayload,function(tiddler,index) {
results.push(tiddler.getFieldStrings());
});
return results;
};
/*
Read the tiddler value(s) from a data widget as an array of tiddler field objects (not $tw.Tiddler objects)
*/
DataWidget.prototype.readDataTiddlerValuesAsJson = function() {
return JSON.stringify(this.readDataTiddlerValues(),null,4);
};
/*
Compute list of tiddlers from a data widget
*/
DataWidget.prototype.computeDataTiddlerValues = function() {
var self = this; var self = this;
// Read any attributes not prefixed with $ // Start with a blank object
var item = Object.create(null); var item = Object.create(null);
// Read any attributes not prefixed with $
$tw.utils.each(this.attributes,function(value,name) { $tw.utils.each(this.attributes,function(value,name) {
if(name.charAt(0) !== "$") { if(name.charAt(0) !== "$") {
item[name] = value; item[name] = value;
} }
}); });
item = new $tw.Tiddler(item);
// Deal with $tiddler, $filter or $compound-tiddler attributes // Deal with $tiddler, $filter or $compound-tiddler attributes
var tiddlers = [],title; var tiddlers = [],title;
if(this.hasAttribute("$tiddler")) { if(this.hasAttribute("$tiddler")) {
@@ -91,9 +76,7 @@ DataWidget.prototype.computeDataTiddlerValues = function() {
var titles = this.wiki.filterTiddlers(filter); var titles = this.wiki.filterTiddlers(filter);
$tw.utils.each(titles,function(title) { $tw.utils.each(titles,function(title) {
var tiddler = self.wiki.getTiddler(title); var tiddler = self.wiki.getTiddler(title);
if(tiddler) { tiddlers.push(tiddler);
tiddlers.push(tiddler);
}
}); });
} }
} }
@@ -103,22 +86,21 @@ DataWidget.prototype.computeDataTiddlerValues = function() {
tiddlers.push.apply(tiddlers,this.extractCompoundTiddler(title)); tiddlers.push.apply(tiddlers,this.extractCompoundTiddler(title));
} }
} }
// Return the literal item if none of the special attributes were used // Convert the literal item to field strings
if(!this.hasAttribute("$tiddler") && !this.hasAttribute("$filter") && !this.hasAttribute("$compound-tiddler")) { item = item.getFieldStrings();
if(tiddlers.length === 0) {
if(Object.keys(item).length > 0 && !!item.title) { if(Object.keys(item).length > 0 && !!item.title) {
return [new $tw.Tiddler(item)]; return [item];
} else { } else {
return []; return [];
} }
} else { } else {
// Apply the item fields to each of the tiddlers var results = [];
delete item.title; // Do not overwrite the title $tw.utils.each(tiddlers,function(tiddler,index) {
if(Object.keys(item).length > 0) { var fields = tiddler.getFieldStrings();
$tw.utils.each(tiddlers,function(tiddler,index) { results.push($tw.utils.extend({},fields,item));
tiddlers[index] = new $tw.Tiddler(tiddler,item); });
}); return results;
}
return tiddlers;
} }
}; };
@@ -152,33 +134,12 @@ DataWidget.prototype.extractCompoundTiddler = function(title) {
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
*/ */
DataWidget.prototype.refresh = function(changedTiddlers) { DataWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes(); // It would be expensive to calculate whether the changedTiddlers impact the filter
var newPayload = this.computeDataTiddlerValues(); // identified by the $filter attribute so we just refresh ourselves unconditionally
if(hasPayloadChanged(this.dataPayload,newPayload)) { this.refreshSelf();
this.dataPayload = newPayload; return true;
this.domNode.textContent = this.readDataTiddlerValuesAsJson();
return true;
} else {
return false;
}
}; };
/*
Compare two arrays of tiddlers and return true if they are different
*/
function hasPayloadChanged(a,b) {
if(a.length === b.length) {
for(var t=0; t<a.length; t++) {
if(!(a[t].isEqual(b[t]))) {
return true;
}
}
return false;
} else {
return true;
}
}
exports.data = DataWidget; exports.data = DataWidget;
})(); })();
-12
View File
@@ -74,18 +74,6 @@ ParametersWidget.prototype.execute = function() {
self.setVariable(variableName,getValue(name)); self.setVariable(variableName,getValue(name));
} }
}); });
} else {
// There is no parent transclude. i.e. direct rendering.
// We use default values only.
$tw.utils.each($tw.utils.getOrderedAttributesFromParseTreeNode(self.parseTreeNode),function(attr,index) {
var name = attr.name;
// If the attribute name starts with $$ then reduce to a single dollar
if(name.substr(0,2) === "$$") {
name = name.substr(1);
}
var value = self.getAttribute(attr.name,"");
self.setVariable(name,value);
});
} }
// Construct the child widgets // Construct the child widgets
this.makeChildWidgets(); this.makeChildWidgets();
+3 -8
View File
@@ -77,13 +77,8 @@ TestCaseWidget.prototype.render = function(parent,nextSibling) {
this.setVariable("transclusion",$tw.utils.hashString(jsonPayload)); this.setVariable("transclusion",$tw.utils.hashString(jsonPayload));
// Generate a `payloadTiddlers` variable that contains the payload in JSON format // Generate a `payloadTiddlers` variable that contains the payload in JSON format
this.setVariable("payloadTiddlers",jsonPayload); this.setVariable("payloadTiddlers",jsonPayload);
// Only run the tests if the testcase output and expected results were specified, and those tiddlers actually exist in the wiki
var shouldRunTests = false;
if(this.testcaseTestOutput && this.testcaseWiki.tiddlerExists(this.testcaseTestOutput) && this.testcaseTestExpectedResult && this.testcaseWiki.tiddlerExists(this.testcaseTestExpectedResult)) {
shouldRunTests = true;
}
// Render the test rendering if required // Render the test rendering if required
if(shouldRunTests) { if(this.testcaseTestOutput && this.testcaseTestExpectedResult) {
var testcaseOutputContainer = $tw.fakeDocument.createElement("div"); var testcaseOutputContainer = $tw.fakeDocument.createElement("div");
var testcaseOutputWidget = this.testcaseWiki.makeTranscludeWidget(this.testcaseTestOutput,{ var testcaseOutputWidget = this.testcaseWiki.makeTranscludeWidget(this.testcaseTestOutput,{
document: $tw.fakeDocument, document: $tw.fakeDocument,
@@ -106,7 +101,7 @@ TestCaseWidget.prototype.render = function(parent,nextSibling) {
var testResult = "", var testResult = "",
outputHTML = "", outputHTML = "",
expectedHTML = ""; expectedHTML = "";
if(shouldRunTests) { if(this.testcaseTestOutput && this.testcaseTestExpectedResult) {
outputHTML = testcaseOutputContainer.children[0].innerHTML; outputHTML = testcaseOutputContainer.children[0].innerHTML;
expectedHTML = this.testcaseWiki.getTiddlerText(this.testcaseTestExpectedResult); expectedHTML = this.testcaseWiki.getTiddlerText(this.testcaseTestExpectedResult);
if(outputHTML === expectedHTML) { if(outputHTML === expectedHTML) {
@@ -120,7 +115,7 @@ TestCaseWidget.prototype.render = function(parent,nextSibling) {
this.setVariable("currentTiddler",this.testcaseTestOutput); this.setVariable("currentTiddler",this.testcaseTestOutput);
} }
// Don't display anything if testHideIfPass is "yes" and the tests have passed // Don't display anything if testHideIfPass is "yes" and the tests have passed
if(this.testcaseHideIfPass === "yes" && testResult !== "fail") { if(this.testcaseHideIfPass === "yes" && testResult === "pass") {
return; return;
} }
// Render the page root template of the subwiki // Render the page root template of the subwiki
+1 -24
View File
@@ -30,30 +30,7 @@ TranscludeWidget.prototype.render = function(parent,nextSibling) {
this.parentDomNode = parent; this.parentDomNode = parent;
this.computeAttributes(); this.computeAttributes();
this.execute(); this.execute();
try { this.renderChildren(parent,nextSibling);
this.renderChildren(parent,nextSibling);
} catch(error) {
if(error instanceof $tw.utils.TranscludeRecursionError) {
// We were infinite looping.
// We need to try and abort as much of the loop as we can, so we will keep "throwing" upward until we find a transclusion that has a different signature.
// Hopefully that will land us just outside where the loop began. That's where we want to issue an error.
// Rendering widgets beneath this point may result in a freezing browser if they explode exponentially.
var transcludeSignature = this.getVariable("transclusion");
if(this.getAncestorCount() > $tw.utils.TranscludeRecursionError.MAX_WIDGET_TREE_DEPTH - 50) {
// For the first fifty transcludes we climb up, we simply collect signatures.
// We're assuming that those first 50 will likely include all transcludes involved in the loop.
error.signatures[transcludeSignature] = true;
} else if(!error.signatures[transcludeSignature]) {
// Now that we're past the first 50, let's look for the first signature that wasn't in the loop. That'll be where we print the error and resume rendering.
this.children = [this.makeChildWidget({type: "error", attributes: {
"$message": {type: "string", value: $tw.language.getString("Error/RecursiveTransclusion")}
}})];
this.renderChildren(parent,nextSibling);
return;
}
}
throw error;
}
}; };
/* /*
+9 -7
View File
@@ -12,6 +12,9 @@ Widget base class
/*global $tw: false */ /*global $tw: false */
"use strict"; "use strict";
/* Maximum permitted depth of the widget tree for recursion detection */
var MAX_WIDGET_TREE_DEPTH = 1000;
/* /*
Create a widget object for a parse tree node Create a widget object for a parse tree node
parseTreeNode: reference to the parse tree node to be rendered parseTreeNode: reference to the parse tree node to be rendered
@@ -163,8 +166,6 @@ Widget.prototype.getVariableInfo = function(name,options) {
}); });
resultList = this.wiki.filterTiddlers(value,this.makeFakeWidgetWithVariables(variables),options.source); resultList = this.wiki.filterTiddlers(value,this.makeFakeWidgetWithVariables(variables),options.source);
value = resultList[0] || ""; value = resultList[0] || "";
} else {
params = variable.params;
} }
return { return {
text: value, text: value,
@@ -316,8 +317,7 @@ Widget.prototype.getStateQualifier = function(name) {
Make a fake widget with specified variables, suitable for variable lookup in filters Make a fake widget with specified variables, suitable for variable lookup in filters
*/ */
Widget.prototype.makeFakeWidgetWithVariables = function(variables) { Widget.prototype.makeFakeWidgetWithVariables = function(variables) {
var self = this, var self = this;
variables = variables || {};
return { return {
getVariable: function(name,opts) { getVariable: function(name,opts) {
if($tw.utils.hop(variables,name)) { if($tw.utils.hop(variables,name)) {
@@ -335,7 +335,7 @@ Widget.prototype.makeFakeWidgetWithVariables = function(variables) {
}; };
} else { } else {
opts = opts || {}; opts = opts || {};
opts.variables = $tw.utils.extend(variables,opts.variables); opts.variables = variables;
return self.getVariableInfo(name,opts); return self.getVariableInfo(name,opts);
}; };
}, },
@@ -494,8 +494,10 @@ Widget.prototype.makeChildWidgets = function(parseTreeNodes,options) {
this.children = []; this.children = [];
var self = this; var self = this;
// Check for too much recursion // Check for too much recursion
if(this.getAncestorCount() > $tw.utils.TranscludeRecursionError.MAX_WIDGET_TREE_DEPTH) { if(this.getAncestorCount() > MAX_WIDGET_TREE_DEPTH) {
throw new $tw.utils.TranscludeRecursionError(); this.children.push(this.makeChildWidget({type: "error", attributes: {
"$message": {type: "string", value: $tw.language.getString("Error/RecursiveTransclusion")}
}}));
} else { } else {
// Create set variable widgets for each variable // Create set variable widgets for each variable
$tw.utils.each(options.variables,function(value,name) { $tw.utils.each(options.variables,function(value,name) {
+13 -27
View File
@@ -551,41 +551,28 @@ exports.getTiddlerBacklinks = function(targetTitle) {
/* /*
Return an array of tiddler titles that are directly transcluded within the given parse tree. `title` is the tiddler being parsed, we will ignore its self-referential transclusions, only return Return an array of tiddler titles that are directly transcluded within the given parse tree
*/ */
exports.extractTranscludes = function(parseTreeRoot, title) { exports.extractTranscludes = function(parseTreeRoot) {
// Count up the transcludes // Count up the transcludes
var transcludes = [], var transcludes = [],
checkParseTree = function(parseTree, parentNode) { checkParseTree = function(parseTree, parentNode) {
for(var t=0; t<parseTree.length; t++) { for(var t=0; t<parseTree.length; t++) {
var parseTreeNode = parseTree[t]; var parseTreeNode = parseTree[t];
if(parseTreeNode.type === "transclude") { if(parseTreeNode.type === "transclude" && parseTreeNode.attributes.$tiddler && parseTreeNode.attributes.$tiddler.type === "string") {
if(parseTreeNode.attributes.$tiddler && parseTreeNode.attributes.$tiddler.type === "string") { var value;
var value; // if it is Transclusion with Templates like `{{Index||$:/core/ui/TagTemplate}}`, the `$tiddler` will point to the template. We need to find the actual target tiddler from parent node
// if it is Transclusion with Templates like `{{Index||$:/core/ui/TagTemplate}}`, the `$tiddler` will point to the template. We need to find the actual target tiddler from parent node if(parentNode && parentNode.type === "tiddler" && parentNode.attributes.tiddler && parentNode.attributes.tiddler.type === "string") {
if(parentNode && parentNode.type === "tiddler" && parentNode.attributes.tiddler && parentNode.attributes.tiddler.type === "string") { value = parentNode.attributes.tiddler.value;
// Empty value (like `{{!!field}}`) means self-referential transclusion. } else {
value = parentNode.attributes.tiddler.value || title; value = parseTreeNode.attributes.$tiddler.value;
} else {
value = parseTreeNode.attributes.$tiddler.value;
}
} else if(parseTreeNode.attributes.tiddler && parseTreeNode.attributes.tiddler.type === "string") {
// Old transclude widget usage
value = parseTreeNode.attributes.tiddler.value;
} else if(parseTreeNode.attributes.$field && parseTreeNode.attributes.$field.type === "string") {
// Empty value (like `<$transclude $field='created'/>`) means self-referential transclusion.
value = title;
} else if(parseTreeNode.attributes.field && parseTreeNode.attributes.field.type === "string") {
// Old usage with Empty value (like `<$transclude field='created'/>`)
value = title;
} }
// Deduplicate the result. if(transcludes.indexOf(value) === -1) {
if(value && transcludes.indexOf(value) === -1) { transcludes.push(value);
$tw.utils.pushTop(transcludes,value);
} }
} }
if(parseTreeNode.children) { if(parseTreeNode.children) {
checkParseTree(parseTreeNode.children,parseTreeNode); checkParseTree(parseTreeNode.children, parseTreeNode);
} }
} }
}; };
@@ -604,8 +591,7 @@ exports.getTiddlerTranscludes = function(title) {
// Parse the tiddler // Parse the tiddler
var parser = self.parseTiddler(title); var parser = self.parseTiddler(title);
if(parser) { if(parser) {
// this will ignore self-referential transclusions from `title` return self.extractTranscludes(parser.tree);
return self.extractTranscludes(parser.tree,title);
} }
return []; return [];
}); });
-4
View File
@@ -82,10 +82,6 @@ sidebar-tab-foreground: <<colour tab-foreground>>
sidebar-tiddler-link-foreground-hover: #458588 sidebar-tiddler-link-foreground-hover: #458588
sidebar-tiddler-link-foreground: #98971a sidebar-tiddler-link-foreground: #98971a
site-title-foreground: <<colour tiddler-title-foreground>> site-title-foreground: <<colour tiddler-title-foreground>>
stability-deprecated: #cc241d
stability-experimental: #d79921
stability-legacy: #458588
stability-stable: #98971a
static-alert-foreground: #B48EAD static-alert-foreground: #B48EAD
tab-background-selected: #ebdbb2 tab-background-selected: #ebdbb2
tab-background: #665c54 tab-background: #665c54
-4
View File
@@ -82,10 +82,6 @@ sidebar-tab-foreground: <<colour tab-foreground>>
sidebar-tiddler-link-foreground-hover: #A3BE8C sidebar-tiddler-link-foreground-hover: #A3BE8C
sidebar-tiddler-link-foreground: #81A1C1 sidebar-tiddler-link-foreground: #81A1C1
site-title-foreground: <<colour tiddler-title-foreground>> site-title-foreground: <<colour tiddler-title-foreground>>
stability-deprecated: #bf616a
stability-experimental: #d08770
stability-legacy: #88c0d0
stability-stable: #a3be8c
static-alert-foreground: #B48EAD static-alert-foreground: #B48EAD
tab-background-selected: #ECEFF4 tab-background-selected: #ECEFF4
tab-background: #4C566A tab-background: #4C566A
+1 -5
View File
@@ -18,7 +18,7 @@ button-foreground: #93a1a1
code-background: #073642 code-background: #073642
code-border: #586e75 code-border: #586e75
code-foreground: #93a1a1 code-foreground: #93a1a1
dirty-indicator: #dc322f dirty-indicator: inherit
download-background: #859900 download-background: #859900
download-foreground: #073642 download-foreground: #073642
dragger-background: #073642 dragger-background: #073642
@@ -72,10 +72,6 @@ sidebar-tab-foreground-selected: #93a1a1
sidebar-tiddler-link-foreground: #2aa198 sidebar-tiddler-link-foreground: #2aa198
sidebar-tiddler-link-foreground-hover: #eee8d5 sidebar-tiddler-link-foreground-hover: #eee8d5
site-title-foreground: #d33682 site-title-foreground: #d33682
stability-deprecated: #dc322f
stability-experimental: #b58900
stability-legacy: #268bd2
stability-stable: #859900
static-alert-foreground: #93a1a1 static-alert-foreground: #93a1a1
tab-background: #073642 tab-background: #073642
tab-background-selected: #002b36 tab-background-selected: #002b36
+1 -5
View File
@@ -18,7 +18,7 @@ button-foreground: #586e75
code-background: #eee8d5 code-background: #eee8d5
code-border: #93a1a1 code-border: #93a1a1
code-foreground: #586e75 code-foreground: #586e75
dirty-indicator: #dc322f dirty-indicator: inherit
download-background: #859900 download-background: #859900
download-foreground: #eee8d5 download-foreground: #eee8d5
dragger-background: #eee8d5 dragger-background: #eee8d5
@@ -72,10 +72,6 @@ sidebar-tab-foreground-selected: #586e75
sidebar-tiddler-link-foreground: #2aa198 sidebar-tiddler-link-foreground: #2aa198
sidebar-tiddler-link-foreground-hover: #002b36 sidebar-tiddler-link-foreground-hover: #002b36
site-title-foreground: #d33682 site-title-foreground: #d33682
stability-deprecated: #dc322f
stability-experimental: #b58900
stability-legacy: #268bd2
stability-stable: #859900
static-alert-foreground: #586e75 static-alert-foreground: #586e75
tab-background: #eee8d5 tab-background: #eee8d5
tab-background-selected: #fdf6e3 tab-background-selected: #fdf6e3
+1 -5
View File
@@ -82,10 +82,6 @@ sidebar-tab-foreground: <<colour tab-foreground>>
sidebar-tiddler-link-foreground-hover: #444444 sidebar-tiddler-link-foreground-hover: #444444
sidebar-tiddler-link-foreground: #999999 sidebar-tiddler-link-foreground: #999999
site-title-foreground: <<colour tiddler-title-foreground>> site-title-foreground: <<colour tiddler-title-foreground>>
stability-stable: #008000
stability-experimental: #c07c00
stability-deprecated: #ff0000
stability-legacy: #0000ff
static-alert-foreground: #aaaaaa static-alert-foreground: #aaaaaa
tab-background-selected: #ffffff tab-background-selected: #ffffff
tab-background: #d8d8d8 tab-background: #d8d8d8
@@ -99,7 +95,7 @@ table-footer-background: #a8a8a8
table-header-background: #f0f0f0 table-header-background: #f0f0f0
tag-background: #ec6 tag-background: #ec6
tag-foreground: #ffffff tag-foreground: #ffffff
testcase-accent-level-1: #c1eaff testcase-accent-level-1: #84C5E6
testcase-accent-level-2: #E3B740 testcase-accent-level-2: #E3B740
testcase-accent-level-3: #5FD564 testcase-accent-level-3: #5FD564
tiddler-background: <<colour background>> tiddler-background: <<colour background>>
+1 -2
View File
@@ -5,6 +5,5 @@
"author": "JeremyRuston", "author": "JeremyRuston",
"core-version": ">=5.0.0", "core-version": ">=5.0.0",
"plugin-priority": "0", "plugin-priority": "0",
"list": "readme", "list": "readme"
"stability": "STABILITY_2_STABLE"
} }
+1 -11
View File
@@ -45,17 +45,7 @@ $:/config/Plugins/Disabled/$(currentTiddler)$
<$view field="title"/> <$view field="title"/>
</h2> </h2>
<h2> <h2>
<div> <div><em><$view field="version"/></em></div>
<%if [<currentTiddler>get[stability]match[STABILITY_0_DEPRECATED]] %>
<span class="tc-plugin-info-stability tc-plugin-info-stability-deprecated">DEPRECATED</span>
<%elseif [<currentTiddler>get[stability]match[STABILITY_1_EXPERIMENTAL]] %>
<span class="tc-plugin-info-stability tc-plugin-info-stability-experimental">EXPERIMENTAL</span>
<%elseif [<currentTiddler>get[stability]match[STABILITY_2_STABLE]] %>
<span class="tc-plugin-info-stability tc-plugin-info-stability-stable">STABLE</span>
<%elseif [<currentTiddler>get[stability]match[STABILITY_3_LEGACY]] %>
<span class="tc-plugin-info-stability tc-plugin-info-stability-legacy">LEGACY</span>
<%endif%>
<em><$view field="version"/></em></div>
</h2> </h2>
</div> </div>
\end \end
+2 -13
View File
@@ -70,20 +70,9 @@ $:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$
<div class="tc-plugin-info-chunk tc-plugin-info-description"> <div class="tc-plugin-info-chunk tc-plugin-info-description">
<h1><strong><$text text={{{ [<assetInfo>get[name]] ~[<assetInfo>get[original-title]split[/]last[1]] }}}/></strong>: <h1><strong><$text text={{{ [<assetInfo>get[name]] ~[<assetInfo>get[original-title]split[/]last[1]] }}}/></strong>:
&#32; &#32;
<$view tiddler=<<assetInfo>> field="description"/> <$view tiddler=<<assetInfo>> field="description"/></h1>
</h1>
<h2><$view tiddler=<<assetInfo>> field="original-title"/></h2> <h2><$view tiddler=<<assetInfo>> field="original-title"/></h2>
<div> <div><em><$view tiddler=<<assetInfo>> field="version"/></em></div>
<%if [<assetInfo>get[stability]match[STABILITY_0_DEPRECATED]] %>
<span class="tc-plugin-info-stability tc-plugin-info-stability-deprecated">DEPRECATED</span>
<%elseif [<assetInfo>get[stability]match[STABILITY_1_EXPERIMENTAL]] %>
<span class="tc-plugin-info-stability tc-plugin-info-stability-experimental">EXPERIMENTAL</span>
<%elseif [<assetInfo>get[stability]match[STABILITY_2_STABLE]] %>
<span class="tc-plugin-info-stability tc-plugin-info-stability-stable">STABLE</span>
<%elseif [<assetInfo>get[stability]match[STABILITY_3_LEGACY]] %>
<span class="tc-plugin-info-stability tc-plugin-info-stability-legacy">LEGACY</span>
<%endif%>
<em><$view tiddler=<<assetInfo>> field="version"/></em></div>
<$list filter="[<assetInfo>get[original-title]get[version]]" variable="installedVersion"><div><em>{{$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint}}</em></div></$list> <$list filter="[<assetInfo>get[original-title]get[version]]" variable="installedVersion"><div><em>{{$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint}}</em></div></$list>
</div> </div>
<div class="tc-plugin-info-chunk tc-plugin-info-buttons"> <div class="tc-plugin-info-chunk tc-plugin-info-buttons">
+1 -1
View File
@@ -9,7 +9,7 @@ list-before:
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Settings]]"> <$list filter="[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Settings]]">
<div class="tc-control-panel-setting" data-setting-title=<<currentTiddler>> > <div class="tc-control-panel-setting" data-setting-title=<<currentTiddler>> style="border-top:1px solid #eee;">
!!.tc-control-panel-accent <$link><$transclude field="caption"/></$link> !!.tc-control-panel-accent <$link><$transclude field="caption"/></$link>
@@ -1,7 +1,7 @@
title: $:/core/ui/PageTemplate title: $:/core/ui/PageTemplate
name: {{$:/language/PageTemplate/Name}} name: {{$:/language/PageTemplate/Name}}
description: {{$:/language/PageTemplate/Description}} description: {{$:/language/PageTemplate/Description}}
icon: $:/core/images/standard-layout icon: $:/core/images/default-layout
code-body: yes code-body: yes
\whitespace trim \whitespace trim
-1
View File
@@ -5,7 +5,6 @@ title: $:/core/ui/TestCaseTemplate
<$let <$let
linkTarget="yes" linkTarget="yes"
displayFormat={{!!display-format}} displayFormat={{!!display-format}}
testcaseTiddler=<<currentTiddler>>
> >
<$testcase <$testcase
testOutput="Output" testOutput="Output"
+3 -30
View File
@@ -15,7 +15,7 @@ title: $:/core/ui/testcases/DefaultTemplate
<div class="tc-test-case-wrapper"> <div class="tc-test-case-wrapper">
<div class="tc-test-case-header"> <div class="tc-test-case-header">
<h2> <h2>
<$genesis $type={{{ [<linkTarget>!match[]then[$link]else[span]] }}} to=<<testcaseTiddler>>> <$genesis $type={{{ [<linkTarget>!match[]then[$link]else[div]] }}}>
<%if [<testResult>!match[]] %> <%if [<testResult>!match[]] %>
<span class={{{ tc-test-case-result-icon [<testResult>!match[fail]then[tc-test-case-result-icon-pass]] [<testResult>match[fail]then[tc-test-case-result-icon-fail]] +[join[ ]] }}}> <span class={{{ tc-test-case-result-icon [<testResult>!match[fail]then[tc-test-case-result-icon-pass]] [<testResult>match[fail]then[tc-test-case-result-icon-fail]] +[join[ ]] }}}>
<%if [<testResult>!match[fail]] %> <%if [<testResult>!match[fail]] %>
@@ -27,31 +27,6 @@ title: $:/core/ui/testcases/DefaultTemplate
<%endif%> <%endif%>
<$view tiddler="Description" mode="inline"/> <$view tiddler="Description" mode="inline"/>
</$genesis> </$genesis>
<span class="tc-test-case-toolbar">
<$button popup=`$(state)$-more`
tooltip={{$:/language/Buttons/More/Hint}}
aria-label={{$:/language/Buttons/More/Caption}}
class="tc-btn-invisible"
selectedClass="tc-selected"
>
{{$:/core/images/down-arrow}}
</$button>
<$let
tv-config-toolbar-icons="yes"
tv-config-toolbar-text="yes"
tv-config-toolbar-class="tc-btn-invisible"
>
<$reveal state=`$(state)$-more` type="popup" position="belowleft" animate="yes">
<div class="tc-drop-down">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TestCase/Actions]!has[draft.of]]"
variable="listItem"
>
<$transclude tiddler=<<listItem>> mode="inline"/>
</$list>
</div>
</$reveal>
</$let>
</span>
</h2> </h2>
</div> </div>
<%if [[Narrative]is[tiddler]] %> <%if [[Narrative]is[tiddler]] %>
@@ -71,7 +46,7 @@ title: $:/core/ui/testcases/DefaultTemplate
<%endif%> <%endif%>
<div class="tc-test-case-panes"> <div class="tc-test-case-panes">
<div class="tc-test-case-source"> <div class="tc-test-case-source">
<$macrocall $name="tabs" tabsList="[all[tiddlers]sort[]] -[prefix<state>] -Description -Narrative -Output Output +[putfirst[]] -[has[plugin-type]]" state=<<state>> default="Output" template="$:/core/ui/testcases/DefaultTemplate/SourceTabs"/> <$macrocall $name="tabs" tabsList="[all[tiddlers]sort[]] -[prefix<state>] -Description -Narrative -ExpectedResult -Output Output +[putfirst[]] -[has[plugin-type]]" state=<<state>> default="Output" template="$:/core/ui/testcases/DefaultTemplate/SourceTabs"/>
</div> </div>
<div class="tc-test-case-divider"> <div class="tc-test-case-divider">
</div> </div>
@@ -80,9 +55,7 @@ title: $:/core/ui/testcases/DefaultTemplate
<pre><$view tiddler="Output" format="plainwikified" mode="block"/></pre> <pre><$view tiddler="Output" format="plainwikified" mode="block"/></pre>
<%else%> <%else%>
<$linkcatcher actions=<<linkcatcherActions>>> <$linkcatcher actions=<<linkcatcherActions>>>
<$tiddler tiddler="Output"> <$transclude $tiddler="Output" $mode="block"/>
<$transclude $tiddler="Output" $mode="block"/>
</$tiddler>
</$linkcatcher> </$linkcatcher>
<%endif%> <%endif%>
</div> </div>
@@ -19,9 +19,6 @@ title: $:/core/ui/testcases/DefaultTemplate/SourceTabs
</table> </table>
</$list> </$list>
<$edit class="tc-edit-texteditor" tiddler=<<currentTab>>/> <$edit class="tc-edit-texteditor" tiddler=<<currentTab>>/>
<div class="tc-test-case-footer-toolbar">
<$macrocall $name="copy-to-clipboard" src={{{ [<currentTab>get[text]] }}}/>
</div>
\end \end
<$transclude $variable="body" $mode="inline"/> <$transclude $variable="body" $mode="inline"/>
-4
View File
@@ -1,4 +0,0 @@
title: $:/core/ui/testcases/actions/Export
tags: $:/tags/TestCase/Actions
<$macrocall $name="exportButton" exportFilter="[all[tiddlers]sort[]] -[prefix[$:/state/]] -Description -Narrative -ExpectedResult -Output Output +[putfirst[]] -[has[plugin-type]]" lingoBase="$:/language/Buttons/ExportTiddlers/"/>
-11
View File
@@ -1,11 +0,0 @@
title: $:/core/ui/testcases/actions/Import
tags: $:/tags/TestCase/Actions
\whitespace trim
<$button tooltip={{$:/language/Buttons/TestCaseImport/Hint}} aria-label={{$:/language/Buttons/TestCaseImport/Caption}} class=<<tv-config-toolbar-class>>>
<$action-sendmessage $message="tm-import-tiddlers" $param=<<payloadTiddlers>>/>
{{$:/core/images/input-button}}
<span class="tc-btn-text">
<$text text={{$:/language/Buttons/TestCaseImport/Caption}}/>
</span>
</$button>
+1 -1
View File
@@ -1,6 +1,6 @@
title: $:/config/OfficialPluginLibrary title: $:/config/OfficialPluginLibrary
tags: $:/tags/PluginLibrary tags: $:/tags/PluginLibrary
url: https://tiddlywiki.com/library/v5.3.5/index.html url: https://tiddlywiki.com/library/v5.3.3/index.html
caption: {{$:/language/OfficialPluginLibrary}} caption: {{$:/language/OfficialPluginLibrary}}
{{$:/language/OfficialPluginLibrary/Hint}} {{$:/language/OfficialPluginLibrary/Hint}}
+7 -6
View File
@@ -1,17 +1,18 @@
title: $:/core/macros/CSS title: $:/core/macros/CSS
tags: $:/tags/Macro $:/tags/Global tags: $:/tags/Macro $:/tags/Global
<!-- Needs to stay that way for backwards compatibility. See GH issue: #8326 --> \procedure colour(name)
\define colour(name)
\whitespace trim \whitespace trim
<$transclude tiddler={{$:/palette}} index="$name$"> <$transclude $tiddler={{$:/palette}} $index=`$(name)$`>
<$transclude tiddler="$:/palettes/Vanilla" index="$name$"> <$transclude $tiddler="$:/palettes/Vanilla" $index=`$(name)$`>
<$transclude tiddler="$:/config/DefaultColourMappings/$name$"/> <$transclude $tiddler=`$:/config/DefaultColourMappings/$(name)$`/>
</$transclude> </$transclude>
</$transclude> </$transclude>
\end \end
\define color(name) <<colour $name$>> \procedure color(name)
<$macrocall $name=colour name=`$(name)$`/>
\end
\function box-shadow(shadow) \function box-shadow(shadow)
[[ -webkit-box-shadow: $(shadow)$; [[ -webkit-box-shadow: $(shadow)$;
+4 -6
View File
@@ -1,5 +1,5 @@
title: $:/core/macros/tag-picker title: $:/core/macros/tag-picker
tags: $:/tags/Macro $:/tags/Global tags: tags: $:/tags/Macro $:/tags/Global
first-search-filter: [subfilter<tagListFilter>!is[system]search:title<userInput>sort[]] first-search-filter: [subfilter<tagListFilter>!is[system]search:title<userInput>sort[]]
second-search-filter: [subfilter<tagListFilter>is[system]search:title<userInput>sort[]] second-search-filter: [subfilter<tagListFilter>is[system]search:title<userInput>sort[]]
@@ -154,10 +154,8 @@ The second ESC tries to close the "draft tiddler"
\function _tf.getUserInput() [<storeTitle>get[text]] \function _tf.getUserInput() [<storeTitle>get[text]]
\function _tf.getTag() [<newTagNameTiddler>get[text]] \function _tf.getTag() [<newTagNameTiddler>get[text]]
<!-- Use this function if tag-picker is a stand alone macro. Otherwise use "newTagNameTiddler" defined for fieldmangler in EditTemplate -->
\function _tf.makeTagNameTiddler() [[$:/temp/NewTagName]] [<tagField>!match[tags]] +[join[/]] [<qualify>] +[join[]]
<!-- keep those variables because they may "bleed" into macros using old syntax --> <!-- keep those variables because they may "blead" into macros using old syntax -->
<$let <$let
palette={{$:/palette}} palette={{$:/palette}}
colourA={{{ [<palette>getindex[foreground]] }}} colourA={{{ [<palette>getindex[foreground]] }}}
@@ -166,7 +164,7 @@ The second ESC tries to close the "draft tiddler"
saveTiddler={{{ [<tiddler>is[blank]then<currentTiddler>else<tiddler>] }}} saveTiddler={{{ [<tiddler>is[blank]then<currentTiddler>else<tiddler>] }}}
newTagNameTiddler={{{ [[newTagNameTiddler]is[variable]then<newTagNameTiddler>] :else[<_tf.makeTagNameTiddler>] }}} newTagNameTiddler={{{ [[$:/temp/NewTagName]] [<tagField>!match[tags]] +[join[/]] [<qualify>] +[join[]] }}}
storeTitle={{{ [[$:/temp/NewTagName/input]] [<tagField>!match[tags]] +[join[/]] [<qualify>] +[join[]] }}} storeTitle={{{ [[$:/temp/NewTagName/input]] [<tagField>!match[tags]] +[join[/]] [<qualify>] +[join[]] }}}
newTagNameSelectionTiddlerQualified=<<qualify "$:/temp/NewTagName/selected-item">> newTagNameSelectionTiddlerQualified=<<qualify "$:/temp/NewTagName/selected-item">>
@@ -181,4 +179,4 @@ The second ESC tries to close the "draft tiddler"
> >
<$macrocall $name="tag-picker-inner"/> <$macrocall $name="tag-picker-inner"/>
</$let> </$let>
\end \end
-2
View File
@@ -1,2 +0,0 @@
title: $:/tags/TestCase/Actions
list:
@@ -1,4 +0,0 @@
title: $:/DefaultTiddlers
HelloThere
$:/plugins/tiddlywiki/geospatial
@@ -1,14 +0,0 @@
title: GeoFeatures
tags: $:/tags/GeospatialDemo
This is a list of all the tiddlers containing ~GeoJSON feature collections in this wiki (identified by the tag <<tag "$:/tags/GeoFeature">>). A ~GeoJSON feature collection is a list of features, each of which consists of a geometry and associated metadata.
<ul>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/GeoFeature]sort[caption]]">
<li>
<$link>
<$transclude field="caption"><$view field="title"/></$view>
</$link>
</li>
</$list>
</ul>
@@ -1,27 +0,0 @@
title: Flickr Demo
caption: Flickr
tags: $:/tags/GeospatialDemo
! Retrieve Geotagged Flickr Photos
This demo will not work until you have set a Flickr API key in the [[Geospatial plugin settings|$:/plugins/tiddlywiki/geospatial/settings]].
<$button>
<$macrocall $name="flickr-get-album-items" albumID={{$:/config/flickr-param/album-id}}/>
Get Flickr album
</$button> <$edit-text tiddler="$:/config/flickr-param/album-id" tag="input"/> (parameter should be an album ID, e.g. 72157630297432522)
<$button>
<$macrocall $name="flickr-get-interesting-items"/>
Get Flickr interesting items
</$button>
<$button>
<$macrocall $name="flickr-get-photos-of-user-items" userID={{$:/config/flickr-param/user-id}}/>
Get Flickr photos of user
</$button> <$edit-text tiddler="$:/config/flickr-param/user-id" tag="input"/> (parameter should be a user ID, e.g. 35468148136@N01)
<$button>
<$macrocall $name="flickr-get-group-items" groupID={{$:/config/flickr-param/group-id}}/>
Get Flickr group
</$button> <$edit-text tiddler="$:/config/flickr-param/group-id" tag="input"/> (parameter should be an group ID, e.g. 22075379@N00)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 KiB

@@ -1,2 +0,0 @@
title: Geospatial Plugin Logo
type: image/png
@@ -1,37 +0,0 @@
title: HelloThere
//The latest build of the Geospatial Plugin can be found at:// https://tiddlywiki5-git-geospatial-plugin-jermolene.vercel.app/plugins/tiddlywiki/geospatial/index.html
!! Introduction
{{$:/plugins/tiddlywiki/geospatial/readme}}
!! Prerequisites
This demo requires that the API keys needed to access external services be obtained by the end user and manually configured. These keys are stored in the browser and so only need to be set up once. See the ''Settings'' tab of [[the plugin|$:/plugins/tiddlywiki/geospatial]] for details.
!! Demos
* Visit the ~GeoFeatures and ~GeoMarkers tabs to see the data loaded into this wiki
* Click on a link to a layer or marker to open the corresponding tiddler that includes a map
* Use the Flickr tab to retrieve geotagged photographs from Flickr
* Visit a ~GeoMarker tiddler and use the "Call ~TravelTime" button to calculate an isochrone from that location using the ~TravelTime API
! Map Showing All Features and Markers
<$geomap
state=<<qualify "$:/state/demo-map">>
startPosition="bounds"
>
<$list filter="[all[tiddlers+shadows]tag[$:/tags/GeoBaseLayer]]">
<$geobaselayer title=<<currentTiddler>>/>
</$list>
<$list filter="[all[tiddlers+shadows]tag[$:/tags/GeoMarker]]">
<$geolayer lat={{!!lat}} long={{!!long}} alt={{!!alt}} color={{!!color}} name={{!!caption}}/>
</$list>
<$list filter="[all[tiddlers+shadows]tag[$:/tags/GeoFeature]]">
<$geolayer json={{!!text}} color={{!!color}} name={{!!caption}}/>
</$list>
</$geomap>
<<tabs tabsList:"[all[tiddlers+shadows]tag[$:/tags/GeospatialDemo]]" default:"GeoMarkers">>
@@ -1,53 +0,0 @@
title: GeoMarkers
tags: $:/tags/GeospatialDemo
\procedure onsuccess()
<$action-setfield
$tiddler="CurrentLocation"
tags="$:/tags/GeoMarker"
timestamp=<<timestamp>>
lat=<<latitude>>
long=<<longitude>>
alt=<<altitude>>
accuracy=<<accuracy>>
altitudeAccuracy=<<altitudeAccuracy>>
heading=<<heading>>
speed=<<speed>>
/>
\end
\procedure onerror()
<$action-setfield
$tiddler="CurrentLocation"
$field="text"
$value=<<error>>
/>
\end
\procedure onclick()
<$action-sendmessage
$message="tm-request-geolocation"
actionsSuccess=<<onsuccess>>
actionsError=<<onerror>>
/>
\end
This is a list of all the tiddlers containing ~GeoJSON markers in this wiki (identified by the tag <<tag "$:/tags/GeoMarker">>). A ~GeoJSON marker identifies a location via latitude and longitude (and optional altitude) and may also contain associated metadata in JSON format.
Click this button to create a marker from the current location. Your browser will ask for permission before granting the request. On some browsers it takes a couple of seconds for the location to appear.
<$button actions=<<onclick>>>
Request location
</$button>
{{CurrentLocation}}
<ul>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/GeoMarker]sort[caption]]">
<li>
<$link>
<$view field="caption"><$view field="title"/></$view>
</$link>
</li>
</$list>
</ul>
@@ -1,3 +0,0 @@
title: $:/SiteSubtitle
Geographic Data Features for ~TiddlyWiki
@@ -1,3 +0,0 @@
title: $:/SiteTitle
[img width=200 [Geospatial Plugin Logo]]<br>Geospatial Plugin
@@ -1,6 +0,0 @@
title: $:/plugins/geospatial/demo/ViewTemplateBodyFilters
tags: $:/tags/ViewTemplateBodyFilter
list-before: $:/config/ViewTemplateBodyFilters/stylesheet
[tag[$:/tags/GeoFeature]then[ui/geofeature]]
[tag[$:/tags/GeoMarker]then[ui/geomarker]]
@@ -1,9 +0,0 @@
title: cities/LimehouseTownHall
tags: $:/tags/GeoMarker
caption: Limehouse Town Hall
lat: 51.51216651476898
long: -0.03138562132137639
alt: 0
This is Limehouse Town Hall!
@@ -1,9 +0,0 @@
title: cities/Motovun
tags: $:/tags/GeoMarker
icon: Motovun Jack.svg
caption: Motovun
lat: 45.336453407749225
long: 13.828231379455806
alt: 0
This is Motovun!
@@ -1,8 +0,0 @@
title: cities/NewYork
tags: $:/tags/GeoMarker
caption: New York
lat: 40.712778
long: -74.006111
alt: 0
This is New York!
@@ -1,8 +0,0 @@
title: cities/Oxford
tags: $:/tags/GeoMarker
caption: Oxford
lat: 51.751944
long: -1.257778
alt: 0
This is Oxford!
@@ -1,8 +0,0 @@
title: cities/Toronto
tags: $:/tags/GeoMarker
caption: Toronto
lat: 43.651070
long: -79.347015
alt: 0
This is Toronto!
@@ -1,8 +0,0 @@
title: cities/Winchester
tags: $:/tags/GeoMarker
caption: Winchester
lat: 51.0632
long: -1.308
alt: 0
This is Winchester!
@@ -1,5 +0,0 @@
title: $:/config/flickr-param/
album-id: 72157630297432522
user-id: 35468148136@N01
group-id: 22075379@N00
@@ -1,4 +0,0 @@
title: $:/config/plugins/tiddlywiki/xlsx-utils/default-import-spec
type: text/vnd.tiddlywiki
$:/_importspec/RealEstate/
Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

@@ -1,2 +0,0 @@
title: $:/favicon.ico
type: image/png
File diff suppressed because one or more lines are too long
@@ -1,5 +0,0 @@
title: $:/geospatialdemo/features/canada-census-subdivision-millesime
caption: Canada Census Subdivisions Millesime
type: application/json
tags: $:/tags/GeoFeature
color: #f8f
@@ -1,109 +0,0 @@
title: $:/geospatialdemo/features/denver/bikerental
caption: Denver bike rentals as ~GeoJSON points
tags: $:/tags/GeoFeature
type: application/json
color: blue
{
"type": "FeatureCollection",
"features": [
{
"geometry": {
"type": "Point",
"coordinates": [
-104.9998241,
39.7471494
]
},
"type": "Feature",
"properties": {
"popupContent": "This is a B-Cycle Station. Come pick up a bike and pay by the hour. What a deal!"
},
"id": 51
},
{
"geometry": {
"type": "Point",
"coordinates": [
-104.9983545,
39.7502833
]
},
"type": "Feature",
"properties": {
"popupContent": "This is a B-Cycle Station. Come pick up a bike and pay by the hour. What a deal!"
},
"id": 52
},
{
"geometry": {
"type": "Point",
"coordinates": [
-104.9963919,
39.7444271
]
},
"type": "Feature",
"properties": {
"popupContent": "This is a B-Cycle Station. Come pick up a bike and pay by the hour. What a deal!"
},
"id": 54
},
{
"geometry": {
"type": "Point",
"coordinates": [
-104.9960754,
39.7498956
]
},
"type": "Feature",
"properties": {
"popupContent": "This is a B-Cycle Station. Come pick up a bike and pay by the hour. What a deal!"
},
"id": 55
},
{
"geometry": {
"type": "Point",
"coordinates": [
-104.9933717,
39.7477264
]
},
"type": "Feature",
"properties": {
"popupContent": "This is a B-Cycle Station. Come pick up a bike and pay by the hour. What a deal!"
},
"id": 57
},
{
"geometry": {
"type": "Point",
"coordinates": [
-104.9913392,
39.7432392
]
},
"type": "Feature",
"properties": {
"popupContent": "This is a B-Cycle Station. Come pick up a bike and pay by the hour. What a deal!"
},
"id": 58
},
{
"geometry": {
"type": "Point",
"coordinates": [
-104.9788452,
39.6933755
]
},
"type": "Feature",
"properties": {
"popupContent": "This is a B-Cycle Station. Come pick up a bike and pay by the hour. What a deal!"
},
"id": 74
}
]
}
@@ -1,63 +0,0 @@
title: $:/geospatialdemo/features/denver/campus
caption: Denver Auraria West Campus as ~GeoJSON multipolygons
tags: $:/tags/GeoFeature
type: application/json
color: purple
{
"type": "Feature",
"properties": {
"popupContent": "This is the Auraria West Campus",
"style": {
"weight": 2,
"color": "#999",
"opacity": 1,
"fillColor": "#B0DE5C",
"fillOpacity": 0.8
}
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[-105.00432014465332, 39.74732195489861],
[-105.00715255737305, 39.74620006835170],
[-105.00921249389647, 39.74468219277038],
[-105.01067161560059, 39.74362625960105],
[-105.01195907592773, 39.74290029616054],
[-105.00989913940431, 39.74078835902781],
[-105.00758171081543, 39.74059036160317],
[-105.00346183776855, 39.74059036160317],
[-105.00097274780272, 39.74059036160317],
[-105.00062942504881, 39.74072235994946],
[-105.00020027160645, 39.74191033368865],
[-105.00071525573731, 39.74276830198601],
[-105.00097274780272, 39.74369225589818],
[-105.00097274780272, 39.74461619742136],
[-105.00123023986816, 39.74534214278395],
[-105.00183105468751, 39.74613407445653],
[-105.00432014465332, 39.74732195489861]
],[
[-105.00361204147337, 39.74354376414072],
[-105.00301122665405, 39.74278480127163],
[-105.00221729278564, 39.74316428375108],
[-105.00283956527711, 39.74390674342741],
[-105.00361204147337, 39.74354376414072]
]
],[
[
[-105.00942707061768, 39.73989736613708],
[-105.00942707061768, 39.73910536278566],
[-105.00685214996338, 39.73923736397631],
[-105.00384807586671, 39.73910536278566],
[-105.00174522399902, 39.73903936209552],
[-105.00041484832764, 39.73910536278566],
[-105.00041484832764, 39.73979836621592],
[-105.00535011291504, 39.73986436617916],
[-105.00942707061768, 39.73989736613708]
]
]
]
}
}

Some files were not shown because too many files have changed in this diff Show More