mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-05-06 21:51:31 +00:00
Compare commits
30 Commits
issue-9808
...
bidirectio
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a80bd4a6f | ||
|
|
82bde9bffc | ||
|
|
ea84baa5a3 | ||
|
|
a4e4d36bf6 | ||
|
|
3ed481b2e2 | ||
|
|
27c60ff58d | ||
|
|
748ef8aa8d | ||
|
|
9cfa5a29fb | ||
|
|
5ea43ce212 | ||
|
|
df6bbbdedf | ||
|
|
37a461323e | ||
|
|
b29da7baac | ||
|
|
9830d4338c | ||
|
|
75b54457ed | ||
|
|
51f322c3c6 | ||
|
|
853af2d848 | ||
|
|
2c1cb33081 | ||
|
|
75267b730a | ||
|
|
3bc78e6641 | ||
|
|
765386a4f9 | ||
|
|
ca8dcb690a | ||
|
|
99a00ab1b4 | ||
|
|
f95966d5bb | ||
|
|
3a20837c96 | ||
|
|
e3e49bb61e | ||
|
|
748969322b | ||
|
|
4611e3569f | ||
|
|
c1e145ca12 | ||
|
|
882504c8d1 | ||
|
|
b8f542458b |
@@ -5,7 +5,7 @@
|
||||
# Default to the current version number for building the plugin library
|
||||
|
||||
if [ -z "$TW5_BUILD_VERSION" ]; then
|
||||
TW5_BUILD_VERSION=v5.4.0
|
||||
TW5_BUILD_VERSION=v5.5.0
|
||||
fi
|
||||
|
||||
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
||||
|
||||
68
boot/boot.js
68
boot/boot.js
@@ -1539,8 +1539,8 @@ Register all the module tiddlers that have a module type
|
||||
$tw.Wiki.prototype.defineShadowModules = function() {
|
||||
var self = this;
|
||||
this.eachShadow(function(tiddler,title) {
|
||||
// Don't define the module if it is overidden by an ordinary tiddler
|
||||
if(!self.tiddlerExists(title) && tiddler.hasField("module-type")) {
|
||||
// Don't define the module if it is overidden by an ordinary tiddler, or has already been defined
|
||||
if(!self.tiddlerExists(title) && tiddler.hasField("module-type") && !$tw.utils.hop($tw.modules.titles,title)) {
|
||||
if(tiddler.hasField("draft.of")) {
|
||||
// Report a fundamental problem
|
||||
console.warn(`TiddlyWiki: Plugins should not contain tiddlers with a 'draft.of' field: ${tiddler.fields.title}`);
|
||||
@@ -1971,7 +1971,7 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
||||
});
|
||||
|
||||
// Helper to process a file
|
||||
var processFile = function(filename,isTiddlerFile,fields,isEditableFile,rootPath) {
|
||||
var processFile = function(filename,isTiddlerFile,fields,isEditableFile,rootPath,dynamicStoreId) {
|
||||
var extInfo = $tw.config.fileExtensionInfo[path.extname(filename)],
|
||||
type = (extInfo || {}).type || fields.type || "text/plain",
|
||||
typeInfo = $tw.config.contentTypeInfo[type] || {},
|
||||
@@ -2046,9 +2046,9 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
||||
});
|
||||
});
|
||||
if(isEditableFile) {
|
||||
tiddlers.push({filepath: pathname, hasMetaFile: !!metadata && !isTiddlerFile, isEditableFile: true, tiddlers: fileTiddlers});
|
||||
tiddlers.push({filepath: pathname, hasMetaFile: !!metadata && !isTiddlerFile, isEditableFile: true, dynamicStoreId: dynamicStoreId, tiddlers: fileTiddlers});
|
||||
} else {
|
||||
tiddlers.push({tiddlers: fileTiddlers});
|
||||
tiddlers.push({dynamicStoreId: dynamicStoreId, tiddlers: fileTiddlers});
|
||||
}
|
||||
};
|
||||
// Helper to recursively search subdirectories
|
||||
@@ -2089,6 +2089,31 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
||||
// Process directory specifier
|
||||
var dirPath = path.resolve(filepath,dirSpec.path);
|
||||
if(fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) {
|
||||
// Register a dynamic store if requested
|
||||
var dynamicStoreId = null;
|
||||
if(dirSpec.dynamicStore && $tw.boot.dynamicStores) {
|
||||
dynamicStoreId = dirPath;
|
||||
var existing = null;
|
||||
for(var ds=0; ds<$tw.boot.dynamicStores.length; ds++) {
|
||||
if($tw.boot.dynamicStores[ds].id === dynamicStoreId) {
|
||||
existing = $tw.boot.dynamicStores[ds];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!existing) {
|
||||
$tw.boot.dynamicStores.push({
|
||||
id: dynamicStoreId,
|
||||
directory: dirPath,
|
||||
saveFilter: dirSpec.dynamicStore.saveFilter || "",
|
||||
watch: dirSpec.dynamicStore.watch !== false,
|
||||
debounce: dirSpec.dynamicStore.debounce || 400,
|
||||
filesRegExp: dirSpec.filesRegExp || "^.*$",
|
||||
searchSubdirectories: !!dirSpec.searchSubdirectories,
|
||||
isTiddlerFile: !!dirSpec.isTiddlerFile,
|
||||
fields: dirSpec.fields || {}
|
||||
});
|
||||
}
|
||||
}
|
||||
var files = getAllFiles(dirPath, dirSpec.searchSubdirectories),
|
||||
fileRegExp = new RegExp(dirSpec.filesRegExp || "^.*$"),
|
||||
metaRegExp = /^.*\.meta$/;
|
||||
@@ -2097,7 +2122,7 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
||||
filename = path.basename(thisPath);
|
||||
if(filename !== "tiddlywiki.files" && !metaRegExp.test(filename) && fileRegExp.test(filename)) {
|
||||
dirSpec.fields = dirSpec.fields || {};
|
||||
processFile(thisPath,dirSpec.isTiddlerFile,dirSpec.fields,dirSpec.isEditableFile,dirSpec.path);
|
||||
processFile(thisPath,dirSpec.isTiddlerFile,dirSpec.fields,dirSpec.isEditableFile || !!dirSpec.dynamicStore,dirSpec.path,dynamicStoreId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -2284,6 +2309,24 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
||||
$tw.loadPlugins(wikiInfo.plugins,$tw.config.pluginsPath,$tw.config.pluginsEnvVar);
|
||||
$tw.loadPlugins(wikiInfo.themes,$tw.config.themesPath,$tw.config.themesEnvVar);
|
||||
$tw.loadPlugins(wikiInfo.languages,$tw.config.languagesPath,$tw.config.languagesEnvVar);
|
||||
// Register plugin-provided tiddlerdeserializer and tiddlerserializer modules now,
|
||||
// so they are available when the wiki tiddler files are read from disk below.
|
||||
// We also apply the supporting `utils`, `tiddlerfield`, and `tiddlermethod`
|
||||
// modules so deserializers can call into them (e.g. core's text/html
|
||||
// deserializer needs $tw.utils.extractEncryptedStoreArea).
|
||||
// (All of these steps run again later in execStartup; they are idempotent.)
|
||||
$tw.wiki.readPluginInfo();
|
||||
$tw.wiki.registerPluginTiddlers("plugin");
|
||||
$tw.wiki.unpackPluginTiddlers();
|
||||
$tw.wiki.defineShadowModules();
|
||||
$tw.modules.applyMethods("utils",$tw.utils);
|
||||
if($tw.node) {
|
||||
$tw.modules.applyMethods("utils-node",$tw.utils);
|
||||
}
|
||||
$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap("tiddlerfield");
|
||||
$tw.modules.applyMethods("tiddlermethod",$tw.Tiddler.prototype);
|
||||
$tw.modules.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerModules);
|
||||
$tw.modules.applyMethods("tiddlerserializer",$tw.Wiki.tiddlerSerializerModules);
|
||||
// Load the wiki files, registering them as writable
|
||||
var resolvedWikiPath = path.resolve(wikiPath,$tw.config.wikiTiddlersSubDir);
|
||||
$tw.utils.each($tw.loadTiddlersFromPath(resolvedWikiPath),function(tiddlerFile) {
|
||||
@@ -2293,7 +2336,8 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
||||
filepath: tiddlerFile.filepath,
|
||||
type: tiddlerFile.type,
|
||||
hasMetaFile: tiddlerFile.hasMetaFile,
|
||||
isEditableFile: config["retain-original-tiddler-path"] || tiddlerFile.isEditableFile || tiddlerFile.filepath.indexOf($tw.boot.wikiTiddlersPath) !== 0
|
||||
isEditableFile: config["retain-original-tiddler-path"] || tiddlerFile.isEditableFile || tiddlerFile.filepath.indexOf($tw.boot.wikiTiddlersPath) !== 0,
|
||||
dynamicStoreId: tiddlerFile.dynamicStoreId || null
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -2305,7 +2349,10 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
||||
for(var title in $tw.boot.files) {
|
||||
fileInfo = $tw.boot.files[title];
|
||||
if(fileInfo.isEditableFile) {
|
||||
relativePath = path.relative($tw.boot.wikiTiddlersPath,fileInfo.filepath);
|
||||
// For tiddlers loaded from a dynamic store, compute originalpath relative to the store's directory
|
||||
// so that save-time path resolution against that directory yields the correct location.
|
||||
var basePath = fileInfo.dynamicStoreId || $tw.boot.wikiTiddlersPath;
|
||||
relativePath = path.relative(basePath,fileInfo.filepath);
|
||||
fileInfo.originalpath = relativePath;
|
||||
output[title] =
|
||||
path.sep === "/" ?
|
||||
@@ -2431,6 +2478,8 @@ $tw.boot.initStartup = function(options) {
|
||||
if(!$tw.boot.tasks.readBrowserTiddlers) {
|
||||
// For writable tiddler files, a hashmap of title to {filepath:,type:,hasMetaFile:}
|
||||
$tw.boot.files = Object.create(null);
|
||||
// Array of {id, directory, saveFilter, watch, debounce} registered via tiddlywiki.files dynamicStore directives
|
||||
$tw.boot.dynamicStores = [];
|
||||
// System paths and filenames
|
||||
$tw.boot.bootPath = options.bootPath || path.dirname(module.filename);
|
||||
$tw.boot.corePath = path.resolve($tw.boot.bootPath,"../core");
|
||||
@@ -2520,6 +2569,9 @@ $tw.boot.initStartup = function(options) {
|
||||
// Install the tiddler deserializer modules
|
||||
$tw.Wiki.tiddlerDeserializerModules = Object.create(null);
|
||||
$tw.modules.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerModules);
|
||||
// Install the tiddler serializer modules
|
||||
$tw.Wiki.tiddlerSerializerModules = Object.create(null);
|
||||
$tw.modules.applyMethods("tiddlerserializer",$tw.Wiki.tiddlerSerializerModules);
|
||||
// Call unload handlers in the browser
|
||||
if($tw.browser) {
|
||||
window.onbeforeunload = function(event) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -238,6 +238,10 @@ exports.generateTiddlerFileInfo = function(tiddler,options) {
|
||||
// Save as a .tid file
|
||||
fileInfo.type = "application/x-tiddler";
|
||||
fileInfo.hasMetaFile = false;
|
||||
} else if($tw.Wiki.tiddlerSerializerModules && $tw.Wiki.tiddlerSerializerModules[tiddlerType]) {
|
||||
// A serializer is registered for this content type - save as a single self-contained file
|
||||
fileInfo.type = tiddlerType;
|
||||
fileInfo.hasMetaFile = false;
|
||||
} else {
|
||||
// Save as a text/binary file and a .meta file
|
||||
fileInfo.type = tiddlerType;
|
||||
@@ -416,7 +420,16 @@ Save a tiddler to a file described by the fileInfo:
|
||||
*/
|
||||
exports.saveTiddlerToFile = function(tiddler,fileInfo,callback) {
|
||||
$tw.utils.createDirectory(path.dirname(fileInfo.filepath));
|
||||
if(fileInfo.hasMetaFile) {
|
||||
var serializer = $tw.Wiki.tiddlerSerializerModules && $tw.Wiki.tiddlerSerializerModules[fileInfo.type];
|
||||
if(serializer && !fileInfo.hasMetaFile && fileInfo.type !== "application/x-tiddler" && fileInfo.type !== "application/json") {
|
||||
var typeInfo = $tw.config.contentTypeInfo[fileInfo.type] || {encoding: "utf8"};
|
||||
fs.writeFile(fileInfo.filepath,serializer(tiddler),typeInfo.encoding,function(err) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
return callback(null,fileInfo);
|
||||
});
|
||||
} else if(fileInfo.hasMetaFile) {
|
||||
// Save the tiddler as a separate body and meta file
|
||||
var typeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/plain"] || {encoding: "utf8"};
|
||||
fs.writeFile(fileInfo.filepath,tiddler.fields.text || "",typeInfo.encoding,function(err) {
|
||||
@@ -458,7 +471,11 @@ Save a tiddler to a file described by the fileInfo:
|
||||
*/
|
||||
exports.saveTiddlerToFileSync = function(tiddler,fileInfo) {
|
||||
$tw.utils.createDirectory(path.dirname(fileInfo.filepath));
|
||||
if(fileInfo.hasMetaFile) {
|
||||
var serializer = $tw.Wiki.tiddlerSerializerModules && $tw.Wiki.tiddlerSerializerModules[fileInfo.type];
|
||||
if(serializer && !fileInfo.hasMetaFile && fileInfo.type !== "application/x-tiddler" && fileInfo.type !== "application/json") {
|
||||
var typeInfo = $tw.config.contentTypeInfo[fileInfo.type] || {encoding: "utf8"};
|
||||
fs.writeFileSync(fileInfo.filepath,serializer(tiddler),typeInfo.encoding);
|
||||
} else if(fileInfo.hasMetaFile) {
|
||||
// Save the tiddler as a separate body and meta file
|
||||
var typeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/plain"] || {encoding: "utf8"};
|
||||
fs.writeFileSync(fileInfo.filepath,tiddler.fields.text || "",typeInfo.encoding);
|
||||
|
||||
@@ -327,7 +327,7 @@ exports.parseMacroParameterAsAttribute = function(source,pos) {
|
||||
// Define our regexps
|
||||
var reAttributeName = /([^\/\s>"'`=:]+)/y,
|
||||
reStrictIdentifier = /^[A-Za-z0-9\-_]+$/,
|
||||
reUnquotedAttribute = /((?:(?:>(?!>))|[^\s>"'])+)/y,
|
||||
reUnquotedAttribute = /(?!<<)((?:(?:>(?!>))|[^\s>"'])+)/y,
|
||||
reFilteredValue = /\{\{\{([\S\s]+?)\}\}\}/y,
|
||||
reIndirectValue = /\{\{([^\}]+)\}\}/y,
|
||||
reSubstitutedValue = /(?:```([\s\S]*?)```|`([^`]|[\S\s]*?)`)/y;
|
||||
@@ -576,6 +576,9 @@ exports.parseAttribute = function(source,pos) {
|
||||
pos = unquotedValue.end;
|
||||
node.type = "string";
|
||||
node.value = unquotedValue.match[1];
|
||||
} else if(source.charAt(pos) === "<" && source.charAt(pos + 1) === "<" && source.indexOf(">>",pos) !== -1) {
|
||||
// Value looks like a macro invocation (starts with << with a closing >> ahead) but does not parse as one. Return null so the enclosing tag fails to parse rather than silently binding the attribute to "true" and treating the remainder as further attributes (restores v5.3.8 behaviour)
|
||||
return null;
|
||||
} else {
|
||||
node.type = "string";
|
||||
node.value = "true";
|
||||
|
||||
@@ -34,6 +34,7 @@ exports.startup = function() {
|
||||
$tw.modules.applyMethods("wikimethod",$tw.Wiki.prototype);
|
||||
$tw.wiki.addIndexersToWiki();
|
||||
$tw.modules.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerModules);
|
||||
$tw.modules.applyMethods("tiddlerserializer",$tw.Wiki.tiddlerSerializerModules);
|
||||
$tw.macros = $tw.modules.getModulesByTypeAsHashmap("macro");
|
||||
$tw.wiki.initParsers();
|
||||
// --------------------------
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/config/OfficialPluginLibrary
|
||||
tags: $:/tags/PluginLibrary
|
||||
url: https://tiddlywiki.com/library/v5.4.0/index.html
|
||||
url: https://tiddlywiki.com/library/v5.5.0/index.html
|
||||
caption: {{$:/language/OfficialPluginLibrary}}
|
||||
|
||||
{{$:/language/OfficialPluginLibrary/Hint}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/config/LocalPluginLibrary
|
||||
tags: $:/tags/PluginLibrary
|
||||
url: http://127.0.0.1:8080/prerelease/library/v5.4.0/index.html
|
||||
url: http://127.0.0.1:8080/prerelease/library/v5.5.0/index.html
|
||||
caption: {{$:/language/OfficialPluginLibrary}} (Prerelease Local)
|
||||
|
||||
A locally installed version of the official ~TiddlyWiki plugin library at tiddlywiki.com for testing and debugging. //Requires a local web server to share the library//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/config/OfficialPluginLibrary
|
||||
tags: $:/tags/PluginLibrary
|
||||
url: https://tiddlywiki.com/prerelease/library/v5.4.0/index.html
|
||||
url: https://tiddlywiki.com/prerelease/library/v5.5.0/index.html
|
||||
caption: {{$:/language/OfficialPluginLibrary}} (Prerelease)
|
||||
|
||||
The prerelease version of the official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
|
||||
|
||||
4
editions/test/tiddlers/TabFour.tid
Normal file
4
editions/test/tiddlers/TabFour.tid
Normal file
@@ -0,0 +1,4 @@
|
||||
modified: 20260413092032887
|
||||
title: TabFour
|
||||
|
||||
Text tab 4
|
||||
5
editions/test/tiddlers/TabOne.tid
Normal file
5
editions/test/tiddlers/TabOne.tid
Normal file
@@ -0,0 +1,5 @@
|
||||
caption: t 1
|
||||
modified: 20260413092032887
|
||||
title: TabOne
|
||||
|
||||
Text tab 1
|
||||
6
editions/test/tiddlers/TabThree.tid
Normal file
6
editions/test/tiddlers/TabThree.tid
Normal file
@@ -0,0 +1,6 @@
|
||||
caption: t 3
|
||||
description: desc
|
||||
modified: 20260413092032887
|
||||
title: TabThree
|
||||
|
||||
Text tab 3
|
||||
5
editions/test/tiddlers/TabTwo.tid
Normal file
5
editions/test/tiddlers/TabTwo.tid
Normal file
@@ -0,0 +1,5 @@
|
||||
caption: t 2
|
||||
modified: 20260413092032887
|
||||
title: TabTwo
|
||||
|
||||
Text tab 2
|
||||
7
editions/test/tiddlers/body-template.tid
Normal file
7
editions/test/tiddlers/body-template.tid
Normal file
@@ -0,0 +1,7 @@
|
||||
code-body: yes
|
||||
modified: 20260413092032887
|
||||
title: body-template
|
||||
|
||||
!! <<currentTab>>
|
||||
|
||||
<$transclude tiddler=<<currentTab>> mode="block"/>
|
||||
5
editions/test/tiddlers/button-template.tid
Normal file
5
editions/test/tiddlers/button-template.tid
Normal file
@@ -0,0 +1,5 @@
|
||||
code-body: yes
|
||||
modified: 20260413092032887
|
||||
title: button-template
|
||||
|
||||
<$transclude tiddler=<<currentTab>> field="description"><$transclude tiddler=<<currentTab>> field="caption"><$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/></$transclude></$transclude>
|
||||
72
editions/test/tiddlers/tabs-macro-definition.tid
Normal file
72
editions/test/tiddlers/tabs-macro-definition.tid
Normal file
@@ -0,0 +1,72 @@
|
||||
code-body: yes
|
||||
modified: 20260413092032887
|
||||
title: tabs-macro-definition
|
||||
|
||||
\define tabs-button()
|
||||
\whitespace trim
|
||||
<$button
|
||||
set=<<tabsState>>
|
||||
setTo=<<currentTab>>
|
||||
default=<<__default__>>
|
||||
selectedClass="tc-tab-selected"
|
||||
selectedAria="aria-selected"
|
||||
tooltip={{!!tooltip}}
|
||||
role="tab"
|
||||
data-tab-title=<<currentTab>>
|
||||
>
|
||||
<$tiddler tiddler=<<save-currentTiddler>>>
|
||||
<$set name="tv-wikilinks" value="no">
|
||||
<$transclude tiddler=<<__buttonTemplate__>> mode="inline">
|
||||
<$transclude tiddler=<<currentTab>> field="caption">
|
||||
<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>
|
||||
</$transclude>
|
||||
</$transclude>
|
||||
</$set>
|
||||
</$tiddler>
|
||||
<<__actions__>>
|
||||
</$button>
|
||||
\end
|
||||
|
||||
\define tabs-tab()
|
||||
\whitespace trim
|
||||
<$set name="save-currentTiddler" value=<<currentTiddler>>>
|
||||
<$tiddler tiddler=<<currentTab>>>
|
||||
<<tabs-button>>
|
||||
</$tiddler>
|
||||
</$set>
|
||||
\end
|
||||
|
||||
\define tabs-tab-list()
|
||||
\whitespace trim
|
||||
<$list filter=<<__tabsList__>> variable="currentTab" storyview="pop">
|
||||
<<tabs-tab>>
|
||||
</$list>
|
||||
\end
|
||||
|
||||
\define tabs-tab-body()
|
||||
\whitespace trim
|
||||
<$list filter=<<__tabsList__>> variable="currentTab">
|
||||
<$reveal type="match" state=<<tabsState>> text=<<currentTab>> default=<<__default__>> retain=<<__retain__>> tag="div">
|
||||
<$transclude tiddler=<<__template__>> mode="block">
|
||||
<$transclude tiddler=<<currentTab>> mode="block"/>
|
||||
</$transclude>
|
||||
</$reveal>
|
||||
</$list>
|
||||
\end
|
||||
|
||||
\define tabs(tabsList,default,state:"$:/state/tab",class,template,buttonTemplate,retain,actions,explicitState)
|
||||
\whitespace trim
|
||||
<$qualify title=<<__state__>> name="qualifiedState">
|
||||
<$let tabsState={{{ [<__explicitState__>minlength[1]] ~[<qualifiedState>] }}}>
|
||||
<div class={{{ [[tc-tab-set]addsuffix[ ]addsuffix<__class__>] }}} role="tablist">
|
||||
<div class={{{ [[tc-tab-buttons]addsuffix[ ]addsuffix<__class__>] }}}>
|
||||
<<tabs-tab-list>>
|
||||
</div>
|
||||
<div class={{{ [[tc-tab-divider]addsuffix[ ]addsuffix<__class__>] }}}/>
|
||||
<div class={{{ [[tc-tab-content]addsuffix[ ]addsuffix<__class__>] }}} role="tabpanel">
|
||||
<<tabs-tab-body>>
|
||||
</div>
|
||||
</div>
|
||||
</$let>
|
||||
</$qualify>
|
||||
\end
|
||||
5
editions/test/tiddlers/test-tabs-horizontal-all.tid
Normal file
5
editions/test/tiddlers/test-tabs-horizontal-all.tid
Normal file
@@ -0,0 +1,5 @@
|
||||
modified: 20260413092032887
|
||||
title: test-tabs-horizontal-all
|
||||
|
||||
\import [[tabs-macro-definition]]
|
||||
<<tabs "TabOne TabTwo TabThree TabFour" "TabTwo" "$:/state/test-tab-01" template:"body-template" buttonTemplate:"button-template" explicitState:"$:/state/explicit">>
|
||||
5
editions/test/tiddlers/test-tabs-horizontal.tid
Normal file
5
editions/test/tiddlers/test-tabs-horizontal.tid
Normal file
@@ -0,0 +1,5 @@
|
||||
modified: 20260413092032887
|
||||
title: test-tabs-horizontal
|
||||
|
||||
\import [[tabs-macro-definition]]
|
||||
<<tabs "TabOne TabTwo TabThree TabFour" "TabTwo" "$:/state/test-tab-01">>
|
||||
5
editions/test/tiddlers/test-tabs-vertical.tid
Normal file
5
editions/test/tiddlers/test-tabs-vertical.tid
Normal file
@@ -0,0 +1,5 @@
|
||||
modified: 20260413092032887
|
||||
title: test-tabs-vertical
|
||||
|
||||
\import [[tabs-macro-definition]]
|
||||
<<tabs "TabOne TabTwo TabThree TabFour" "TabTwo" "$:/state/test-tab-02" "tc-vertical">>
|
||||
@@ -0,0 +1,13 @@
|
||||
title: Parse/BackCompat/MacrocallColonNamed
|
||||
description: Macrocall named-parameter syntax using colon continues to work
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define x(d) got=$d$
|
||||
<<x d:"hi">>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=hi</p>
|
||||
@@ -0,0 +1,13 @@
|
||||
title: Parse/BackCompat/MacrocallColonNonStrict
|
||||
description: Colon-separator requires a strict identifier name; otherwise value is treated as positional (fix #9788)
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define x(d) got=$d$
|
||||
<<x $:/a:"v">>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=<a class="tc-tiddlylink tc-tiddlylink-missing" href="#%24%3A%2Fa">$:/a</a>:</p>
|
||||
@@ -0,0 +1,13 @@
|
||||
title: Parse/BackCompat/MacrocallEqualsNoValue
|
||||
description: Macrocall named parameter with =-separator but no value fails to parse the macro call
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define x(d) got=$d$
|
||||
<<x d=>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p><<x d="true">></x></p>
|
||||
@@ -0,0 +1,13 @@
|
||||
title: Parse/BackCompat/MacrocallNamedEquals
|
||||
description: Macrocall attribute with =-separator (restored compact call syntax, v5.3.9+)
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define x(d) got=$d$
|
||||
<<x d="hello">>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=hello</p>
|
||||
@@ -0,0 +1,13 @@
|
||||
title: Parse/BackCompat/MacrocallFilteredValue
|
||||
description: Macrocall attribute value can be a filtered value {{{...}}}
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define x(d) got=$d$
|
||||
<<x d={{{[[hi]]}}}>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=hi</p>
|
||||
@@ -0,0 +1,17 @@
|
||||
title: Parse/BackCompat/MacrocallIndirectValue
|
||||
description: Macrocall attribute value can be an indirect value {{tid!!field}}
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define x(d) got=$d$
|
||||
<<x d={{Other!!foo}}>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=FROM-OTHER</p>
|
||||
+
|
||||
title: Other
|
||||
foo: FROM-OTHER
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
title: Parse/BackCompat/MacrocallMvvValue
|
||||
description: Macrocall attribute value can be an MVV reference ((v))
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define d() DEFD
|
||||
\define x(d) got=$d$
|
||||
<<x d=((d))>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=DEFD</p>
|
||||
@@ -0,0 +1,14 @@
|
||||
title: Parse/BackCompat/MacrocallNestedMacroValue
|
||||
description: Macrocall attribute value can be a nested macro invocation
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define d() DEFD
|
||||
\define x(d) got=$d$
|
||||
<<x d=<<d>>>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=DEFD</p>
|
||||
@@ -0,0 +1,13 @@
|
||||
title: Parse/BackCompat/MacrocallSubstitutedValue
|
||||
description: Macrocall attribute value can be a substituted value `...`
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define x(d) got=$d$
|
||||
<<x d=`hi`>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=hi</p>
|
||||
@@ -0,0 +1,13 @@
|
||||
title: Parse/BackCompat/MacrocallPositionalGt
|
||||
description: Bare > (not followed by >) is permitted in unquoted macrocall positional params
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define x(d) got=$d$
|
||||
<<x foo>val>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=foo>val</p>
|
||||
@@ -0,0 +1,17 @@
|
||||
title: Parse/BackCompat/MalformedMultiLineTerminator
|
||||
description: When << value looks like a macro invocation but fails to parse, the enclosing widget tag must fail cleanly so the remainder of the document is not silently reinterpreted (the v5.4 strict parser previously collapsed to attribute="true" and swallowed subsequent lines as stray attributes)
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define d() DEFD
|
||||
\define x(d) got=$d$
|
||||
<$macrocall $name="x" d=<<d> />
|
||||
<$macrocall $name="x" d=<<d> />
|
||||
>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p><$macrocall $name="x" d=<<d> />
|
||||
<$macrocall $name="x" d=DEFD</d></p>
|
||||
@@ -0,0 +1,14 @@
|
||||
title: Parse/BackCompat/QuotedGtInNestedMacro
|
||||
description: Nested macro invocation in widget attribute can contain > in quoted inner attribute values
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define d() DEFD
|
||||
\define x(d) got=$d$
|
||||
<$macrocall $name="x" d=<<d b="x>y">> />
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=DEFD</p>
|
||||
@@ -0,0 +1,14 @@
|
||||
title: Parse/BackCompat/MalformedNoTerminator
|
||||
description: Widget attribute value starting with << but with no >> ahead falls through to "true" (matches v5.3.8)
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define d() DEFD
|
||||
\define x(d) got=$d$
|
||||
<$macrocall $name="x" d=<<d> />
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=true</p>
|
||||
@@ -0,0 +1,14 @@
|
||||
title: Parse/BackCompat/ValidNestedMacro
|
||||
description: Widget attribute value with well-formed nested macro invocation
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define d() DEFD
|
||||
\define x(d) got=$d$
|
||||
<$macrocall $name="x" d=<<d>> />
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=DEFD</p>
|
||||
@@ -0,0 +1,13 @@
|
||||
title: Parse/BackCompat/WidgetAttrEqualsNoValue
|
||||
description: Widget attribute with trailing equals and no value falls through to "true"
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define x(d) got=$d$
|
||||
<$macrocall $name="x" d= />
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=true</p>
|
||||
@@ -0,0 +1,13 @@
|
||||
title: Parse/BackCompat/WidgetAttrMalformedMvv
|
||||
description: Widget attribute value with unclosed ((v) falls through to a string literal
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define x(d) got=$d$
|
||||
<$macrocall $name="x" d=((d) />
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=((d)</p>
|
||||
@@ -0,0 +1,14 @@
|
||||
title: Parse/BackCompat/WidgetAttrMvvValue
|
||||
description: Widget attribute value can be an MVV reference ((v))
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define d() DEFD
|
||||
\define x(d) got=$d$
|
||||
<$macrocall $name="x" d=((d)) />
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=DEFD</p>
|
||||
@@ -0,0 +1,13 @@
|
||||
title: Parse/BackCompat/WidgetAttrSubstitutedValue
|
||||
description: Widget attribute value can be a substituted value `...`
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define x(d) got=$d$
|
||||
<$macrocall $name="x" d=`hi` />
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>got=hi</p>
|
||||
179
editions/test/tiddlers/tests/test-filesystem-dynamic-store.js
Normal file
179
editions/test/tiddlers/tests/test-filesystem-dynamic-store.js
Normal file
@@ -0,0 +1,179 @@
|
||||
/*\
|
||||
title: test-filesystem-dynamic-store.js
|
||||
type: application/javascript
|
||||
tags: [[$:/tags/test-spec]]
|
||||
|
||||
Tests for the filesystem syncadaptor dynamic store feature: save routing
|
||||
driven by saveFilter, and chokidar-based watching of out-of-band edits.
|
||||
|
||||
\*/
|
||||
"use strict";
|
||||
|
||||
if($tw.node) {
|
||||
|
||||
var fs = require("fs"),
|
||||
path = require("path"),
|
||||
os = require("os");
|
||||
|
||||
// Load the filesystem adaptor source as if it were a TW module, so that
|
||||
// $tw is provided without having to include the plugin in the edition
|
||||
// (which would pull in the server-side syncer and keep the test runner alive).
|
||||
var adaptorPath = path.resolve($tw.boot.bootPath,"..","plugins","tiddlywiki","filesystem","filesystemadaptor.js"),
|
||||
adaptorTitle = "$:/plugins/tiddlywiki/filesystem/filesystemadaptor.js";
|
||||
if(!$tw.modules.titles[adaptorTitle]) {
|
||||
$tw.modules.titles[adaptorTitle] = {
|
||||
moduleType: "syncadaptor",
|
||||
definition: fs.readFileSync(adaptorPath,"utf8")
|
||||
};
|
||||
$tw.wiki.addTiddler({
|
||||
title: adaptorTitle,
|
||||
type: "application/javascript",
|
||||
"module-type": "syncadaptor",
|
||||
text: ""
|
||||
});
|
||||
}
|
||||
var FileSystemAdaptor = $tw.modules.execute(adaptorTitle).adaptorClass;
|
||||
|
||||
function makeTempDir(prefix) {
|
||||
return fs.mkdtempSync(path.join(os.tmpdir(),prefix));
|
||||
}
|
||||
|
||||
function removeDirRecursive(dir) {
|
||||
if(fs.existsSync(dir)) {
|
||||
fs.rmSync(dir,{recursive: true, force: true});
|
||||
}
|
||||
}
|
||||
|
||||
describe("filesystem dynamic store", function() {
|
||||
|
||||
var tmpRoot, wikiTiddlers, storeDir, origDynamicStores, origFiles, originalBootPath;
|
||||
var adaptor, wiki;
|
||||
|
||||
beforeEach(function() {
|
||||
tmpRoot = makeTempDir("tw-dyn-");
|
||||
wikiTiddlers = path.join(tmpRoot,"tiddlers");
|
||||
storeDir = path.join(tmpRoot,"content");
|
||||
fs.mkdirSync(wikiTiddlers);
|
||||
fs.mkdirSync(storeDir);
|
||||
|
||||
origDynamicStores = $tw.boot.dynamicStores;
|
||||
origFiles = $tw.boot.files;
|
||||
originalBootPath = $tw.boot.wikiTiddlersPath;
|
||||
|
||||
$tw.boot.dynamicStores = [{
|
||||
id: storeDir,
|
||||
directory: storeDir,
|
||||
saveFilter: "[type[text/x-markdown]]",
|
||||
watch: true,
|
||||
debounce: 40,
|
||||
filesRegExp: ".*\\.tid$",
|
||||
searchSubdirectories: false,
|
||||
isTiddlerFile: true,
|
||||
fields: {}
|
||||
}];
|
||||
$tw.boot.files = Object.create(null);
|
||||
$tw.boot.wikiTiddlersPath = wikiTiddlers;
|
||||
|
||||
wiki = new $tw.Wiki();
|
||||
adaptor = new FileSystemAdaptor({wiki: wiki, boot: $tw.boot});
|
||||
});
|
||||
|
||||
afterEach(function(done) {
|
||||
adaptor.close().then(function() {
|
||||
$tw.boot.dynamicStores = origDynamicStores;
|
||||
$tw.boot.files = origFiles;
|
||||
$tw.boot.wikiTiddlersPath = originalBootPath;
|
||||
removeDirRecursive(tmpRoot);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it("routes saves for matching tiddlers into the dynamic store directory", function(done) {
|
||||
wiki.addTiddler(new $tw.Tiddler({title: "note1", type: "text/x-markdown", text: "hello"}));
|
||||
var tiddler = wiki.getTiddler("note1");
|
||||
adaptor.getTiddlerFileInfo(tiddler,function(err,fileInfo) {
|
||||
expect(err).toBeFalsy();
|
||||
expect(fileInfo.filepath.indexOf(storeDir)).toBe(0);
|
||||
expect(fileInfo.dynamicStoreId).toBe(storeDir);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it("routes saves for non-matching tiddlers into the default wiki tiddlers path", function(done) {
|
||||
wiki.addTiddler(new $tw.Tiddler({title: "note2", type: "text/vnd.tiddlywiki", text: "plain"}));
|
||||
var tiddler = wiki.getTiddler("note2");
|
||||
adaptor.getTiddlerFileInfo(tiddler,function(err,fileInfo) {
|
||||
expect(err).toBeFalsy();
|
||||
expect(fileInfo.filepath.indexOf(wikiTiddlers)).toBe(0);
|
||||
expect(fileInfo.dynamicStoreId).toBeFalsy();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps saving a tiddler into the store it originally came from", function(done) {
|
||||
// Simulate a tiddler that was loaded at boot from the dynamic store
|
||||
$tw.boot.files["frozen"] = {
|
||||
filepath: path.join(storeDir,"frozen.tid"),
|
||||
type: "application/x-tiddler",
|
||||
hasMetaFile: false,
|
||||
isEditableFile: true,
|
||||
dynamicStoreId: storeDir
|
||||
};
|
||||
// Its current type no longer matches the saveFilter — store id must still win
|
||||
wiki.addTiddler(new $tw.Tiddler({title: "frozen", type: "text/vnd.tiddlywiki", text: "still here"}));
|
||||
adaptor.getTiddlerFileInfo(wiki.getTiddler("frozen"),function(err,fileInfo) {
|
||||
expect(err).toBeFalsy();
|
||||
expect(fileInfo.filepath.indexOf(storeDir)).toBe(0);
|
||||
expect(fileInfo.dynamicStoreId).toBe(storeDir);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
// Note: the chokidar watcher's only job is to call processFileEvent in
|
||||
// response to fs events. We invoke processFileEvent directly here so the
|
||||
// tests don't depend on real fs notifications being delivered (some CI
|
||||
// sandboxes do not propagate inotify events to chokidar).
|
||||
|
||||
it("processes external additions, changes and deletions", function(done) {
|
||||
var store = $tw.boot.dynamicStores[0];
|
||||
var filepath = path.join(storeDir,"external.tid");
|
||||
fs.writeFileSync(filepath,"title: external\ntype: text/x-markdown\n\nInitial\n");
|
||||
adaptor.processFileEvent(store,filepath,"change");
|
||||
adaptor.getUpdatedTiddlers({},function(err,updates) {
|
||||
expect(err).toBeFalsy();
|
||||
expect(updates.modifications).toContain("external");
|
||||
adaptor.loadTiddler("external",function(err,fields) {
|
||||
expect(err).toBeFalsy();
|
||||
expect(fields).toBeTruthy();
|
||||
expect(fields.title).toBe("external");
|
||||
expect(fields.text).toContain("Initial");
|
||||
// Edit
|
||||
fs.writeFileSync(filepath,"title: external\ntype: text/x-markdown\n\nChanged\n");
|
||||
adaptor.processFileEvent(store,filepath,"change");
|
||||
adaptor.getUpdatedTiddlers({},function(err,updates) {
|
||||
expect(updates.modifications).toContain("external");
|
||||
// Delete
|
||||
fs.unlinkSync(filepath);
|
||||
adaptor.processFileEvent(store,filepath,"unlink");
|
||||
adaptor.getUpdatedTiddlers({},function(err,updates) {
|
||||
expect(updates.deletions).toContain("external");
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("suppresses echoes when the file on disk matches the current wiki tiddler", function(done) {
|
||||
var store = $tw.boot.dynamicStores[0];
|
||||
wiki.addTiddler(new $tw.Tiddler({title: "echo", type: "text/x-markdown", text: "same\n"}));
|
||||
var filepath = path.join(storeDir,"echo.tid");
|
||||
fs.writeFileSync(filepath,"title: echo\ntype: text/x-markdown\n\nsame\n");
|
||||
adaptor.processFileEvent(store,filepath,"change");
|
||||
adaptor.getUpdatedTiddlers({},function(err,updates) {
|
||||
expect(updates.modifications).not.toContain("echo");
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1062,7 +1062,7 @@ describe("Filter tests", function() {
|
||||
});
|
||||
|
||||
it("should handle the deserializers operator", function() {
|
||||
var expectedDeserializers = ["application/javascript","application/json","application/x-tiddler","application/x-tiddler-html-div","application/x-tiddlers","text/css","text/html","text/plain"];
|
||||
var expectedDeserializers = ["application/javascript","application/json","application/x-tiddler","application/x-tiddler-html-div","application/x-tiddlers","text/css","text/html","text/markdown","text/plain","text/x-markdown"];
|
||||
if($tw.browser) {
|
||||
expectedDeserializers.unshift("(DOM)");
|
||||
}
|
||||
|
||||
301
editions/test/tiddlers/tests/test-markdown-frontmatter.js
Normal file
301
editions/test/tiddlers/tests/test-markdown-frontmatter.js
Normal file
@@ -0,0 +1,301 @@
|
||||
/*\
|
||||
title: test-markdown-frontmatter.js
|
||||
type: application/javascript
|
||||
tags: [[$:/tags/test-spec]]
|
||||
|
||||
Tests for the markdown plugin's YAML frontmatter parser, deserializer,
|
||||
and serializer.
|
||||
|
||||
\*/
|
||||
|
||||
/* eslint-env node, browser, jasmine */
|
||||
/* eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
|
||||
"use strict";
|
||||
|
||||
describe("markdown YAML frontmatter", function() {
|
||||
|
||||
var yaml = require("$:/plugins/tiddlywiki/markdown/yaml.js");
|
||||
var deserializer = require("$:/plugins/tiddlywiki/markdown/frontmatter-deserializer.js");
|
||||
var serializer = require("$:/plugins/tiddlywiki/markdown/frontmatter-serializer.js");
|
||||
|
||||
// --- YAML parser ---
|
||||
|
||||
describe("yaml.load scalars", function() {
|
||||
it("parses null forms", function() {
|
||||
expect(yaml.load("null")).toBe(null);
|
||||
expect(yaml.load("~")).toBe(null);
|
||||
expect(yaml.load("")).toBe(null);
|
||||
});
|
||||
it("parses booleans", function() {
|
||||
expect(yaml.load("true")).toBe(true);
|
||||
expect(yaml.load("True")).toBe(true);
|
||||
expect(yaml.load("false")).toBe(false);
|
||||
});
|
||||
it("parses numbers", function() {
|
||||
expect(yaml.load("42")).toBe(42);
|
||||
expect(yaml.load("-7")).toBe(-7);
|
||||
expect(yaml.load("3.14")).toBe(3.14);
|
||||
expect(yaml.load("1e10")).toBe(1e10);
|
||||
expect(yaml.load("0xFF")).toBe(255);
|
||||
expect(yaml.load("0o17")).toBe(15);
|
||||
});
|
||||
it("parses special floats", function() {
|
||||
expect(yaml.load(".inf")).toBe(Infinity);
|
||||
expect(yaml.load("-.inf")).toBe(-Infinity);
|
||||
});
|
||||
it("parses quoted strings", function() {
|
||||
expect(yaml.load('"hello world"')).toBe("hello world");
|
||||
expect(yaml.load("'hello world'")).toBe("hello world");
|
||||
expect(yaml.load('"line1\\nline2"')).toBe("line1\nline2");
|
||||
});
|
||||
it("parses plain strings", function() {
|
||||
expect(yaml.load("hello")).toBe("hello");
|
||||
});
|
||||
it("rejects non-strings", function() {
|
||||
expect(function() { yaml.load(123); }).toThrowError(yaml.YAMLException);
|
||||
});
|
||||
});
|
||||
|
||||
describe("yaml.load flow collections", function() {
|
||||
it("parses flow sequences", function() {
|
||||
expect(yaml.load("[a, b, c]")).toEqual(["a","b","c"]);
|
||||
expect(yaml.load("[1, 2, 3]")).toEqual([1,2,3]);
|
||||
expect(yaml.load('[1, "two", true, null]')).toEqual([1,"two",true,null]);
|
||||
expect(yaml.load("[]")).toEqual([]);
|
||||
expect(yaml.load('["multi word", simple]')).toEqual(["multi word","simple"]);
|
||||
});
|
||||
it("parses flow mappings", function() {
|
||||
expect(yaml.load("{a: 1, b: 2}")).toEqual({a:1,b:2});
|
||||
expect(yaml.load("{}")).toEqual({});
|
||||
});
|
||||
});
|
||||
|
||||
describe("yaml.load block collections", function() {
|
||||
it("parses simple block mappings", function() {
|
||||
expect(yaml.load("title: Hello\ntags: foo bar\nrating: 6")).toEqual({
|
||||
title: "Hello",
|
||||
tags: "foo bar",
|
||||
rating: 6
|
||||
});
|
||||
});
|
||||
it("parses block mapping with flow array value", function() {
|
||||
expect(yaml.load("title: Test\ntags: [concept, synthesis, multi word tag]")).toEqual({
|
||||
title: "Test",
|
||||
tags: ["concept","synthesis","multi word tag"]
|
||||
});
|
||||
});
|
||||
it("parses block mapping with quoted value", function() {
|
||||
expect(yaml.load('title: "A: Subtitle"')).toEqual({title: "A: Subtitle"});
|
||||
});
|
||||
it("parses block mapping with null value", function() {
|
||||
expect(yaml.load("title: Test\ndescription:")).toEqual({
|
||||
title: "Test",
|
||||
description: null
|
||||
});
|
||||
});
|
||||
it("parses block sequences", function() {
|
||||
expect(yaml.load("- alpha\n- beta\n- gamma")).toEqual(["alpha","beta","gamma"]);
|
||||
expect(yaml.load("- 1\n- two\n- true")).toEqual([1,"two",true]);
|
||||
});
|
||||
it("parses nested block mappings", function() {
|
||||
expect(yaml.load("outer:\n inner: value\n count: 3")).toEqual({
|
||||
outer: {inner: "value", count: 3}
|
||||
});
|
||||
});
|
||||
it("parses block mapping with block sequence value", function() {
|
||||
expect(yaml.load("title: Test\ntags:\n - concept\n - synthesis")).toEqual({
|
||||
title: "Test",
|
||||
tags: ["concept","synthesis"]
|
||||
});
|
||||
});
|
||||
it("ignores comments and blank lines", function() {
|
||||
expect(yaml.load("# comment\ntitle: Test\n# more\nrating: 5")).toEqual({
|
||||
title: "Test",
|
||||
rating: 5
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("yaml.dump", function() {
|
||||
it("dumps simple mappings", function() {
|
||||
expect(yaml.dump({title: "Hello", rating: 6}).trim()).toBe("title: Hello\nrating: 6");
|
||||
});
|
||||
it("dumps arrays", function() {
|
||||
expect(yaml.dump({tags: ["a","b"]}).trim()).toBe("tags:\n - a\n - b");
|
||||
});
|
||||
it("dumps null and booleans", function() {
|
||||
expect(yaml.dump({x: null}).trim()).toBe("x: null");
|
||||
expect(yaml.dump({x: true, y: false}).trim()).toBe("x: true\ny: false");
|
||||
});
|
||||
it("dumps empty containers", function() {
|
||||
expect(yaml.dump({}).trim()).toBe("{}");
|
||||
expect(yaml.dump({x: []}).trim()).toBe("x: []");
|
||||
});
|
||||
it("quotes string values that look like numbers", function() {
|
||||
expect(yaml.dump({rating: "9"}).trim()).toBe('rating: "9"');
|
||||
});
|
||||
});
|
||||
|
||||
// --- Deserializer ---
|
||||
|
||||
describe("frontmatter deserializer", function() {
|
||||
var ds = deserializer["text/x-markdown"];
|
||||
|
||||
it("extracts simple frontmatter into fields", function() {
|
||||
var result = ds("---\ntitle: Foo\ntags: [a, b]\n---\n\nBody text.",{});
|
||||
expect(result.length).toBe(1);
|
||||
expect(result[0].title).toBe("Foo");
|
||||
expect(result[0].tags).toBe("a b");
|
||||
expect(result[0].text).toBe("Body text.");
|
||||
expect(result[0].type).toBe("text/x-markdown");
|
||||
});
|
||||
it("converts YAML arrays for list fields to TW bracketed lists", function() {
|
||||
var result = ds("---\ntags: [concept, multi word tag, simple]\n---\n\nbody",{});
|
||||
expect(result[0].tags).toBe("concept [[multi word tag]] simple");
|
||||
});
|
||||
it("falls back to plain body when no frontmatter present", function() {
|
||||
var result = ds("Just a body, no frontmatter.",{});
|
||||
expect(result[0].text).toBe("Just a body, no frontmatter.");
|
||||
expect(result[0].title).toBeUndefined();
|
||||
});
|
||||
it("falls back to plain body when frontmatter is malformed", function() {
|
||||
var result = ds("---\nnot: [valid yaml: at all\n---\n\nbody",{});
|
||||
// Malformed YAML still parses something; we just ensure body is set
|
||||
expect(result[0].text).toBeDefined();
|
||||
});
|
||||
it("parses ISO-8601 created and modified into TW native format", function() {
|
||||
var result = ds("---\ntitle: T\ncreated: 2025-01-02T03:04:05.006Z\nmodified: 2026-02-03T04:05:06Z\n---\n\nb",{});
|
||||
expect(result[0].created).toBe("20250102030405006");
|
||||
expect(result[0].modified).toBe("20260203040506000");
|
||||
});
|
||||
it("accepts a bare YYYY-MM-DD date for created/modified", function() {
|
||||
var result = ds("---\ntitle: T\ncreated: 2025-03-15\n---\n\nb",{});
|
||||
expect(result[0].created).toBe("20250315000000000");
|
||||
});
|
||||
it("passes through TW native timestamps for created/modified", function() {
|
||||
var result = ds("---\ntitle: T\ncreated: \"20250101000000000\"\nmodified: \"20260101000000\"\n---\n\nb",{});
|
||||
expect(result[0].created).toBe("20250101000000000");
|
||||
expect(result[0].modified).toBe("20260101000000000");
|
||||
});
|
||||
it("drops unparseable created/modified values", function() {
|
||||
var result = ds("---\ntitle: T\ncreated: not-a-date\n---\n\nb",{});
|
||||
expect(result[0].created).toBeUndefined();
|
||||
});
|
||||
it("merges existing tags with frontmatter tags", function() {
|
||||
var result = ds("---\ntags: [b, c]\n---\n\nbody",{tags: "a"});
|
||||
// Order: existing first, then new uniques
|
||||
expect(result[0].tags).toBe("a b c");
|
||||
});
|
||||
it("emits non-string non-array values as JSON", function() {
|
||||
var result = ds("---\ntitle: T\nmeta: {nested: deep}\n---\n\nb",{});
|
||||
expect(result[0].meta).toBe('{"nested":"deep"}');
|
||||
});
|
||||
it("handles CRLF line endings around frontmatter", function() {
|
||||
var result = ds("---\r\ntitle: T\r\n---\r\n\r\nbody",{});
|
||||
expect(result[0].title).toBe("T");
|
||||
expect(result[0].text).toBe("body");
|
||||
});
|
||||
});
|
||||
|
||||
// --- Serializer ---
|
||||
|
||||
describe("frontmatter serializer", function() {
|
||||
var ser = serializer["text/x-markdown"];
|
||||
|
||||
it("emits frontmatter and body", function() {
|
||||
var t = new $tw.Tiddler({title: "Foo", text: "body", tags: "a b"});
|
||||
var out = ser(t);
|
||||
expect(out).toContain("---\n");
|
||||
expect(out).toContain("title: Foo");
|
||||
expect(out).toContain("tags:\n - a\n - b");
|
||||
expect(out.split("\n---\n\n")[1]).toBe("body");
|
||||
});
|
||||
it("emits list fields as YAML arrays preserving multi-word tags", function() {
|
||||
var t = new $tw.Tiddler({title: "X", tags: "concept [[multi word tag]] simple", text: "b"});
|
||||
var out = ser(t);
|
||||
expect(out).toContain("- concept");
|
||||
expect(out).toContain("- multi word tag");
|
||||
expect(out).toContain("- simple");
|
||||
});
|
||||
it("skips text, bag, revision", function() {
|
||||
var t = new $tw.Tiddler({
|
||||
title: "X",
|
||||
text: "body",
|
||||
bag: "default",
|
||||
revision: "1"
|
||||
});
|
||||
var out = ser(t);
|
||||
expect(out).not.toContain("bag:");
|
||||
expect(out).not.toContain("revision:");
|
||||
expect(out).not.toContain("text:");
|
||||
});
|
||||
it("emits created and modified as ISO-8601 strings", function() {
|
||||
var t = new $tw.Tiddler({
|
||||
title: "X",
|
||||
text: "b",
|
||||
created: "20250102030405006",
|
||||
modified: "20260203040506000"
|
||||
});
|
||||
var out = ser(t);
|
||||
expect(out).toContain('created: "2025-01-02T03:04:05.006Z"');
|
||||
expect(out).toContain('modified: "2026-02-03T04:05:06.000Z"');
|
||||
});
|
||||
it("drops unparseable created/modified values", function() {
|
||||
var t = new $tw.Tiddler({title: "X", text: "b", created: "garbage"});
|
||||
var out = ser(t);
|
||||
expect(out).not.toContain("created:");
|
||||
});
|
||||
it("skips type when it equals text/x-markdown", function() {
|
||||
var t = new $tw.Tiddler({title: "X", type: "text/x-markdown", text: "b"});
|
||||
expect(ser(t)).not.toContain("type:");
|
||||
});
|
||||
it("emits type when it differs from text/x-markdown", function() {
|
||||
var t = new $tw.Tiddler({title: "X", type: "text/html", text: "b"});
|
||||
expect(ser(t)).toContain("type: text/html");
|
||||
});
|
||||
it("emits no frontmatter when only skipped fields are present", function() {
|
||||
var t = new $tw.Tiddler({text: "body only"});
|
||||
expect(ser(t)).toBe("body only");
|
||||
});
|
||||
it("returns empty string for null tiddler", function() {
|
||||
expect(ser(null)).toBe("");
|
||||
});
|
||||
it("title appears first in output", function() {
|
||||
var t = new $tw.Tiddler({title: "Z", rating: "9", tags: "a", text: "b"});
|
||||
var out = ser(t);
|
||||
var lines = out.split("\n");
|
||||
// First line is "---", second should be "title: Z"
|
||||
expect(lines[0]).toBe("---");
|
||||
expect(lines[1]).toBe("title: Z");
|
||||
});
|
||||
});
|
||||
|
||||
// --- Round-trip ---
|
||||
|
||||
describe("frontmatter round-trip", function() {
|
||||
var ds = deserializer["text/x-markdown"];
|
||||
var ser = serializer["text/x-markdown"];
|
||||
|
||||
it("preserves title, tags, and body across deserialize → serialize", function() {
|
||||
var input = "---\ntitle: My Tiddler\ntags: [concept, synthesis]\nrating: \"7\"\n---\n\nThis is the body.";
|
||||
var fields = ds(input,{})[0];
|
||||
var t = new $tw.Tiddler(fields);
|
||||
var out = ser(t);
|
||||
var reparsed = ds(out,{})[0];
|
||||
expect(reparsed.title).toBe("My Tiddler");
|
||||
expect(reparsed.tags).toBe("concept synthesis");
|
||||
expect(reparsed.rating).toBe("7");
|
||||
expect(reparsed.text).toBe("This is the body.");
|
||||
});
|
||||
it("preserves created and modified across deserialize → serialize", function() {
|
||||
var input = "---\ntitle: T\ncreated: 2025-01-02T03:04:05.006Z\nmodified: 2026-02-03T04:05:06.007Z\n---\n\nbody";
|
||||
var fields = ds(input,{})[0];
|
||||
var t = new $tw.Tiddler(fields);
|
||||
var out = ser(t);
|
||||
var reparsed = ds(out,{})[0];
|
||||
expect(reparsed.created).toBe("20250102030405006");
|
||||
expect(reparsed.modified).toBe("20260203040506007");
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -468,5 +468,9 @@ describe("WikiText parser tests", function() {
|
||||
|
||||
expect(parse(wikitext)).toEqual(expectedParseTree);
|
||||
});
|
||||
});
|
||||
|
||||
it("should reject unquoted macro parameter values that start with <<", function() {
|
||||
var attribute = $tw.utils.parseMacroParameterAsAttribute("d=<<d> />",0);
|
||||
expect(attribute).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
"plugins": [
|
||||
"tiddlywiki/jasmine",
|
||||
"tiddlywiki/wikitext-serialize",
|
||||
"tiddlywiki/geospatial"
|
||||
"tiddlywiki/geospatial",
|
||||
"tiddlywiki/markdown"
|
||||
],
|
||||
"themes": [
|
||||
"tiddlywiki/vanilla",
|
||||
|
||||
@@ -9,6 +9,7 @@ title: TiddlyWiki Archive
|
||||
5.1.20 5.1.21 5.1.22 5.1.23
|
||||
5.2.0 5.2.1 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7
|
||||
5.3.0 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.3.7 5.3.8
|
||||
5.4.0
|
||||
\end
|
||||
|
||||
Older versions of TiddlyWiki are available in the [[archive|https://github.com/TiddlyWiki/tiddlywiki.com-gh-pages/tree/master/archive]]:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
created: 20130822170200000
|
||||
icon: $:/core/icon
|
||||
list: [[A Gentle Guide to TiddlyWiki]] [[Discover TiddlyWiki]] [[Some of the things you can do with TiddlyWiki]] [[Ten reasons to switch to TiddlyWiki]] Examples [[What happened to the original TiddlyWiki?]]
|
||||
modified: 20250807084952911
|
||||
modified: 20260420192600833
|
||||
tags: Welcome
|
||||
title: HelloThere
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
created: 20150414070451144
|
||||
list: [[HelloThumbnail - Donations]] [[HelloThumbnail - Newsletter]] [[HelloThumbnail - Community Survey 2025]] [[HelloThumbnail - Introduction Video]] [[HelloThumbnail - Grok TiddlyWiki]] [[HelloThumbnail - Latest Version]] [[HelloThumbnail - MultiWikiServer]] [[HelloThumbnail - Twenty Years of TiddlyWiki]] [[HelloThumbnail - TiddlyWiki Privacy]] [[HelloThumbnail - Marketplace]] [[HelloThumbnail - Intertwingled Innovations]] [[HelloThumbnail - TiddlyWikiLinks]]
|
||||
list: [[HelloThumbnail - Latest Version]] [[HelloThumbnail - Donations]] [[HelloThumbnail - Newsletter]] [[HelloThumbnail - Community Survey 2025]] [[HelloThumbnail - Introduction Video]] [[HelloThumbnail - Grok TiddlyWiki]] [[HelloThumbnail - MultiWikiServer]] [[HelloThumbnail - Twenty Years of TiddlyWiki]] [[HelloThumbnail - TiddlyWiki Privacy]] [[HelloThumbnail - Marketplace]] [[HelloThumbnail - Intertwingled Innovations]] [[HelloThumbnail - TiddlyWikiLinks]]
|
||||
modified: 20150414070948246
|
||||
title: HelloThumbnail
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 19 KiB |
@@ -56,6 +56,11 @@ Directory specifications in the `directories` array may take the following forms
|
||||
** ''isEditableFile'' - <<.from-version "5.1.23">> (optional) if `true`, changes to the tiddler be saved back to the original file. The tiddler will be saved back to the original filepath as long as it does not generate a result from the $:/config/FileSystemPath filters, which will override the final filepath generated if a result is returned from a filter.
|
||||
** ''searchSubdirectories'' - <<.from-version "5.1.23">> (optional) if `true`, all subdirectories of the //path// are searched recursively for files that match the (optional) //filesRegExp//. If no //filesRegExp// is provided, all files in all subdirectories of the //path// are loaded. Tiddler titles generated via the //source// attribute //filename// (see above) will only include the filename, not any of the subdirectories of the path. If this results in multiple files with loaded with the same tiddler title, then only the last file loaded under that tiddler title will be in memory. In order to prevent this, you can use the //filepath// attribute instead of //filename//. Alternately, you can include multiple directory objects and customise the title field with a //prefix// or //suffix// alongside the //source// attribute.
|
||||
** ''fields'' - (required) an object containing values that override or customise the fields provided in the tiddler file (see above)
|
||||
** ''dynamicStore'' - <<.from-version "5.5.0">> (optional) an object marking the directory as a //dynamic store// that is both loaded at boot and actively watched on disk. The filesystem syncadaptor uses the watcher to pick up out-of-band changes (e.g. edits made by an external editor) and folds them into the running wiki. The object has the following properties:
|
||||
*** ''saveFilter'' - (optional) a filter evaluated against each tiddler the wiki tries to save. Tiddlers that match are saved back into this directory instead of the default tiddlers folder. The first matching dynamic store wins, so specificity matters when multiple stores are registered.
|
||||
*** ''watch'' - (optional, defaults to `true`) set to `false` to disable the chokidar watcher for this store (tiddlers are still loaded and save-routed, but external changes are not picked up live)
|
||||
*** ''debounce'' - (optional, defaults to `400`) the per-file debounce window in milliseconds. File events that occur within this window of a previous event for the same file are coalesced, which avoids duplicated reloads during atomic-rename saves performed by many editors.
|
||||
*** Changes to a file on disk are diffed against the tiddler currently in the wiki before being reported, so self-writes performed by TiddlyWiki itself do not trigger spurious reload events. JavaScript module tiddlers (tiddlers with `type: application/javascript` and a `module-type` field) are never hot-reloaded, because that would require restarting the TiddlyWiki process.
|
||||
|
||||
Fields can also be overridden for particular files by creating a file with the same name plus the suffix `.meta` -- see TiddlerFiles.
|
||||
|
||||
@@ -135,6 +140,29 @@ From the examples in [[Customising Tiddler File Naming]] we see that the final `
|
||||
|
||||
Then, the `[tag[.txt]then[.txt]]` filter in the $:/config/FileSystemExtensions tiddler forces all these tiddlers to be saved back to disk as *.txt and accompanying *.txt.meta files (overriding the normal tiddler-type to file-type mapping). In this case, allowing the snippets of Tiddlywiki wikitext or markdown-text to be saved back to "text" *.txt files.
|
||||
|
||||
!! Dynamic store for markdown files
|
||||
|
||||
<<.from-version "5.5.0">> This example treats a sibling `content/` folder as a dynamic store: every `.md` file is loaded at boot, every markdown tiddler saved by the wiki is routed back into `content/`, and external edits to those files are picked up automatically by chokidar.
|
||||
|
||||
```
|
||||
{
|
||||
"directories": [
|
||||
{
|
||||
"path": "../content",
|
||||
"filesRegExp": "^.*\\.md$",
|
||||
"isTiddlerFile": true,
|
||||
"searchSubdirectories": true,
|
||||
"dynamicStore": {
|
||||
"saveFilter": "[type[text/x-markdown]]",
|
||||
"watch": true,
|
||||
"debounce": 400
|
||||
},
|
||||
"fields": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
!! Importing and auto-tagging images
|
||||
|
||||
This example imports all the image files in the `files` directory and all its subdirectories as external-image tiddlers, and tags them based on their filepath. Each tiddler is set up with the following fields:
|
||||
|
||||
@@ -2,7 +2,7 @@ change-category: hackability
|
||||
change-type: enhancement
|
||||
created: 20260228212206750
|
||||
description: Allows modular relinking behavior for plugin support
|
||||
github-contributors: flibbles
|
||||
github-contributors: Flibbles
|
||||
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9703
|
||||
modified: 20260228212206750
|
||||
release: 5.4.0
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
title: $:/changenotes/5.4.0/#9782
|
||||
description: Update Greek translation
|
||||
release: 5.4.0
|
||||
tags: $:/tags/ChangeNote
|
||||
change-type: enhancement
|
||||
change-category: translation
|
||||
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9782
|
||||
github-contributors: superuser-does
|
||||
|
||||
* Translated all new text introduced in 5.4.0
|
||||
* Changed tab captions which weren't proper nouns from __T__itle __C__ase to __S__entence __c__ase
|
||||
* Lowercased export dialog options to match that section of the UI, like in the original English version
|
||||
* Other minor changes and corrections
|
||||
@@ -1,10 +1,11 @@
|
||||
caption: 5.4.0
|
||||
created: 20250901000000000
|
||||
modified: 20250901000000000
|
||||
created: 20260420192600833
|
||||
description: Multi Valued Variables, Nested Procedure Calls, Background Actions, New Wikitext Serializer, Bugfixes and much more
|
||||
modified: 20260420192600833
|
||||
released: 20260420192600833
|
||||
tags: ReleaseNotes
|
||||
title: Release 5.4.0
|
||||
type: text/vnd.tiddlywiki
|
||||
description: Under development
|
||||
|
||||
\procedure release-introduction()
|
||||
Release v5.4.0 deliberately and forensically loosens backwards compatibility to clear the path for significant new features and fundamental improvements to be made in the future.
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
title: $:/changenotes/5.5.0/#9806
|
||||
description: Filesystem dynamic stores with live reload via chokidar
|
||||
release: 5.5.0
|
||||
tags: $:/tags/ChangeNote
|
||||
change-type: feature
|
||||
change-category: nodejs
|
||||
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9806
|
||||
github-contributors: Jermolene
|
||||
|
||||
The filesystem syncadaptor can now be configured to treat a folder as a [[dynamic store|tiddlywiki.files Files]]: tiddlers in the folder are loaded at boot, a configurable filter decides which tiddlers are saved back into that folder instead of the default `tiddlers/` directory, and external edits to files in the folder are picked up live by a [[chokidar|https://github.com/paulmillr/chokidar]] watcher.
|
||||
|
||||
Dynamic stores are declared inside a `tiddlywiki.files` specification via the new `dynamicStore` property on a directory entry. For example, the following declaration loads every `.md` file in a sibling `content/` folder, routes any tiddler with `type: text/x-markdown` back to that folder on save, and hot-reloads changes made by an external editor:
|
||||
|
||||
```
|
||||
{
|
||||
"directories": [{
|
||||
"path": "../content",
|
||||
"filesRegExp": "^.*\\.md$",
|
||||
"isTiddlerFile": true,
|
||||
"dynamicStore": {
|
||||
"saveFilter": "[type[text/x-markdown]]",
|
||||
"watch": true,
|
||||
"debounce": 400
|
||||
}
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
* File events are debounced per file (default 400ms, configurable via `debounce`) to cope with editors that save atomically via rename.
|
||||
* Each detected change is diffed against the current in-wiki tiddler before being reported, so self-writes performed by TiddlyWiki itself do not cause reload loops.
|
||||
* Deletions on disk propagate to the wiki via the syncer's standard server-side-deletion path.
|
||||
* JavaScript module tiddlers (those with `type: application/javascript` and a `module-type` field) are never hot-reloaded; reloading them would require restarting the TiddlyWiki process.
|
||||
|
||||
This feature adds [[chokidar|https://github.com/paulmillr/chokidar]] as a new runtime dependency of TiddlyWiki on Node.js.
|
||||
@@ -0,0 +1,13 @@
|
||||
caption: 5.5.0
|
||||
created: 20260420195917090
|
||||
modified: 20260420195917090
|
||||
tags: ReleaseNotes
|
||||
title: Release 5.5.0
|
||||
type: text/vnd.tiddlywiki
|
||||
description: Under development
|
||||
|
||||
\procedure release-introduction()
|
||||
Release v5.5.0 is under development.
|
||||
\end release-introduction
|
||||
|
||||
<<releasenote 5.5.0>>
|
||||
@@ -1,13 +1,13 @@
|
||||
title: Multi-Valued Variables
|
||||
created: 20250307212252946
|
||||
modified: 20250307212252946
|
||||
tags: Concepts Variables
|
||||
title: Multi-Valued Variables
|
||||
|
||||
<<.from-version "5.4.0">> In ordinary usage, [[variables|Variables]] contain a single snippet of text. With the introduction of multi-valued variables. it is now possible to store a list of multiple values in a single variable. When accessed in the usual way, only the first value is returned, but using round brackets instead of angle brackets around the variable name allows access to the complete list of the values. This makes multi-valued variables largely invisible unless you specifically need to use them.
|
||||
|
||||
! Setting Multi-Valued Variables
|
||||
|
||||
Generally, all the methods for setting variables implicitly set multi-valued variables, with the exception of the [[Set Widget|Set Widget]].
|
||||
Generally, all the methods for setting variables implicitly set multi-valued variables, with the exception of the [[Set Widget|SetWidget]].
|
||||
|
||||
!! LetWidget
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ Listing/Preview/TextRaw: Text - roh
|
||||
Listing/Preview/Fields: Felder
|
||||
Listing/Preview/Diff: Diff - Text
|
||||
Listing/Preview/DiffFields: Diff - Felder
|
||||
Listing/ImportOptions/Caption: Import Optionen
|
||||
Listing/ImportOptions/NoMatch: Keine Optionen aktiv für diese Files.
|
||||
Listing/Rename/Tooltip: Tiddler vorm Importieren umbenennen
|
||||
Listing/Rename/Prompt: Umbenennen in:
|
||||
Listing/Rename/ConfirmRename : Tiddler umbenennen
|
||||
@@ -31,4 +33,4 @@ Upgrader/System/Alert: Sie sind dabei einen Tiddler zu importieren, der einen "C
|
||||
Upgrader/ThemeTweaks/Created: Migrieren der "theme tweaks" von: <$text text=<<from>>/>.
|
||||
Upgrader/Tiddler/Disabled: Deaktivierter Tiddler.
|
||||
Upgrader/Tiddler/Selected: Ausgewählter Tiddler.
|
||||
Upgrader/Tiddler/Unselected: Auswahl aufgehoben.
|
||||
Upgrader/Tiddler/Unselected: Auswahl aufgehoben.
|
||||
|
||||
@@ -9,10 +9,10 @@ Advanced/ShadowInfo/NotShadow/Hint: Der Tiddler: <$link to=<<infoTiddler>>><$tex
|
||||
Advanced/ShadowInfo/Shadow/Hint: Der Tiddler: <$link to=<<infoTiddler>>><$text text=<<infoTiddler>>/></$link> ist ein Schatten-Tiddler.
|
||||
Advanced/ShadowInfo/Shadow/Source: Er ist definiert im Plugin: <$link to=<<pluginTiddler>>><$text text=<<pluginTiddler>>/></$link>.
|
||||
Advanced/ShadowInfo/OverriddenShadow/Hint: Der originale Schatten-Tiddler wurde durch diesen Tiddler überschrieben. Wenn Sie diesen Tiddler löschen, wird der originale Schatten-Tiddler wieder aktiv. Erstellen Sie vorher eventuell eine Sicherungskopie!
|
||||
Advanced/CascadeInfo/Heading: Kascade Details
|
||||
Advanced/CascadeInfo/Hint: ViewTemplate Kaskade - Filter Segmente getagged: <<tag "$:/tags/ViewTemplate">>.
|
||||
Advanced/CascadeInfo/Heading: Kaskade Details
|
||||
Advanced/CascadeInfo/Hint: ViewTemplate Kaskade - Filter Segmente getagged: <<tag "$:/tags/ViewTemplate">> sind aktiv.
|
||||
Advanced/CascadeInfo/Detail/View: Ansicht
|
||||
Advanced/CascadeInfo/Detail/ActiveCascadeFilter: Filter - Aktive Kascade
|
||||
Advanced/CascadeInfo/Detail/ActiveCascadeFilter: Filter - Aktive Kaskade
|
||||
Advanced/CascadeInfo/Detail/Template: Template
|
||||
Fields/Caption: Felder
|
||||
List/Caption: Liste
|
||||
|
||||
37
package-lock.json
generated
37
package-lock.json
generated
@@ -1,13 +1,16 @@
|
||||
{
|
||||
"name": "tiddlywiki",
|
||||
"version": "5.4.0-prerelease",
|
||||
"version": "5.4.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "tiddlywiki",
|
||||
"version": "5.4.0-prerelease",
|
||||
"version": "5.4.0",
|
||||
"license": "BSD",
|
||||
"dependencies": {
|
||||
"chokidar": "^4.0.3"
|
||||
},
|
||||
"bin": {
|
||||
"tiddlywiki": "tiddlywiki.js"
|
||||
},
|
||||
@@ -19,7 +22,7 @@
|
||||
"globals": "16.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.2"
|
||||
"node": ">=20.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint-community/eslint-utils": {
|
||||
@@ -329,6 +332,21 @@
|
||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/chokidar": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
|
||||
"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"readdirp": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.16.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"dev": true,
|
||||
@@ -898,6 +916,19 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/readdirp": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
|
||||
"integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 14.18.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/resolve-from": {
|
||||
"version": "4.0.0",
|
||||
"dev": true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "tiddlywiki",
|
||||
"preferGlobal": true,
|
||||
"version": "5.4.0-prerelease",
|
||||
"version": "5.5.0-prerelease",
|
||||
"author": "Jeremy Ruston <jeremy@jermolene.com>",
|
||||
"description": "a non-linear personal web notebook",
|
||||
"contributors": [
|
||||
@@ -23,11 +23,14 @@
|
||||
"tiddlywiki5",
|
||||
"wiki"
|
||||
],
|
||||
"dependencies": {
|
||||
"chokidar": "^4.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "9.36.0",
|
||||
"@stylistic/eslint-plugin": "5.4.0",
|
||||
"eslint": "9.36.0",
|
||||
"eslint-plugin-es-x": "9.1.0",
|
||||
"@stylistic/eslint-plugin": "5.4.0",
|
||||
"globals": "16.4.0"
|
||||
},
|
||||
"license": "BSD",
|
||||
|
||||
@@ -11,6 +11,7 @@ A sync adaptor module for synchronising with the local filesystem via node.js AP
|
||||
|
||||
// Get a reference to the file system
|
||||
var fs = $tw.node ? require("fs") : null;
|
||||
var path = $tw.node ? require("path") : null;
|
||||
|
||||
function FileSystemAdaptor(options) {
|
||||
this.wiki = options.wiki;
|
||||
@@ -20,6 +21,19 @@ function FileSystemAdaptor(options) {
|
||||
if(this.boot.wikiTiddlersPath) {
|
||||
$tw.utils.createDirectory(this.boot.wikiTiddlersPath);
|
||||
}
|
||||
// Buffers for out-of-band file changes, drained by getUpdatedTiddlers
|
||||
this.modifications = Object.create(null);
|
||||
this.deletions = Object.create(null);
|
||||
this.pendingTimers = Object.create(null);
|
||||
this.watchers = [];
|
||||
this.setupWatchers();
|
||||
// Only advertise getUpdatedTiddlers (and so opt into syncer polling) when
|
||||
// there is actually a dynamic store to report changes from. Otherwise the
|
||||
// syncer would reschedule its poll forever and keep node alive past the
|
||||
// natural end of headless commands like --build.
|
||||
if(!(this.boot.dynamicStores && this.boot.dynamicStores.length > 0)) {
|
||||
this.getUpdatedTiddlers = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
FileSystemAdaptor.prototype.name = "filesystem";
|
||||
@@ -27,35 +41,56 @@ FileSystemAdaptor.prototype.name = "filesystem";
|
||||
FileSystemAdaptor.prototype.supportsLazyLoading = false;
|
||||
|
||||
FileSystemAdaptor.prototype.isReady = function() {
|
||||
// The file system adaptor is always ready
|
||||
return true;
|
||||
};
|
||||
|
||||
FileSystemAdaptor.prototype.getTiddlerInfo = function(tiddler) {
|
||||
//Returns the existing fileInfo for the tiddler. To regenerate, call getTiddlerFileInfo().
|
||||
var title = tiddler.fields.title;
|
||||
return this.boot.files[title];
|
||||
};
|
||||
|
||||
/*
|
||||
Return a fileInfo object for a tiddler, creating it if necessary:
|
||||
filepath: the absolute path to the file containing the tiddler
|
||||
type: the type of the tiddler file (NOT the type of the tiddler -- see below)
|
||||
hasMetaFile: true if the file also has a companion .meta file
|
||||
Find the dynamic store (if any) that a tiddler should be saved into.
|
||||
Precedence: existing boot.files entry wins; otherwise first matching saveFilter.
|
||||
*/
|
||||
FileSystemAdaptor.prototype.findDynamicStoreForTiddler = function(tiddler) {
|
||||
var stores = this.boot.dynamicStores || [];
|
||||
if(stores.length === 0) {
|
||||
return null;
|
||||
}
|
||||
var title = tiddler.fields.title,
|
||||
existing = this.boot.files[title];
|
||||
if(existing && existing.dynamicStoreId) {
|
||||
for(var i=0; i<stores.length; i++) {
|
||||
if(stores[i].id === existing.dynamicStoreId) {
|
||||
return stores[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
for(var j=0; j<stores.length; j++) {
|
||||
var store = stores[j];
|
||||
if(store.saveFilter) {
|
||||
var source = this.wiki.makeTiddlerIterator([title]),
|
||||
result = this.wiki.filterTiddlers(store.saveFilter,null,source);
|
||||
if(result.length > 0) {
|
||||
return store;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
The boot process populates this.boot.files for each of the tiddler files that it loads.
|
||||
The type is found by looking up the extension in $tw.config.fileExtensionInfo (eg "application/x-tiddler" for ".tid" files).
|
||||
|
||||
It is the responsibility of the filesystem adaptor to update this.boot.files for new files that are created.
|
||||
/*
|
||||
Return a fileInfo object for a tiddler, creating it if necessary.
|
||||
*/
|
||||
FileSystemAdaptor.prototype.getTiddlerFileInfo = function(tiddler,callback) {
|
||||
// Error if we don't have a this.boot.wikiTiddlersPath
|
||||
if(!this.boot.wikiTiddlersPath) {
|
||||
return callback("filesystemadaptor requires a valid wiki folder");
|
||||
}
|
||||
// Always generate a fileInfo object when this fuction is called
|
||||
var title = tiddler.fields.title, newInfo, pathFilters, extFilters,
|
||||
fileInfo = this.boot.files[title];
|
||||
fileInfo = this.boot.files[title],
|
||||
store = this.findDynamicStoreForTiddler(tiddler),
|
||||
directory = store ? store.directory : this.boot.wikiTiddlersPath;
|
||||
if(this.wiki.tiddlerExists("$:/config/FileSystemPaths")) {
|
||||
pathFilters = this.wiki.getTiddlerText("$:/config/FileSystemPaths","").split("\n");
|
||||
}
|
||||
@@ -63,12 +98,15 @@ FileSystemAdaptor.prototype.getTiddlerFileInfo = function(tiddler,callback) {
|
||||
extFilters = this.wiki.getTiddlerText("$:/config/FileSystemExtensions","").split("\n");
|
||||
}
|
||||
newInfo = $tw.utils.generateTiddlerFileInfo(tiddler,{
|
||||
directory: this.boot.wikiTiddlersPath,
|
||||
directory: directory,
|
||||
pathFilters: pathFilters,
|
||||
extFilters: extFilters,
|
||||
wiki: this.wiki,
|
||||
fileInfo: fileInfo
|
||||
});
|
||||
if(store) {
|
||||
newInfo.dynamicStoreId = store.id;
|
||||
}
|
||||
callback(null,newInfo);
|
||||
};
|
||||
|
||||
@@ -83,6 +121,7 @@ FileSystemAdaptor.prototype.saveTiddler = function(tiddler,callback,options) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
var dynamicStoreId = fileInfo && fileInfo.dynamicStoreId || null;
|
||||
$tw.utils.saveTiddlerToFile(tiddler,fileInfo,function(err,fileInfo) {
|
||||
if(err) {
|
||||
if((err.code == "EPERM" || err.code == "EACCES") && err.syscall == "open") {
|
||||
@@ -95,6 +134,9 @@ FileSystemAdaptor.prototype.saveTiddler = function(tiddler,callback,options) {
|
||||
return callback(err);
|
||||
}
|
||||
}
|
||||
if(dynamicStoreId && fileInfo) {
|
||||
fileInfo.dynamicStoreId = dynamicStoreId;
|
||||
}
|
||||
// Store new boot info only after successful writes
|
||||
self.boot.files[tiddler.fields.title] = fileInfo;
|
||||
// Cleanup duplicates if the file moved or changed extensions
|
||||
@@ -116,9 +158,28 @@ FileSystemAdaptor.prototype.saveTiddler = function(tiddler,callback,options) {
|
||||
/*
|
||||
Load a tiddler and invoke the callback with (err,tiddlerFields)
|
||||
|
||||
We don't need to implement loading for the file system adaptor, because all the tiddler files will have been loaded during the boot process.
|
||||
Most tiddlers are pre-loaded at boot, but the syncer may ask us to load
|
||||
individual tiddlers in response to watcher-driven out-of-band changes.
|
||||
*/
|
||||
FileSystemAdaptor.prototype.loadTiddler = function(title,callback) {
|
||||
var fileInfo = this.boot.files[title];
|
||||
if(!fileInfo || !fileInfo.dynamicStoreId || !fs.existsSync(fileInfo.filepath)) {
|
||||
return callback(null,null);
|
||||
}
|
||||
var loaded;
|
||||
try {
|
||||
loaded = $tw.loadTiddlersFromFile(fileInfo.filepath,{});
|
||||
} catch(e) {
|
||||
return callback(e);
|
||||
}
|
||||
if(!loaded || !loaded.tiddlers) {
|
||||
return callback(null,null);
|
||||
}
|
||||
for(var i=0; i<loaded.tiddlers.length; i++) {
|
||||
if(loaded.tiddlers[i] && loaded.tiddlers[i].title === title) {
|
||||
return callback(null,loaded.tiddlers[i]);
|
||||
}
|
||||
}
|
||||
callback(null,null);
|
||||
};
|
||||
|
||||
@@ -128,19 +189,16 @@ Delete a tiddler and invoke the callback with (err)
|
||||
FileSystemAdaptor.prototype.deleteTiddler = function(title,callback,options) {
|
||||
var self = this,
|
||||
fileInfo = this.boot.files[title];
|
||||
// Only delete the tiddler if we have writable information for the file
|
||||
if(fileInfo) {
|
||||
$tw.utils.deleteTiddlerFile(fileInfo,function(err,fileInfo) {
|
||||
if(err) {
|
||||
if((err.code == "EPERM" || err.code == "EACCES") && err.syscall == "unlink") {
|
||||
// Error deleting the file on disk, should fail gracefully
|
||||
$tw.syncer.displayError("Server desynchronized. Error deleting file for deleted tiddler \"" + title + "\"",err);
|
||||
return callback(null,fileInfo);
|
||||
} else {
|
||||
return callback(err);
|
||||
}
|
||||
}
|
||||
// Remove the tiddler from self.boot.files & return null adaptorInfo
|
||||
self.removeTiddlerFileInfo(title);
|
||||
return callback(null,null);
|
||||
});
|
||||
@@ -153,10 +211,201 @@ FileSystemAdaptor.prototype.deleteTiddler = function(title,callback,options) {
|
||||
Delete a tiddler in cache, without modifying file system.
|
||||
*/
|
||||
FileSystemAdaptor.prototype.removeTiddlerFileInfo = function(title) {
|
||||
// Only delete the tiddler info if we have writable information for the file
|
||||
if(this.boot.files[title]) {
|
||||
delete this.boot.files[title];
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Syncer hook: return modifications/deletions that have occurred on disk
|
||||
since the last poll.
|
||||
*/
|
||||
FileSystemAdaptor.prototype.getUpdatedTiddlers = function(syncer,callback) {
|
||||
var modifications = Object.keys(this.modifications),
|
||||
deletions = Object.keys(this.deletions);
|
||||
this.modifications = Object.create(null);
|
||||
this.deletions = Object.create(null);
|
||||
callback(null,{modifications: modifications, deletions: deletions});
|
||||
};
|
||||
|
||||
/*
|
||||
Set up chokidar watchers for each registered dynamic store.
|
||||
*/
|
||||
/*
|
||||
Close all watchers and clear any pending debounce timers. Returns a promise
|
||||
that resolves once chokidar has fully shut down, for clean teardown in tests.
|
||||
*/
|
||||
FileSystemAdaptor.prototype.close = function() {
|
||||
$tw.utils.each(this.pendingTimers,function(timer) { clearTimeout(timer); });
|
||||
this.pendingTimers = Object.create(null);
|
||||
var closes = (this.watchers || []).map(function(w) {
|
||||
try { return w.close(); } catch(e) { return null; }
|
||||
});
|
||||
this.watchers = [];
|
||||
return Promise.all(closes.filter(Boolean));
|
||||
};
|
||||
|
||||
FileSystemAdaptor.prototype.setupWatchers = function() {
|
||||
var self = this,
|
||||
stores = (this.boot.dynamicStores || []).filter(function(s) { return s.watch; });
|
||||
if(stores.length === 0) {
|
||||
return;
|
||||
}
|
||||
var chokidar;
|
||||
try {
|
||||
chokidar = require("chokidar");
|
||||
} catch(e) {
|
||||
this.logger.log("chokidar not available; dynamic store watching disabled",e.message);
|
||||
return;
|
||||
}
|
||||
stores.forEach(function(store) {
|
||||
self.setupWatcher(chokidar,store);
|
||||
});
|
||||
};
|
||||
|
||||
FileSystemAdaptor.prototype.setupWatcher = function(chokidar,store) {
|
||||
var self = this,
|
||||
fileRegExp = new RegExp(store.filesRegExp || "^.*$");
|
||||
var watcher = chokidar.watch(store.directory,{
|
||||
ignoreInitial: true,
|
||||
persistent: true,
|
||||
depth: store.searchSubdirectories ? undefined : 0,
|
||||
awaitWriteFinish: {stabilityThreshold: 100, pollInterval: 50},
|
||||
ignored: function(p) {
|
||||
// chokidar invokes `ignored` for the root too — don't ignore the root
|
||||
if(p === store.directory) return false;
|
||||
var base = path.basename(p);
|
||||
if(/\.meta$/.test(base)) return false;
|
||||
// Allow directories through so recursion works when enabled
|
||||
try {
|
||||
if(fs.existsSync(p) && fs.statSync(p).isDirectory()) return false;
|
||||
} catch(e) {}
|
||||
return !fileRegExp.test(base);
|
||||
}
|
||||
});
|
||||
watcher.on("add",function(filepath) { self.scheduleFileEvent(store,filepath,"change"); });
|
||||
watcher.on("change",function(filepath) { self.scheduleFileEvent(store,filepath,"change"); });
|
||||
watcher.on("unlink",function(filepath) { self.scheduleFileEvent(store,filepath,"unlink"); });
|
||||
watcher.on("error",function(err) {
|
||||
self.logger.log("chokidar error for " + store.directory,err && err.message);
|
||||
});
|
||||
this.watchers.push(watcher);
|
||||
};
|
||||
|
||||
FileSystemAdaptor.prototype.scheduleFileEvent = function(store,filepath,eventType) {
|
||||
var self = this,
|
||||
key = filepath,
|
||||
delay = store.debounce || 400;
|
||||
// A .meta change should trigger re-read of its companion file
|
||||
var targetPath = filepath;
|
||||
if(/\.meta$/.test(filepath)) {
|
||||
targetPath = filepath.replace(/\.meta$/,"");
|
||||
}
|
||||
if(this.pendingTimers[key]) {
|
||||
clearTimeout(this.pendingTimers[key]);
|
||||
}
|
||||
var timer = setTimeout(function() {
|
||||
delete self.pendingTimers[key];
|
||||
try {
|
||||
self.processFileEvent(store,targetPath,eventType);
|
||||
} catch(e) {
|
||||
self.logger.log("Error processing file event for " + targetPath,e.message);
|
||||
}
|
||||
},delay);
|
||||
if(timer && typeof timer.unref === "function") {
|
||||
timer.unref();
|
||||
}
|
||||
this.pendingTimers[key] = timer;
|
||||
};
|
||||
|
||||
FileSystemAdaptor.prototype.processFileEvent = function(store,filepath,eventType) {
|
||||
var self = this;
|
||||
// Deletion: look up any titles that mapped to this filepath and queue deletion.
|
||||
// Do NOT call wiki.deleteTiddler here — the syncer's SyncFromServerTask does that.
|
||||
if(eventType === "unlink" || !fs.existsSync(filepath)) {
|
||||
var deletedTitles = [];
|
||||
$tw.utils.each(this.boot.files,function(info,title) {
|
||||
if(info && info.filepath === filepath) {
|
||||
deletedTitles.push(title);
|
||||
}
|
||||
});
|
||||
deletedTitles.forEach(function(title) {
|
||||
delete self.boot.files[title];
|
||||
self.deletions[title] = true;
|
||||
delete self.modifications[title];
|
||||
});
|
||||
if(deletedTitles.length > 0) {
|
||||
this.logger.log("Dynamic store: detected removal of " + deletedTitles.length + " tiddler(s) at " + filepath);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Add/change: re-parse the file and queue modifications
|
||||
var loaded;
|
||||
try {
|
||||
loaded = $tw.loadTiddlersFromFile(filepath,{});
|
||||
} catch(e) {
|
||||
this.logger.log("Failed to load tiddler file " + filepath,e.message);
|
||||
return;
|
||||
}
|
||||
if(!loaded || !loaded.tiddlers) {
|
||||
return;
|
||||
}
|
||||
var newTitles = {};
|
||||
loaded.tiddlers.forEach(function(fields) {
|
||||
if(!fields || !fields.title) {
|
||||
return;
|
||||
}
|
||||
if(fields.type === "application/javascript" && fields["module-type"]) {
|
||||
self.logger.log("Skipping hot-reload of JS module tiddler " + fields.title + " (requires a restart)");
|
||||
return;
|
||||
}
|
||||
var title = fields.title;
|
||||
newTitles[title] = true;
|
||||
// Ensure boot.files tracks the file so loadTiddler can find it on demand
|
||||
self.boot.files[title] = {
|
||||
filepath: loaded.filepath,
|
||||
type: loaded.type,
|
||||
hasMetaFile: loaded.hasMetaFile,
|
||||
isEditableFile: true,
|
||||
dynamicStoreId: store.id
|
||||
};
|
||||
// Diff against the current wiki tiddler to suppress self-write echoes
|
||||
var existing = self.wiki.getTiddler(title);
|
||||
if(existing && self.tiddlerFieldsEqual(existing.fields,fields)) {
|
||||
return;
|
||||
}
|
||||
self.modifications[title] = true;
|
||||
delete self.deletions[title];
|
||||
});
|
||||
// Handle tiddlers that were previously in this file but have now disappeared
|
||||
$tw.utils.each(this.boot.files,function(info,title) {
|
||||
if(info && info.filepath === filepath && !newTitles[title]) {
|
||||
delete self.boot.files[title];
|
||||
self.deletions[title] = true;
|
||||
delete self.modifications[title];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
FileSystemAdaptor.prototype.tiddlerFieldsEqual = function(existingFields,newFields) {
|
||||
// Ignore volatile fields that the syncer / server may add
|
||||
var ignore = {revision: 1, bag: 1};
|
||||
var keys = {};
|
||||
$tw.utils.each(existingFields,function(v,k) { if(!ignore[k]) keys[k] = true; });
|
||||
$tw.utils.each(newFields,function(v,k) { if(!ignore[k]) keys[k] = true; });
|
||||
for(var k in keys) {
|
||||
var a = existingFields[k],
|
||||
b = newFields[k];
|
||||
// Normalise arrays to string form
|
||||
if($tw.utils.isArray(a)) a = $tw.utils.stringifyList(a);
|
||||
if($tw.utils.isArray(b)) b = $tw.utils.stringifyList(b);
|
||||
if(a instanceof Date) a = $tw.utils.stringifyDate(a);
|
||||
if(b instanceof Date) b = $tw.utils.stringifyDate(b);
|
||||
if((a === undefined ? "" : String(a)) !== (b === undefined ? "" : String(b))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
if(fs) {
|
||||
|
||||
178
plugins/tiddlywiki/markdown/frontmatter-deserializer.js
Normal file
178
plugins/tiddlywiki/markdown/frontmatter-deserializer.js
Normal file
@@ -0,0 +1,178 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/markdown/frontmatter-deserializer.js
|
||||
type: application/javascript
|
||||
module-type: tiddlerdeserializer
|
||||
|
||||
Markdown deserializer with YAML frontmatter extraction.
|
||||
|
||||
Parses YAML frontmatter delimited by `---` markers and maps extracted
|
||||
values to tiddler fields. Array values on list fields (tags, list, any
|
||||
field with a registered `stringify` method) are converted to TiddlyWiki
|
||||
bracketed lists. Non-string, non-array values are stored as their JSON
|
||||
representation.
|
||||
|
||||
`created` and `modified` in the frontmatter are accepted in either
|
||||
TiddlyWiki's native `YYYYMMDDHHMMSSmmm` UTC format or any ISO-8601
|
||||
string that `Date()` can parse; both are normalised to TW's native
|
||||
format. Values that cannot be parsed are dropped.
|
||||
|
||||
\*/
|
||||
"use strict";
|
||||
|
||||
var yaml = require("$:/plugins/tiddlywiki/markdown/yaml.js");
|
||||
|
||||
function deserialize(text,fields) {
|
||||
var result = Object.create(null),
|
||||
body = text,
|
||||
frontmatter = null;
|
||||
// Copy incoming fields (e.g. from .meta file or filename)
|
||||
for(var f in fields) {
|
||||
result[f] = fields[f];
|
||||
}
|
||||
// Extract YAML frontmatter if present
|
||||
if(text.indexOf("---") === 0) {
|
||||
var endMarker = text.indexOf("\n---",3);
|
||||
if(endMarker !== -1) {
|
||||
var yamlText = text.substring(3,endMarker).trim();
|
||||
// Body starts after the closing --- and its newline
|
||||
var afterMarker = endMarker + 4;
|
||||
if(text[afterMarker] === "\n") {
|
||||
afterMarker++;
|
||||
} else if(text[afterMarker] === "\r" && text[afterMarker + 1] === "\n") {
|
||||
afterMarker += 2;
|
||||
}
|
||||
// Skip one blank line if present (conventional separator between frontmatter and body)
|
||||
if(text[afterMarker] === "\n") {
|
||||
afterMarker++;
|
||||
} else if(text[afterMarker] === "\r" && text[afterMarker + 1] === "\n") {
|
||||
afterMarker += 2;
|
||||
}
|
||||
body = text.substring(afterMarker);
|
||||
try {
|
||||
frontmatter = yaml.load(yamlText);
|
||||
} catch(e) {
|
||||
// If YAML parsing fails, treat the whole text as body
|
||||
body = text;
|
||||
frontmatter = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Map frontmatter fields to tiddler fields
|
||||
if(frontmatter && typeof frontmatter === "object" && !Array.isArray(frontmatter)) {
|
||||
var keys = Object.keys(frontmatter);
|
||||
for(var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i],
|
||||
value = frontmatter[key];
|
||||
// Apply field collision policy
|
||||
if(key === "created" || key === "modified") {
|
||||
var normalised = normaliseDate(value);
|
||||
if(normalised !== null) {
|
||||
result[key] = normalised;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(key === "tags" && result[key]) {
|
||||
// Merge: parse existing tags, add new ones
|
||||
result[key] = mergeTagValue(result[key],value);
|
||||
continue;
|
||||
}
|
||||
result[key] = fieldValueToString(key,value);
|
||||
}
|
||||
}
|
||||
result.text = body;
|
||||
if(!result.type) {
|
||||
result.type = "text/x-markdown";
|
||||
}
|
||||
return [result];
|
||||
}
|
||||
|
||||
// Register under both types — text/x-markdown is the deserializer type
|
||||
// registered for .md file extensions; text/markdown is the raw content type.
|
||||
exports["text/x-markdown"] = deserialize;
|
||||
exports["text/markdown"] = deserialize;
|
||||
|
||||
/*
|
||||
Convert a parsed YAML value to a tiddler field string.
|
||||
- Arrays on list fields (tags, list, etc.) → TW bracketed list format
|
||||
- Strings → as-is
|
||||
- Everything else → JSON
|
||||
*/
|
||||
function fieldValueToString(key,value) {
|
||||
if(value === null || value === undefined) {
|
||||
return "";
|
||||
}
|
||||
if(typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
if(Array.isArray(value)) {
|
||||
// Check if this field has a stringify method (i.e. it's a list field)
|
||||
if($tw.Tiddler.fieldModules[key] && $tw.Tiddler.fieldModules[key].stringify) {
|
||||
var stringItems = [];
|
||||
for(var i = 0; i < value.length; i++) {
|
||||
stringItems.push(value[i] == null ? "" : String(value[i]));
|
||||
}
|
||||
return $tw.utils.stringifyList(stringItems);
|
||||
}
|
||||
return JSON.stringify(value);
|
||||
}
|
||||
if(typeof value === "object") {
|
||||
return JSON.stringify(value);
|
||||
}
|
||||
return String(value);
|
||||
}
|
||||
|
||||
/*
|
||||
Normalise a frontmatter date value to TiddlyWiki's YYYYMMDDHHMMSSmmm UTC
|
||||
format. Accepts TW native strings (14 or 17 digits, optional leading "-"
|
||||
for negative years) and anything `Date()` can parse (ISO 8601, RFC 2822,
|
||||
Date objects). Returns null if the value cannot be interpreted as a date.
|
||||
*/
|
||||
function normaliseDate(value) {
|
||||
if(value === null || value === undefined) {
|
||||
return null;
|
||||
}
|
||||
if(typeof value === "string") {
|
||||
if(/^-?\d{14}$/.test(value)) {
|
||||
return value + "000";
|
||||
}
|
||||
if(/^-?\d{17}$/.test(value)) {
|
||||
return value;
|
||||
}
|
||||
var d = new Date(value);
|
||||
if(!isNaN(d.getTime())) {
|
||||
return $tw.utils.stringifyDate(d);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if(value instanceof Date && !isNaN(value.getTime())) {
|
||||
return $tw.utils.stringifyDate(value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
Merge incoming tag value with existing tags string.
|
||||
The incoming value may be a string (TW bracketed list) or an array (from YAML).
|
||||
*/
|
||||
function mergeTagValue(existing,incoming) {
|
||||
var existingTags = $tw.utils.parseStringArray(existing) || [];
|
||||
var newTags;
|
||||
if(Array.isArray(incoming)) {
|
||||
newTags = incoming.map(function(t) { return t == null ? "" : String(t); });
|
||||
} else if(typeof incoming === "string") {
|
||||
newTags = $tw.utils.parseStringArray(incoming) || [];
|
||||
} else {
|
||||
return existing;
|
||||
}
|
||||
var seen = Object.create(null);
|
||||
for(var i = 0; i < existingTags.length; i++) {
|
||||
seen[existingTags[i]] = true;
|
||||
}
|
||||
for(var j = 0; j < newTags.length; j++) {
|
||||
if(!seen[newTags[j]]) {
|
||||
existingTags.push(newTags[j]);
|
||||
seen[newTags[j]] = true;
|
||||
}
|
||||
}
|
||||
return $tw.utils.stringifyList(existingTags);
|
||||
}
|
||||
108
plugins/tiddlywiki/markdown/frontmatter-serializer.js
Normal file
108
plugins/tiddlywiki/markdown/frontmatter-serializer.js
Normal file
@@ -0,0 +1,108 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/markdown/frontmatter-serializer.js
|
||||
type: application/javascript
|
||||
module-type: tiddlerserializer
|
||||
|
||||
Markdown serializer with YAML frontmatter.
|
||||
|
||||
Inverse of `frontmatter-deserializer.js`. Given a tiddler, returns a
|
||||
Markdown file body whose first lines are a YAML frontmatter block
|
||||
(`---` … `---`), followed by the tiddler's `text` field.
|
||||
|
||||
Field handling:
|
||||
- `title` is always emitted (frontmatter wins over filename when reloaded).
|
||||
- `text` is the body; not emitted in the frontmatter.
|
||||
- `created`, `modified` are emitted as ISO-8601 strings (symmetric with
|
||||
the deserializer, which accepts either ISO-8601 or TW's native format).
|
||||
- `type` is skipped when it equals `text/x-markdown` (the default for `.md` files).
|
||||
- `bag`, `revision` are skipped (sync metadata, not authored content).
|
||||
- List fields (those with a registered `stringify` method) are emitted as YAML arrays.
|
||||
- All other fields are emitted as YAML strings (preserving their on-disk type).
|
||||
|
||||
\*/
|
||||
"use strict";
|
||||
|
||||
var yaml = require("$:/plugins/tiddlywiki/markdown/yaml.js");
|
||||
|
||||
// Field names to skip when emitting frontmatter
|
||||
var SKIP_FIELDS = {
|
||||
text: true,
|
||||
bag: true,
|
||||
revision: true
|
||||
};
|
||||
|
||||
function serialize(tiddler) {
|
||||
if(!tiddler) {
|
||||
return "";
|
||||
}
|
||||
var fields = tiddler.fields || {},
|
||||
frontmatter = Object.create(null);
|
||||
// Always include title first
|
||||
if(fields.title) {
|
||||
frontmatter.title = fields.title;
|
||||
}
|
||||
// Add other fields
|
||||
$tw.utils.each(fields,function(value,name) {
|
||||
if(SKIP_FIELDS[name] || name === "title") {
|
||||
return;
|
||||
}
|
||||
if(name === "type" && value === "text/x-markdown") {
|
||||
return;
|
||||
}
|
||||
if(name === "created" || name === "modified") {
|
||||
var iso = toIsoDate(value);
|
||||
if(iso) {
|
||||
frontmatter[name] = iso;
|
||||
}
|
||||
return;
|
||||
}
|
||||
// List fields → YAML arrays
|
||||
if($tw.Tiddler.fieldModules[name] && $tw.Tiddler.fieldModules[name].stringify) {
|
||||
var items;
|
||||
if(Array.isArray(value)) {
|
||||
items = value.slice();
|
||||
} else {
|
||||
items = $tw.utils.parseStringArray(value || "") || [];
|
||||
}
|
||||
frontmatter[name] = items;
|
||||
} else if(typeof value === "string") {
|
||||
frontmatter[name] = value;
|
||||
} else {
|
||||
// Fallback: stringify whatever it is
|
||||
frontmatter[name] = String(value);
|
||||
}
|
||||
});
|
||||
var body = fields.text || "";
|
||||
var hasFrontmatter = Object.keys(frontmatter).length > 0;
|
||||
if(!hasFrontmatter) {
|
||||
return body;
|
||||
}
|
||||
return "---\n" + yaml.dump(frontmatter) + "\n---\n\n" + body;
|
||||
}
|
||||
|
||||
/*
|
||||
Convert a TiddlyWiki date field value to an ISO-8601 string. Accepts a
|
||||
native `YYYYMMDDHHMMSSmmm` string or a Date. Returns null if the value
|
||||
cannot be parsed.
|
||||
*/
|
||||
function toIsoDate(value) {
|
||||
if(!value) {
|
||||
return null;
|
||||
}
|
||||
var d;
|
||||
if($tw.utils.isDate(value)) {
|
||||
d = value;
|
||||
} else {
|
||||
d = $tw.utils.parseDate(String(value));
|
||||
}
|
||||
if(d && !isNaN(d.getTime())) {
|
||||
return d.toISOString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Register under both types — text/markdown is what the "New Markdown" button
|
||||
// sets; text/x-markdown is what the deserializer uses after content-type
|
||||
// resolution for .md files loaded from disk.
|
||||
exports["text/x-markdown"] = serialize;
|
||||
exports["text/markdown"] = serialize;
|
||||
473
plugins/tiddlywiki/markdown/yaml.js
Normal file
473
plugins/tiddlywiki/markdown/yaml.js
Normal file
@@ -0,0 +1,473 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/markdown/yaml.js
|
||||
type: application/javascript
|
||||
module-type: library
|
||||
|
||||
Minimal YAML parser for frontmatter extraction.
|
||||
API-compatible subset of js-yaml: load(string) → object, dump(object) → string.
|
||||
Handles scalars, flow/block arrays, and simple nested maps.
|
||||
|
||||
\*/
|
||||
"use strict";
|
||||
|
||||
function YAMLException(message, mark) {
|
||||
this.name = "YAMLException";
|
||||
this.message = message;
|
||||
this.mark = mark || null;
|
||||
}
|
||||
YAMLException.prototype = Object.create(Error.prototype);
|
||||
YAMLException.prototype.constructor = YAMLException;
|
||||
|
||||
// -- Scalar parsing --
|
||||
|
||||
function parseScalar(raw) {
|
||||
if(raw === "" || raw === "null" || raw === "Null" || raw === "NULL" || raw === "~") {
|
||||
return null;
|
||||
}
|
||||
if(raw === "true" || raw === "True" || raw === "TRUE") {
|
||||
return true;
|
||||
}
|
||||
if(raw === "false" || raw === "False" || raw === "FALSE") {
|
||||
return false;
|
||||
}
|
||||
// Quoted strings
|
||||
if((raw[0] === '"' && raw[raw.length - 1] === '"') ||
|
||||
(raw[0] === "'" && raw[raw.length - 1] === "'")) {
|
||||
var inner = raw.slice(1, -1);
|
||||
if(raw[0] === '"') {
|
||||
// Handle basic escape sequences in double-quoted strings.
|
||||
// Use a single pass so each escape consumes its backslash before
|
||||
// later replacements can re-interpret it (e.g. "\\n" must become
|
||||
// backslash + n, not backslash + newline).
|
||||
inner = inner.replace(/\\(.)/g, function(_, c) {
|
||||
switch(c) {
|
||||
case "n": return "\n";
|
||||
case "t": return "\t";
|
||||
case "r": return "\r";
|
||||
case "\\": return "\\";
|
||||
case '"': return '"';
|
||||
default: return c;
|
||||
}
|
||||
});
|
||||
}
|
||||
return inner;
|
||||
}
|
||||
// Numbers: integers and floats
|
||||
if(/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(raw)) {
|
||||
var num = Number(raw);
|
||||
if(!isNaN(num)) {
|
||||
return num;
|
||||
}
|
||||
}
|
||||
// Hex integers
|
||||
if(/^0x[0-9a-fA-F]+$/.test(raw)) {
|
||||
return parseInt(raw, 16);
|
||||
}
|
||||
// Octal integers
|
||||
if(/^0o[0-7]+$/.test(raw)) {
|
||||
return parseInt(raw.slice(2), 8);
|
||||
}
|
||||
// Special floats
|
||||
if(raw === ".inf" || raw === ".Inf" || raw === ".INF") {
|
||||
return Infinity;
|
||||
}
|
||||
if(raw === "-.inf" || raw === "-.Inf" || raw === "-.INF") {
|
||||
return -Infinity;
|
||||
}
|
||||
if(raw === ".nan" || raw === ".NaN" || raw === ".NAN") {
|
||||
return NaN;
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
// -- Flow sequence parser: [item, item, ...] --
|
||||
|
||||
function parseFlowSequence(str) {
|
||||
// Strip outer brackets and split respecting nested brackets and quotes
|
||||
var inner = str.slice(1, -1).trim();
|
||||
if(inner === "") {
|
||||
return [];
|
||||
}
|
||||
var items = [],
|
||||
current = "",
|
||||
depth = 0,
|
||||
inSingle = false,
|
||||
inDouble = false;
|
||||
for(var i = 0; i < inner.length; i++) {
|
||||
var ch = inner[i];
|
||||
if(ch === "\\" && inDouble) {
|
||||
current += ch + (inner[i + 1] || "");
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if(ch === '"' && !inSingle) {
|
||||
inDouble = !inDouble;
|
||||
current += ch;
|
||||
continue;
|
||||
}
|
||||
if(ch === "'" && !inDouble) {
|
||||
inSingle = !inSingle;
|
||||
current += ch;
|
||||
continue;
|
||||
}
|
||||
if(!inSingle && !inDouble) {
|
||||
if(ch === "[" || ch === "{") {
|
||||
depth++;
|
||||
} else if(ch === "]" || ch === "}") {
|
||||
depth--;
|
||||
} else if(ch === "," && depth === 0) {
|
||||
items.push(parseScalar(current.trim()));
|
||||
current = "";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
current += ch;
|
||||
}
|
||||
if(current.trim() !== "") {
|
||||
items.push(parseScalar(current.trim()));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
// -- Flow mapping parser: {key: value, ...} --
|
||||
|
||||
function parseFlowMapping(str) {
|
||||
var inner = str.slice(1, -1).trim();
|
||||
if(inner === "") {
|
||||
return {};
|
||||
}
|
||||
var result = Object.create(null),
|
||||
pairs = [],
|
||||
current = "",
|
||||
depth = 0,
|
||||
inSingle = false,
|
||||
inDouble = false;
|
||||
for(var i = 0; i < inner.length; i++) {
|
||||
var ch = inner[i];
|
||||
if(ch === "\\" && inDouble) {
|
||||
current += ch + (inner[i + 1] || "");
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if(ch === '"' && !inSingle) {
|
||||
inDouble = !inDouble;
|
||||
current += ch;
|
||||
continue;
|
||||
}
|
||||
if(ch === "'" && !inDouble) {
|
||||
inSingle = !inSingle;
|
||||
current += ch;
|
||||
continue;
|
||||
}
|
||||
if(!inSingle && !inDouble) {
|
||||
if(ch === "[" || ch === "{") {
|
||||
depth++;
|
||||
} else if(ch === "]" || ch === "}") {
|
||||
depth--;
|
||||
} else if(ch === "," && depth === 0) {
|
||||
pairs.push(current.trim());
|
||||
current = "";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
current += ch;
|
||||
}
|
||||
if(current.trim() !== "") {
|
||||
pairs.push(current.trim());
|
||||
}
|
||||
for(var p = 0; p < pairs.length; p++) {
|
||||
var colonIdx = pairs[p].indexOf(":");
|
||||
if(colonIdx !== -1) {
|
||||
var key = pairs[p].slice(0, colonIdx).trim(),
|
||||
val = pairs[p].slice(colonIdx + 1).trim();
|
||||
result[parseScalar(key)] = parseScalar(val);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// -- Block parser (indentation-based) --
|
||||
|
||||
/*
|
||||
Parse block YAML from an array of {indent, raw} line objects.
|
||||
Returns the parsed value (object, array, or scalar).
|
||||
*/
|
||||
function parseBlock(lines, start, baseIndent) {
|
||||
if(start >= lines.length) {
|
||||
return {value: null, nextIndex: start};
|
||||
}
|
||||
var firstLine = lines[start];
|
||||
// Block sequence: lines starting with "- "
|
||||
if(firstLine.raw.indexOf("- ") === 0 || firstLine.raw === "-") {
|
||||
return parseBlockSequence(lines, start, firstLine.indent);
|
||||
}
|
||||
// Block mapping: lines containing ":"
|
||||
if(firstLine.raw.indexOf(":") !== -1) {
|
||||
return parseBlockMapping(lines, start, firstLine.indent);
|
||||
}
|
||||
// Bare scalar
|
||||
return {value: parseScalar(firstLine.raw), nextIndex: start + 1};
|
||||
}
|
||||
|
||||
function parseBlockSequence(lines, start, seqIndent) {
|
||||
var result = [],
|
||||
i = start;
|
||||
while(i < lines.length && lines[i].indent === seqIndent && (lines[i].raw.indexOf("- ") === 0 || lines[i].raw === "-")) {
|
||||
var itemRaw = lines[i].raw.slice(2); // After "- "
|
||||
// Check for inline flow value
|
||||
var trimmed = itemRaw.trim();
|
||||
if(trimmed[0] === "[") {
|
||||
result.push(parseFlowSequence(trimmed));
|
||||
i++;
|
||||
} else if(trimmed[0] === "{") {
|
||||
result.push(parseFlowMapping(trimmed));
|
||||
i++;
|
||||
} else if(trimmed === "" || trimmed === undefined) {
|
||||
// Multi-line block item — collect indented children
|
||||
i++;
|
||||
var childLines = [];
|
||||
while(i < lines.length && lines[i].indent > seqIndent) {
|
||||
childLines.push(lines[i]);
|
||||
i++;
|
||||
}
|
||||
if(childLines.length > 0) {
|
||||
var parsed = parseBlock(childLines, 0, childLines[0].indent);
|
||||
result.push(parsed.value);
|
||||
} else {
|
||||
result.push(null);
|
||||
}
|
||||
} else if(trimmed.indexOf(":") !== -1 && !isQuotedColonValue(trimmed)) {
|
||||
// Inline mapping start as sequence item
|
||||
// Collect this line (re-indented) plus any deeper-indented children
|
||||
var mappingLines = [{indent: seqIndent + 2, raw: trimmed}];
|
||||
i++;
|
||||
while(i < lines.length && lines[i].indent > seqIndent) {
|
||||
mappingLines.push(lines[i]);
|
||||
i++;
|
||||
}
|
||||
var parsedMap = parseBlock(mappingLines, 0, mappingLines[0].indent);
|
||||
result.push(parsedMap.value);
|
||||
} else {
|
||||
result.push(parseScalar(trimmed));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return {value: result, nextIndex: i};
|
||||
}
|
||||
|
||||
function isQuotedColonValue(str) {
|
||||
// Check if the colon is inside quotes (meaning it's a scalar, not a mapping)
|
||||
var colonIdx = str.indexOf(":");
|
||||
if(colonIdx === -1) {
|
||||
return false;
|
||||
}
|
||||
// If the value starts with a quote and the colon is inside, it's a quoted scalar
|
||||
if((str[0] === '"' || str[0] === "'") && colonIdx > 0) {
|
||||
var quote = str[0];
|
||||
var closeIdx = str.indexOf(quote, 1);
|
||||
if(closeIdx > colonIdx) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function parseBlockMapping(lines, start, mapIndent) {
|
||||
var result = Object.create(null),
|
||||
i = start;
|
||||
while(i < lines.length && lines[i].indent === mapIndent) {
|
||||
var line = lines[i].raw,
|
||||
colonIdx = line.indexOf(":");
|
||||
if(colonIdx === -1) {
|
||||
break;
|
||||
}
|
||||
var key = line.slice(0, colonIdx).trim(),
|
||||
valRaw = line.slice(colonIdx + 1).trim();
|
||||
if(valRaw !== "") {
|
||||
// Inline value
|
||||
if(valRaw[0] === "[") {
|
||||
result[key] = parseFlowSequence(valRaw);
|
||||
} else if(valRaw[0] === "{") {
|
||||
result[key] = parseFlowMapping(valRaw);
|
||||
} else {
|
||||
result[key] = parseScalar(valRaw);
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
// Block value on subsequent indented lines
|
||||
i++;
|
||||
var childLines = [];
|
||||
while(i < lines.length && lines[i].indent > mapIndent) {
|
||||
childLines.push(lines[i]);
|
||||
i++;
|
||||
}
|
||||
if(childLines.length > 0) {
|
||||
var parsed = parseBlock(childLines, 0, childLines[0].indent);
|
||||
result[key] = parsed.value;
|
||||
} else {
|
||||
result[key] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return {value: result, nextIndex: i};
|
||||
}
|
||||
|
||||
// -- Main API --
|
||||
|
||||
/*
|
||||
Parse a YAML string into a JavaScript value.
|
||||
Compatible with js-yaml's load() function.
|
||||
Handles the subset of YAML used in frontmatter:
|
||||
scalars, flow/block arrays, flow/block mappings, nested maps.
|
||||
*/
|
||||
function load(text) {
|
||||
if(typeof text !== "string") {
|
||||
throw new YAMLException("Input must be a string");
|
||||
}
|
||||
text = text.trim();
|
||||
if(text === "") {
|
||||
return null;
|
||||
}
|
||||
// Tokenise into lines with indent tracking
|
||||
var rawLines = text.split(/\r?\n/),
|
||||
lines = [];
|
||||
for(var i = 0; i < rawLines.length; i++) {
|
||||
var raw = rawLines[i];
|
||||
// Skip blank lines and comment-only lines
|
||||
var trimmed = raw.trim();
|
||||
if(trimmed === "" || trimmed[0] === "#") {
|
||||
continue;
|
||||
}
|
||||
var indent = 0;
|
||||
while(indent < raw.length && raw[indent] === " ") {
|
||||
indent++;
|
||||
}
|
||||
lines.push({indent: indent, raw: trimmed});
|
||||
}
|
||||
if(lines.length === 0) {
|
||||
return null;
|
||||
}
|
||||
// Single-line flow values
|
||||
if(lines.length === 1) {
|
||||
var single = lines[0].raw;
|
||||
if(single[0] === "[") {
|
||||
return parseFlowSequence(single);
|
||||
}
|
||||
if(single[0] === "{") {
|
||||
return parseFlowMapping(single);
|
||||
}
|
||||
}
|
||||
var parsed = parseBlock(lines, 0, lines[0].indent);
|
||||
return parsed.value;
|
||||
}
|
||||
|
||||
/*
|
||||
Serialise a JavaScript value to a YAML string.
|
||||
Compatible with js-yaml's dump() function.
|
||||
Handles the subset of YAML used in frontmatter.
|
||||
*/
|
||||
function dump(obj, options) {
|
||||
options = options || {};
|
||||
var indent = options.indent || 2;
|
||||
return dumpValue(obj, 0, indent);
|
||||
}
|
||||
|
||||
function dumpValue(val, level, indentSize) {
|
||||
if(val === null || val === undefined) {
|
||||
return "null";
|
||||
}
|
||||
if(typeof val === "boolean") {
|
||||
return val ? "true" : "false";
|
||||
}
|
||||
if(typeof val === "number") {
|
||||
if(val !== val) { return ".nan"; }
|
||||
if(val === Infinity) { return ".inf"; }
|
||||
if(val === -Infinity) { return "-.inf"; }
|
||||
return String(val);
|
||||
}
|
||||
if(typeof val === "string") {
|
||||
return dumpString(val);
|
||||
}
|
||||
if(Array.isArray(val)) {
|
||||
return dumpArray(val, level, indentSize);
|
||||
}
|
||||
if(typeof val === "object") {
|
||||
return dumpObject(val, level, indentSize);
|
||||
}
|
||||
return String(val);
|
||||
}
|
||||
|
||||
function dumpString(str) {
|
||||
// Use plain style if safe, otherwise double-quote
|
||||
if(str === "") {
|
||||
return "''";
|
||||
}
|
||||
if(/^[\w][\w\s\-\.\/]*$/.test(str) &&
|
||||
str !== "true" && str !== "false" && str !== "null" &&
|
||||
str !== "True" && str !== "False" && str !== "Null" &&
|
||||
str !== "TRUE" && str !== "FALSE" && str !== "NULL" &&
|
||||
!/^-?\d/.test(str)) {
|
||||
return str;
|
||||
}
|
||||
// Double-quote with escaping
|
||||
return '"' + str.replace(/\\/g, "\\\\")
|
||||
.replace(/"/g, '\\"')
|
||||
.replace(/\n/g, "\\n")
|
||||
.replace(/\r/g, "\\r")
|
||||
.replace(/\t/g, "\\t") + '"';
|
||||
}
|
||||
|
||||
function dumpArray(arr, level, indentSize) {
|
||||
if(arr.length === 0) {
|
||||
return "[]";
|
||||
}
|
||||
var prefix = repeat(" ", level * indentSize);
|
||||
var lines = [];
|
||||
for(var i = 0; i < arr.length; i++) {
|
||||
var val = dumpValue(arr[i], level + 1, indentSize);
|
||||
if(typeof arr[i] === "object" && arr[i] !== null && !Array.isArray(arr[i])) {
|
||||
// Object items: first key on same line as dash, rest indented
|
||||
var objLines = val.split("\n");
|
||||
lines.push(prefix + "- " + objLines[0]);
|
||||
for(var j = 1; j < objLines.length; j++) {
|
||||
lines.push(prefix + " " + objLines[j]);
|
||||
}
|
||||
} else {
|
||||
lines.push(prefix + "- " + val);
|
||||
}
|
||||
}
|
||||
return "\n" + lines.join("\n");
|
||||
}
|
||||
|
||||
function dumpObject(obj, level, indentSize) {
|
||||
var keys = Object.keys(obj);
|
||||
if(keys.length === 0) {
|
||||
return "{}";
|
||||
}
|
||||
var prefix = repeat(" ", level * indentSize);
|
||||
var lines = [];
|
||||
for(var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i],
|
||||
val = obj[key];
|
||||
var dumpedVal = dumpValue(val, level + 1, indentSize);
|
||||
if((typeof val === "object" && val !== null) &&
|
||||
((Array.isArray(val) && val.length > 0) || (!Array.isArray(val) && Object.keys(val).length > 0))) {
|
||||
lines.push(prefix + dumpString(key) + ":" + dumpedVal);
|
||||
} else {
|
||||
lines.push(prefix + dumpString(key) + ": " + dumpedVal);
|
||||
}
|
||||
}
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
||||
function repeat(str, count) {
|
||||
var result = "";
|
||||
for(var i = 0; i < count; i++) {
|
||||
result += str;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
exports.load = load;
|
||||
exports.dump = dump;
|
||||
exports.YAMLException = YAMLException;
|
||||
@@ -1,9 +1,6 @@
|
||||
<h1 class="">Welcome</h1><p>Welcome to <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a>, a non-linear personal web notebook that anyone can use and keep forever, independently of any corporation.</p><p>TiddlyWiki is a complete interactive wiki in JavaScript. It can be used as a single HTML file in the browser or as a powerful Node.js application. It is highly customisable: the entire user interface is itself implemented in hackable <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/WikiText.html">WikiText</a>.</p><h2 class="">Demo</h2><p>Learn more and see it in action at <a class="tc-tiddlylink-external" href="https://tiddlywiki.com/" rel="noopener noreferrer" target="_blank">https://tiddlywiki.com/</a></p><h2 class="">Developer Documentation</h2><p>Developer documentation is in progress at <a class="tc-tiddlylink-external" href="https://tiddlywiki.com/dev/" rel="noopener noreferrer" target="_blank">https://tiddlywiki.com/dev/</a></p><h2 class="">Pull Request Previews</h2><p>Pull request previews courtesy of <a class="tc-tiddlylink-external" href="https://netlify.com" rel="noopener noreferrer" target="_blank">Netlify</a></p><p><a href="https://www.netlify.com" rel="noopener noreferrer" target="_blank"><img alt="Deploys by Netlify" src="https://www.netlify.com/v3/img/components/netlify-light.svg"></a></p><h1 class="">Join the Community</h1><p>
|
||||
<h2 class="">Official Forums</h2><h3 class=""><a class="tc-tiddlylink-external" href="https://talk.tiddlywiki.org/" rel="noopener noreferrer" target="_blank">https://talk.tiddlywiki.org/</a></h3><blockquote class="tc-quote"><p>The new official forum for talking about TiddlyWiki: requests for help, <a class="tc-tiddlylink-external" href="https://talk.tiddlywiki.org/c/announcements/20" rel="noopener noreferrer" target="_blank">announcements</a> of new releases and plugins, debating new features, or just sharing experiences. You can participate via the associated website, or subscribe via email.</p><p><strong>talk.tiddlywiki.org</strong> is a community run service that we host and maintain ourselves. The modest running costs are covered by community contributions.
|
||||
</p></blockquote><h4 class="">Google Groups</h4><blockquote class="tc-quote"><p>For the convenience of existing users, we also continue to operate the original TiddlyWiki group (hosted on Google Groups since 2005): <a class="tc-tiddlylink-external" href="https://groups.google.com/group/TiddlyWiki" rel="noopener noreferrer" target="_blank">https://groups.google.com/group/TiddlyWiki</a>
|
||||
</p></blockquote><h2 class="">Developer Forums</h2><h2 class=""><a class="tc-tiddlylink-external" href="https://github.com/TiddlyWiki/TiddlyWiki5/graphs/contributors" rel="noopener noreferrer" target="_blank">GitHub Stats</a></h2><p>There are several resources for developers to learn more about <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> and to discuss and contribute to its development.</p><blockquote><div><img class=" tc-image-loading" src="https://repobeats.axiom.co/api/embed/b92b1b363e2b5f26837ae573a60d39b4248b50a0.svg"></div></blockquote><ul><li><a class="tc-tiddlylink-external" href="https://tiddlywiki.com/dev" rel="noopener noreferrer" target="_blank">tiddlywiki.com/dev</a> is the official developer documentation</li><li>Get involved in the <a class="tc-tiddlylink-external" href="https://github.com/TiddlyWiki/TiddlyWiki5" rel="noopener noreferrer" target="_blank">development on GitHub</a></li><li><a class="tc-tiddlylink-external" href="https://github.com/TiddlyWiki/TiddlyWiki5/discussions" rel="noopener noreferrer" target="_blank">GitHub Discussions</a> are for Q&A and open-ended discussion</li><li><a class="tc-tiddlylink-external" href="https://github.com/TiddlyWiki/TiddlyWiki5/issues" rel="noopener noreferrer" target="_blank">GitHub Issues</a> are for raising bug reports and proposing specific, actionable new ideas</li><li>The older TiddlyWikiDev Google Group is now closed in favour of <a class="tc-tiddlylink-external" href="https://talk.tiddlywiki.org/" rel="noopener noreferrer" target="_blank">Talk TiddlyWiki</a> and <a class="tc-tiddlylink-external" href="https://github.com/TiddlyWiki/TiddlyWiki5/discussions" rel="noopener noreferrer" target="_blank">GitHub Discussions</a> <ul><li>It remains a useful archive: <a class="tc-tiddlylink-external" href="https://groups.google.com/group/TiddlyWikiDev" rel="noopener noreferrer" target="_blank">https://groups.google.com/group/TiddlyWikiDev</a><ul><li>An enhanced group search facility is available on <a class="tc-tiddlylink-external" href="https://www.mail-archive.com/tiddlywikidev@googlegroups.com/" rel="noopener noreferrer" target="_blank">mail-archive.com</a></li></ul></li></ul></li></ul><h2 class="">Other Forums</h2><ul><li><a class="tc-tiddlylink-external" href="https://www.reddit.com/r/TiddlyWiki5/" rel="noopener noreferrer" target="_blank">TiddlyWiki Subreddit</a></li><li>Chat on Discord at <a class="tc-tiddlylink-external" href="https://discord.gg/HFFZVQ8" rel="noopener noreferrer" target="_blank">https://discord.gg/HFFZVQ8</a></li></ul><h3 class="">Documentation</h3><p>There is also a discussion group specifically for discussing <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> documentation improvement initiatives: <a class="tc-tiddlylink-external" href="https://groups.google.com/group/tiddlywikidocs" rel="noopener noreferrer" target="_blank">https://groups.google.com/group/tiddlywikidocs</a>
|
||||
</p>
|
||||
</p><hr><h1 class="">Installing TiddlyWiki on Node.js</h1><p>TiddlyWiki is a <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/SingleFileApplication.html">SingleFileApplication</a>, which is easy to use. For advanced users and developers there is a possibility to use a Node.js client / server configuration. This configuration is also used to build the TiddlyWiki <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/SinglePageApplication.html">SinglePageApplication</a></p><ol><li>Install <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/Node.js.html">Node.js</a><ul><li>Linux: <blockquote><div><em>Debian/Ubuntu</em>:<br><code>apt install nodejs</code><br>May need to be followed up by:<br><code>apt install npm</code></div><div><em>Arch Linux</em><br><code>yay -S tiddlywiki</code> <br>(installs node and tiddlywiki)</div></blockquote></li><li>Mac<blockquote><div><code>brew install node</code></div></blockquote></li><li>Android<blockquote><div><a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/Serving%2520TW5%2520from%2520Android.html">Termux for Android</a></div></blockquote></li><li>Other <blockquote><div>See <a class="tc-tiddlylink-external" href="http://nodejs.org" rel="noopener noreferrer" target="_blank">http://nodejs.org</a></div></blockquote></li></ul></li><li>Open a command line terminal and type:<blockquote><div><code>npm install -g tiddlywiki</code></div><div>If it fails with an error you may need to re-run the command as an administrator:</div><div><code>sudo npm install -g tiddlywiki</code> (Mac/Linux)</div></blockquote></li><li>Ensure TiddlyWiki is installed by typing:<blockquote><div><code>tiddlywiki --version</code></div></blockquote><ul><li>In response, you should see <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> report its current version (eg "5.3.8". You may also see other debugging information reported.)</li></ul></li><li>Try it out:<ol><li><code>tiddlywiki mynewwiki --init server</code> to create a folder for a new wiki that includes server-related components</li><li><code>tiddlywiki mynewwiki --listen</code> to start <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a></li><li>Visit <a class="tc-tiddlylink-external" href="http://127.0.0.1:8080/" rel="noopener noreferrer" target="_blank">http://127.0.0.1:8080/</a> in your browser</li><li>Try editing and creating tiddlers</li></ol></li><li>Optionally, make an offline copy:<ul><li>click the <span class="doc-icon"><svg class="tc-image-save-button-dynamic tc-image-button" height="22pt" viewBox="0 0 128 128" width="22pt">
|
||||
<h2 class="">User forums</h2><h3 class="">Talk TiddlyWiki</h3><p>As the official TiddlyWiki forum, Talk TiddlyWiki is a place to talk about TiddlyWiki: requests for help, <a class="tc-tiddlylink-external" href="https://talk.tiddlywiki.org/c/announcements/20" rel="noopener noreferrer" target="_blank">announcements</a> of new releases and plugins, debating new features, or just sharing experiences. You can participate via the associated website, or subscribe via email.</p><p><a class="tc-tiddlylink-external" href="https://talk.tiddlywiki.org/" rel="noopener noreferrer" target="_blank">https://talk.tiddlywiki.org/</a></p><h3 class="">Google Groups</h3><p>For the convenience of existing users, we also continue to operate the original TiddlyWiki group (hosted on Google Groups since 2005): <a class="tc-tiddlylink-external" href="https://groups.google.com/group/TiddlyWiki" rel="noopener noreferrer" target="_blank">https://groups.google.com/group/TiddlyWiki</a></p><h2 class="">Developer forums</h2><ul><li><a class="tc-tiddlylink-external" href="https://tiddlywiki.com/dev" rel="noopener noreferrer" target="_blank">tiddlywiki.com/dev</a> is the official developer documentation</li><li>Get involved in the <a class="tc-tiddlylink-external" href="https://github.com/TiddlyWiki/TiddlyWiki5" rel="noopener noreferrer" target="_blank">development on GitHub</a></li><li><a class="tc-tiddlylink-external" href="https://github.com/TiddlyWiki/TiddlyWiki5/discussions" rel="noopener noreferrer" target="_blank">GitHub Discussions</a> are for Q&A and open-ended discussion</li><li><a class="tc-tiddlylink-external" href="https://github.com/TiddlyWiki/TiddlyWiki5/issues" rel="noopener noreferrer" target="_blank">GitHub Issues</a> are for raising bug reports and proposing specific, actionable new ideas</li><li>See <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/Contributing.html">Contributing</a> for guidelines on how to contribute to the project.</li></ul><h2 class="">Other forums</h2><ul><li><a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> Subreddit: <a class="tc-tiddlylink-external" href="https://www.reddit.com/r/TiddlyWiki5/" rel="noopener noreferrer" target="_blank">/r/TiddlyWiki5</a></li><li>Chat on Discord at <a class="tc-tiddlylink-external" href="https://discord.gg/HFFZVQ8" rel="noopener noreferrer" target="_blank">https://discord.gg/HFFZVQ8</a></li></ul>
|
||||
</p><hr><h1 class="">Installing TiddlyWiki on Node.js</h1><p>TiddlyWiki is a <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/SingleFileApplication.html">SingleFileApplication</a>, which is easy to use. For advanced users and developers there is a possibility to use a Node.js client / server configuration. This configuration is also used to build the TiddlyWiki <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/SinglePageApplication.html">SinglePageApplication</a></p><ol><li>Install <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/Node.js.html">Node.js</a><ul><li>Linux: <blockquote><div><em>Debian/Ubuntu</em>:<br><code>apt install nodejs</code><br>May need to be followed up by:<br><code>apt install npm</code></div><div><em>Arch Linux</em><br><code>yay -S tiddlywiki</code> <br>(installs node and tiddlywiki)</div></blockquote></li><li>Mac<blockquote><div><code>brew install node</code></div></blockquote></li><li>Android<blockquote><div><a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/Serving%2520TW5%2520from%2520Android.html">Termux for Android</a></div></blockquote></li><li>Other <blockquote><div>See <a class="tc-tiddlylink-external" href="http://nodejs.org" rel="noopener noreferrer" target="_blank">http://nodejs.org</a></div></blockquote></li></ul></li><li>Open a command line terminal and type:<blockquote><div><code>npm install -g tiddlywiki</code></div><div>If it fails with an error you may need to re-run the command as an administrator:</div><div><code>sudo npm install -g tiddlywiki</code> (Mac/Linux)</div></blockquote></li><li>Ensure TiddlyWiki is installed by typing:<blockquote><div><code>tiddlywiki --version</code></div></blockquote><ul><li>In response, you should see <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a> report its current version (eg "5.4.0". You may also see other debugging information reported.)</li></ul></li><li>Try it out:<ol><li><code>tiddlywiki mynewwiki --init server</code> to create a folder for a new wiki that includes server-related components</li><li><code>tiddlywiki mynewwiki --listen</code> to start <a class="tc-tiddlylink tc-tiddlylink-resolves" href="https://tiddlywiki.com/static/TiddlyWiki.html">TiddlyWiki</a></li><li>Visit <a class="tc-tiddlylink-external" href="http://127.0.0.1:8080/" rel="noopener noreferrer" target="_blank">http://127.0.0.1:8080/</a> in your browser</li><li>Try editing and creating tiddlers</li></ol></li><li>Optionally, make an offline copy:<ul><li>click the <span class="doc-icon"><svg class="tc-image-save-button-dynamic tc-image-button" height="22pt" viewBox="0 0 128 128" width="22pt">
|
||||
<g class="tc-image-save-button-dynamic-clean">
|
||||
<path d="M120.783 34.33c4.641 8.862 7.266 18.948 7.266 29.646 0 35.347-28.653 64-64 64-35.346 0-64-28.653-64-64 0-35.346 28.654-64 64-64 18.808 0 35.72 8.113 47.43 21.03l2.68-2.68c3.13-3.13 8.197-3.132 11.321-.008 3.118 3.118 3.121 8.193-.007 11.32l-4.69 4.691zm-12.058 12.058a47.876 47.876 0 013.324 17.588c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48c14.39 0 27.3 6.332 36.098 16.362L58.941 73.544 41.976 56.578c-3.127-3.127-8.201-3.123-11.32-.005-3.123 3.124-3.119 8.194.006 11.319l22.617 22.617a7.992 7.992 0 005.659 2.347c2.05 0 4.101-.783 5.667-2.349l44.12-44.12z" fill-rule="evenodd"></path>
|
||||
</g>
|
||||
|
||||
Reference in New Issue
Block a user