1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-01-23 19:34:39 +00:00

Compare commits

..

5 Commits

Author SHA1 Message Date
Jeremy Ruston
7e76db15aa Merge branch 'master' into browser-messaging-saver 2025-10-29 14:50:42 +00:00
jeremy@jermolene.com
33d4e8ea26 Don't use a variable before it's defined... 2021-02-24 15:27:58 +00:00
jeremy@jermolene.com
f980d8a7b2 Merge branch 'master' into browser-messaging-saver 2021-02-22 23:10:20 +00:00
jeremy@jermolene.com
e31a201269 Subscriber: Make onmessage be async 2021-02-22 22:39:37 +00:00
jeremy@jermolene.com
58d291c116 First commit 2021-02-22 19:20:58 +00:00
156 changed files with 450 additions and 2708 deletions

View File

@@ -16,8 +16,12 @@ exports.json = function(source,operand,options) {
spaces = /^\d+$/.test(operand) ? parseInt(operand,10) : operand;
}
source(function(tiddler,title) {
var data = $tw.utils.parseJSONSafe(title,function(){return undefined;});
var data = $tw.utils.parseJSONSafe(title);
try {
data = JSON.parse(title);
} catch(e) {
data = undefined;
}
if(data !== undefined) {
results.push(JSON.stringify(data,null,spaces));
}

View File

@@ -22,7 +22,7 @@ Note that the syntax for comments is simplified to an opening "<!--" sequence an
"use strict";
exports.name = "commentblock";
exports.types = {block: true, pragma: true};
exports.types = {block:true, pragma:true};
exports.init = function(parser) {
this.parser = parser;
@@ -43,18 +43,9 @@ exports.findNextMatch = function(startPos) {
return undefined;
};
exports.parse = function() {
// Move past the match
this.parser.pos = this.endMatchRegExp.lastIndex;
// Return a node representing the comment that is not rendered
var commentStart = this.match.index;
var commentEnd = this.endMatch.index + this.endMatch[0].length;
return [{
type: "void",
children: [],
text: this.parser.source.slice(commentStart, commentEnd),
start: commentStart,
end: commentEnd
}];
// Don't return any elements
return [];
};

View File

@@ -40,13 +40,6 @@ exports.findNextMatch = function(startPos) {
exports.parse = function() {
// Move past the match
this.parser.pos = this.endMatchRegExp.lastIndex;
// Return a node representing the inline comment
var commentStart = this.match.index;
var commentEnd = this.endMatch.index + this.endMatch[0].length;
return [{
type: "void",
text: this.parser.source.slice(commentStart, commentEnd),
start: commentStart,
end: commentEnd
}];
// Don't return any elements
return [];
};

View File

@@ -28,11 +28,11 @@ exports.init = function(parser) {
exports.parse = function() {
// Move past the match
var start = this.parser.pos;
var start = this.parser.pos;
this.parser.pos = this.matchRegExp.lastIndex;
// Create the link unless it is suppressed
if(this.match[0].substr(0,1) === "~") {
return [{type: "text", text: this.match[0].substr(1), start: start, end: this.parser.pos}];
return [{type: "text", text: this.match[0].substr(1)}];
} else {
return [{
type: "element",

View File

@@ -6,15 +6,15 @@ module-type: wikirule
Wiki pragma rule for function, procedure and widget definitions
```
\function name(param:"defaultvalue", param2:"defaultvalue")
\function name(param:defaultvalue,param2:defaultvalue)
definition text
\end
\procedure name(param:"defaultvalue", param2:"defaultvalue")
\procedure name(param:defaultvalue,param2:defaultvalue)
definition text
\end
\widget $mywidget(param:"defaultvalue", param2:"defaultvalue")
\widget $mywidget(param:defaultvalue,param2:defaultvalue)
definition text
\end
```

View File

@@ -50,8 +50,6 @@ exports.parse = function() {
}
}
} while(match && !match[1]);
// Mark first and last node, and return the nodes
if(tree[0]) tree[0].isRuleStart = true;
if(tree[tree.length-1]) tree[tree.length-1].isRuleEnd = true;
// Return the nodes
return tree;
};

View File

@@ -41,7 +41,7 @@ Parse the most recent match
exports.parse = function() {
// Retrieve the most recent match so that recursive calls don't overwrite it
var tag = this.nextTag;
if(!tag.isSelfClosing) {
if (!tag.isSelfClosing) {
tag.openTagStart = tag.start;
tag.openTagEnd = tag.end;
}
@@ -63,22 +63,22 @@ exports.parse = function() {
}
tag.end = this.parser.pos;
tag.closeTagEnd = tag.end;
if(tag.closeTagEnd === tag.openTagEnd || this.parser.source[tag.closeTagEnd - 1] !== ">") {
if (tag.closeTagEnd === tag.openTagEnd || this.parser.source[tag.closeTagEnd - 1] !== '>') {
tag.closeTagStart = tag.end;
} else {
tag.closeTagStart = tag.closeTagEnd - 2;
var closeTagMinPos = tag.children.length > 0 ? tag.children[tag.children.length-1].end : tag.openTagEnd;
if(!Number.isSafeInteger(closeTagMinPos)) closeTagMinPos = tag.openTagEnd;
while(tag.closeTagStart >= closeTagMinPos) {
if (!Number.isSafeInteger(closeTagMinPos)) closeTagMinPos = tag.openTagEnd;
while (tag.closeTagStart >= closeTagMinPos) {
var char = this.parser.source[tag.closeTagStart];
if(char === ">") {
if (char === '>') {
tag.closeTagStart = -1;
break;
}
if(char === "<") break;
if (char === '<') break;
tag.closeTagStart -= 1;
}
if(tag.closeTagStart < closeTagMinPos) {
if (tag.closeTagStart < closeTagMinPos) {
tag.closeTagStart = tag.end;
}
}

View File

@@ -59,7 +59,6 @@ var listTypes = {
":": {listTag: "dl", itemTag: "dd"},
">": {listTag: "blockquote", itemTag: "div"}
};
exports.listTypes = listTypes;
/*
Parse the most recent match

View File

@@ -29,7 +29,7 @@ exports.findNextMatch = function(startPos) {
var c = this.parser.source.charAt(nextCall.end);
// Ensure EOL after parsed macro
// If we didn't need to support IE, we'd just use /(?:\r?\n|$)/ym
if((c === "") || (c === "\n") || ((c === "\r") && this.parser.source.charAt(nextCall.end+1) === "\n")) {
if ((c === "") || (c === "\n") || ((c === "\r") && this.parser.source.charAt(nextCall.end+1) === "\n")) {
this.nextCall = nextCall;
return nextStart;
}

View File

@@ -42,5 +42,3 @@ exports.parse = function() {
this.parser.pos = call.end;
return [call];
};

View File

@@ -52,10 +52,9 @@ exports.parse = function() {
}
}
// Is the remainder of the \define line blank after the parameter close paren?
var reEnd,isBlock = true;
var reEnd;
if(this.match[3]) {
// If so, it is a multiline definition and the end of the body is marked with \end
isBlock = false;
reEnd = new RegExp("((?:^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?\\s*?(?:$|\\r?\\n))","mg");
} else {
// Otherwise, the end of the definition is marked by the end of the line
@@ -80,8 +79,7 @@ exports.parse = function() {
attributes: {},
children: [],
params: params,
isMacroDefinition: true,
isBlock: isBlock && !!endMatch
isMacroDefinition: true
}];
$tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],"name",this.match[1]);
$tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],"value",text);

View File

@@ -31,7 +31,6 @@ Parse the most recent match
*/
exports.parse = function() {
// Move past the pragma invocation
var start = this.parser.pos;
this.parser.pos = this.matchRegExp.lastIndex;
// Parse whitespace delimited tokens terminated by a line break
var reMatch = /[^\S\n]*(\S+)|(\r?\n)/mg,
@@ -59,11 +58,6 @@ exports.parse = function() {
this.parser.parseAsInline = true;
}
}
return [{
type: "void",
children: [],
parseAsInline: this.parser.parseAsInline,
start: start,
end: this.parser.pos
}];
// No parse tree nodes to return
return [];
};

View File

@@ -113,5 +113,3 @@ exports.parseLink = function(source,pos) {
node.end = closePos + 2;
return node;
};

View File

@@ -32,7 +32,7 @@ exports.parse = function() {
var text = this.match[1],
link = this.match[2] || text,
textEndPos = this.parser.source.indexOf("|", start);
if(textEndPos < 0 || textEndPos > this.matchRegExp.lastIndex) {
if (textEndPos < 0 || textEndPos > this.matchRegExp.lastIndex) {
textEndPos = this.matchRegExp.lastIndex - 2;
}
var linkStart = this.match[2] ? (start + this.match[1].length + 1) : start;

View File

@@ -54,13 +54,6 @@ exports.parse = function() {
if(tokens.length > 0) {
this.parser.amendRules(tokens[0],tokens.slice(1));
}
// No widget to render, return void node.
return [{
type: "void",
attributes: {
action: {type: "string", value: tokens[0]},
rules: {type: "string", value: tokens.slice(1).join(" ")}
},
children: []
}];
// No parse tree nodes to return
return [];
};

View File

@@ -64,8 +64,5 @@ exports.parse = function() {
$tw.utils.addAttributeToParseTreeNode(tree[t],"style",styles.join(""));
}
}
return [{
type: "void",
children: tree
}]
return tree;
};

View File

@@ -21,7 +21,7 @@ exports.types = {inline: true};
exports.init = function(parser) {
this.parser = parser;
// Regexp to match /@@(styles)?\s*(\.class\s+)?/
// Regexp to match
this.matchRegExp = /@@((?:[^\.\r\n\s:]+:[^\r\n;]+;)+)?(\.(?:[^\r\n\s]+)\s+)?/mg;
};

View File

@@ -60,37 +60,22 @@ exports.parse = function() {
var parser = this.parser.wiki.parseText(parseType,text,{defaultType: "text/plain"});
// If there's no render type, just return the parse tree
if(!renderType) {
return [{
type: "void",
children: $tw.utils.isArray(parser.tree) ? parser.tree : [parser.tree],
parseType: parseType,
renderType: renderType,
text: text,
start: start,
end: this.parser.pos
}];
return parser.tree;
} else {
// Otherwise, render to the rendertype and return in a <PRE> tag
var widgetNode = this.parser.wiki.makeWidget(parser),
container = $tw.fakeDocument.createElement("div");
widgetNode.render(container,null);
var renderResult = renderType === "text/html" ? container.innerHTML : container.textContent;
// Use void node to carry important info for typedblock
text = renderType === "text/html" ? container.innerHTML : container.textContent;
return [{
type: "void",
type: "element",
tag: "pre",
children: [{
type: "element",
tag: "pre",
children: [{
type: "text",
text: renderResult,
}]
}],
parseType: parseType,
renderType: renderType,
text: text,
start: start,
end: this.parser.pos
type: "text",
text: text,
start: start,
end: this.parser.pos
}]
}];
}
};

View File

@@ -215,8 +215,8 @@ WikiParser.prototype.parsePragmas = function() {
var subTree = nextMatch.rule.parse();
if(subTree.length > 0) {
// Set the start and end positions of the pragma rule if
if(subTree[0].start === undefined) subTree[0].start = start;
if(subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
if (subTree[0].start === undefined) subTree[0].start = start;
if (subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
$tw.utils.each(subTree, function (node) { node.rule = nextMatch.rule.name; });
// Quick hack; we only cope with a single parse tree node being returned, which is true at the moment
currentTreeBranch.push.apply(currentTreeBranch,subTree);
@@ -245,9 +245,9 @@ WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
var start = this.pos;
var subTree = nextMatch.rule.parse();
// Set the start and end positions of the first and last blocks if they're not already set
if(subTree.length > 0) {
if(subTree[0].start === undefined) subTree[0].start = start;
if(subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
if (subTree.length > 0) {
if (subTree[0].start === undefined) subTree[0].start = start;
if (subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
}
$tw.utils.each(subTree, function (node) { node.rule = nextMatch.rule.name; });
return subTree;
@@ -256,7 +256,7 @@ WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
var start = this.pos;
var children = this.parseInlineRun(terminatorRegExp);
var end = this.pos;
return [{type: "element", tag: "p", children: children, start: start, end: end, rule: "parseblock" }];
return [{type: "element", tag: "p", children: children, start: start, end: end }];
};
/*
@@ -350,10 +350,10 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
var start = this.pos;
var subTree = nextMatch.rule.parse();
// Set the start and end positions of the first and last child if they're not already set
if(subTree.length > 0) {
if (subTree.length > 0) {
// Set the start and end positions of the first and last child if they're not already set
if(subTree[0].start === undefined) subTree[0].start = start;
if(subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
if (subTree[0].start === undefined) subTree[0].start = start;
if (subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
}
$tw.utils.each(subTree, function (node) { node.rule = nextMatch.rule.name; });
tree.push.apply(tree,subTree);
@@ -410,9 +410,9 @@ WikiParser.prototype.parseInlineRunTerminatedExtended = function(terminatorRegEx
var start = this.pos;
var subTree = inlineRuleMatch.rule.parse();
// Set the start and end positions of the first and last child if they're not already set
if(subTree.length > 0) {
if(subTree[0].start === undefined) subTree[0].start = start;
if(subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
if (subTree.length > 0) {
if (subTree[0].start === undefined) subTree[0].start = start;
if (subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
}
$tw.utils.each(subTree, function (node) { node.rule = inlineRuleMatch.rule.name; });
tree.push.apply(tree,subTree);

View File

@@ -119,19 +119,3 @@ exports.getParseTreeText = function getParseTreeText(tree) {
}
return output.join("");
};
exports.getParser = function(type,options) {
options = options || {};
// Select a parser
var Parser = $tw.Wiki.parsers[type];
if(!Parser && $tw.utils.getFileExtensionInfo(type)) {
Parser = $tw.Wiki.parsers[$tw.utils.getFileExtensionInfo(type).type];
}
if(!Parser) {
Parser = $tw.Wiki.parsers[options.defaultType || "text/vnd.tiddlywiki"];
}
if(!Parser) {
return null;
}
return Parser;
};

View File

@@ -49,8 +49,7 @@ ImportVariablesWidget.prototype.execute = function(tiddlerList) {
var parser = widgetPointer.wiki.parseTiddler(title,{parseAsInline:true, configTrimWhiteSpace:false});
if(parser) {
var parseTreeNode = parser.tree[0];
// process AST nodes generated by pragma rules.
while(parseTreeNode && ["setvariable","set","parameters","void"].indexOf(parseTreeNode.type) !== -1) {
while(parseTreeNode && ["setvariable","set","parameters"].indexOf(parseTreeNode.type) !== -1) {
var node = {
type: "set",
attributes: parseTreeNode.attributes,
@@ -83,7 +82,7 @@ ImportVariablesWidget.prototype.execute = function(tiddlerList) {
// this widget. If it needs to refresh,
// it'll do so along with the the whole
// importvariable tree.
if(widgetPointer != this) {
if (widgetPointer != this) {
widgetPointer.makeChildWidgets = function(){};
}
widgetPointer = widgetPointer.children[0];
@@ -94,7 +93,7 @@ ImportVariablesWidget.prototype.execute = function(tiddlerList) {
}
});
if(widgetPointer != this) {
if (widgetPointer != this) {
widgetPointer.parseTreeNode.children = this.parseTreeNode.children;
} else {
widgetPointer.makeChildWidgets();

View File

@@ -1,23 +0,0 @@
/*\
title: $:/core/modules/widgets/void.js
type: application/javascript
module-type: widget
Void widget that corresponds to pragma and comment AST nodes, etc. It does not render itself but renders all its children.
\*/
"use strict";
var Widget = require("$:/core/modules/widgets/widget.js").widget;
var VoidNodeWidget = function(parseTreeNode,options) {
this.initialise(parseTreeNode,options);
};
/*
Inherit from the base widget class
*/
VoidNodeWidget.prototype = new Widget();
exports.void = VoidNodeWidget;

View File

@@ -1059,7 +1059,17 @@ Options include:
exports.parseText = function(type,text,options) {
text = text || "";
options = options || {};
var Parser = $tw.utils.getParser(type,options)
// Select a parser
var Parser = $tw.Wiki.parsers[type];
if(!Parser && $tw.utils.getFileExtensionInfo(type)) {
Parser = $tw.Wiki.parsers[$tw.utils.getFileExtensionInfo(type).type];
}
if(!Parser) {
Parser = $tw.Wiki.parsers[options.defaultType || "text/vnd.tiddlywiki"];
}
if(!Parser) {
return null;
}
// Return the parser instance
return new Parser(type,text,{
parseAsInline: options.parseAsInline,
@@ -1073,7 +1083,7 @@ exports.parseText = function(type,text,options) {
Parse a tiddler according to its MIME type
*/
exports.parseTiddler = function(title,options) {
options = options || {};
options = $tw.utils.extend({},options);
var cacheType = options.parseAsInline ? "inlineParseTree" : "blockParseTree",
tiddler = this.getTiddler(title),
self = this;

View File

@@ -3,26 +3,27 @@ tags: $:/tags/ControlPanel/Appearance
caption: {{$:/language/ControlPanel/LayoutSwitcher/Caption}}
\whitespace trim
\function layout.filter() [all[current]field:title[$:/core/ui/PageTemplate]]
\function layout.empty.filter() [all[current]field:title{$:/layout}]
<$linkcatcher to="$:/layout">
<div class="tc-chooser" role="listbox">
<div class="tc-chooser">
<$list filter="[all[tiddlers+shadows]tag[$:/tags/Layout]] [[$:/core/ui/PageTemplate]] +[!is[draft]sort[name]]">
<$list filter="[{$:/layout}!has[text]]" variable="ignore">
<$list-empty>
<div class={{{ [layout.empty.filter[]then[tc-chooser-item tc-chosen]else[tc-chooser-item]] }}}>
<$link to={{!!title}} role="option" aria-selected={{{ [layout.empty.filter[]then[true]else[false]] }}}>
''<$transclude tiddler={{{ [<currentTiddler>get[icon]] }}}/><$transclude field="name"/>''&#32;-&#32;<$transclude field="description"/>
</$link>
</div>
</$list-empty>
<div class={{{ [layout.filter[]then[tc-chooser-item tc-chosen]else[tc-chooser-item]] }}}>
<$link to={{!!title}} role="option" aria-selected={{{ [layout.filter[]then[true]else[false]] }}}>
''<$transclude tiddler={{{ [<currentTiddler>get[icon]] }}}/><$transclude field="name"/>''&#32;-&#32;<$transclude field="description"/>
</$link>
</div>
</$list>
<$list
filter="[{$:/layout}!has[text]]"
variable="ignore"
emptyMessage="""\whitespace trim
<$set name="cls" filter="[all[current]field:title{$:/layout}]" value="tc-chooser-item tc-chosen" emptyValue="tc-chooser-item">
<div class=<<cls>>>
<$link to={{!!title}}>
''<$transclude tiddler={{{ [<currentTiddler>get[icon]] }}}/><$transclude field="name"/>''&#32;-&#32;<$transclude field="description"/>
</$link></div></$set>
""">
<$set name="cls" filter="[all[current]field:title[$:/core/ui/PageTemplate]]" value="tc-chooser-item tc-chosen" emptyValue="tc-chooser-item">
<div class=<<cls>>>
<$link to={{!!title}}>
''<$transclude tiddler={{{ [<currentTiddler>get[icon]] }}}/><$transclude field="name"/>''&#32;-&#32;<$transclude field="description"/>
</$link>
</div>
</$set>
</$list>
</$list>
</div>
</$linkcatcher>

View File

@@ -1,20 +1,20 @@
title: $:/snippets/languageswitcher
\whitespace trim
\function language.filter() [all[current]field:title{$:/language}]
<$linkcatcher to="$:/language">
<div class="tc-chooser tc-language-chooser" role="listbox">
<div class="tc-chooser tc-language-chooser">
<$list filter="[[$:/languages/en-GB]] [plugin-type[language]sort[description]]">
<div class={{{ [language.filter[]then[tc-chooser-item tc-chosen]else[tc-chooser-item]] }}} lang={{!!name}}>
<$link role="option" aria-selected={{{ [language.filter[]then[true]else[false]] }}}>
<$view field="description">
<$view field="name">
<$view field="title"/>
</$view>
</$view>
</$link>
</div>
<$set name="cls" filter="[all[current]field:title{$:/language}]" value="tc-chooser-item tc-chosen" emptyValue="tc-chooser-item">
<div class=<<cls>> lang={{!!name}}>
<$link>
<$view field="description">
<$view field="name">
<$view field="title"/>
</$view>
</$view>
</$link>
</div>
</$set>
</$list>
</div>
</$linkcatcher>

View File

@@ -1,18 +1,17 @@
title: $:/snippets/themeswitcher
\whitespace trim
\function theme.filter() [all[current]field:title{$:/theme}] [[$:/theme]!has[text]addsuffix[s/tiddlywiki/vanilla]field:title<currentTiddler>] +[limit[1]]
<$linkcatcher to="$:/theme">
<div class="tc-chooser" role="listbox">
<div class="tc-chooser">
<$list filter="[plugin-type[theme]sort[title]]">
<div class={{{ [theme.filter[]then[tc-chooser-item tc-chosen]else[tc-chooser-item]] }}}>
<$link to={{!!title}} role="option" aria-selected={{{ [theme.filter[]then[true]else[false]] }}}>
''<$view field="name" format="text"/>''
&#32;
<$view field="description" format="text"/>
</$link>
</div>
<$set name="cls" filter="[all[current]field:title{$:/theme}] [[$:/theme]!has[text]addsuffix[s/tiddlywiki/vanilla]field:title<currentTiddler>] +[limit[1]]" value="tc-chooser-item tc-chosen" emptyValue="tc-chooser-item">
<div class=<<cls>>><$link to={{!!title}}>
''<$view field="name" format="text"/>''
&#32;
<$view field="description" format="text"/>
</$link>
</div>
</$set>
</$list>
</div>
</$linkcatcher>

View File

@@ -4,14 +4,13 @@ title: $:/snippets/viewswitcher
$:/core/images/storyview-$(storyview)$
\end
\whitespace trim
\function view.filter() [<storyview>prefix{$:/view}]
<$linkcatcher to="$:/view">
<div class="tc-chooser tc-viewswitcher" role="listbox">
<div class="tc-chooser tc-viewswitcher">
<$list filter="[storyviews[]]" variable="storyview">
<div class={{{ [view.filter[]then[tc-chooser-item tc-chosen]else[tc-chooser-item]] }}}>
<$button tag="a" class="tc-tiddlylink tc-btn-invisible" role="option" to=<<storyview>> aria-selected={{{ [view.filter[]then[true]else[false]] }}}><$transclude tiddler=<<icon>>/><$text text=<<storyview>>/></$button>
<$set name="cls" filter="[<storyview>prefix{$:/view}]" value="tc-chooser-item tc-chosen" emptyValue="tc-chooser-item"><div class=<<cls>>>
<$button tag="a" class="tc-tiddlylink tc-btn-invisible" to=<<storyview>>><$transclude tiddler=<<icon>>/><$text text=<<storyview>>/></$button>
</div>
</$set>
</$list>
</div>
</$linkcatcher>

View File

@@ -1,9 +1,9 @@
{
"tiddlers": [
{
"file": "../../../tw5.com/tiddlers/images/New Release Banner.webp",
"file": "../../../tw5.com/tiddlers/images/New Release Banner.png",
"fields": {
"type": "image/webp",
"type": "image/jpeg",
"title": "New Release Banner",
"tags": "picture"
}

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/Attribute
type: text/vnd.tiddlywiki
<$macrocall $name="rpn" a=<<rpn 2 2 *>> b="pi" operation="*" decimals="4"/>

View File

@@ -1,7 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/BlockRule
type: text/vnd.tiddlywiki
The speed of sound
The light of speed

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/BoldEmphasis
type: text/vnd.tiddlywiki
This is ''bold'' text

View File

@@ -1,17 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/CodeBlock
type: text/vnd.tiddlywiki
Simple `JS` and complex
---
```js
var match = reEnd.exec(this.parser.source)
```
```tid
<$list filter="[tag[ExampleTag]sort[title]]"/>
```
end

View File

@@ -1,11 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/CommentBlock
type: text/vnd.tiddlywiki
<!-- This is a comment -->
Some text
<!-- Another comment -->
More text

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/CommentInline
type: text/vnd.tiddlywiki
This is some text with an inline comment <!-- This is a comment --> and some more text.

View File

@@ -1,21 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/Conditional
type: text/vnd.tiddlywiki
This is a <%if [{something}] %>Elephant<%elseif [{else}] %>Pelican<%else%>Crocodile<%endif%> <%if [{something}] %>Elephant<%else%>Crocodile<%endif%>
<%if [{$:/info/url/protocol}match[file:]]%>
Loaded from a file URI
<%elseif [{$:/info/url/protocol}match[https:]]%>
Loaded from an HTTPS URI
<%elseif [{$:/info/url/protocol}match[http:]]%>
Loaded from an HTTP URI
<%else%>
Loaded from an unknown protocol
<%endif%>
Plain text in next paragraph.
<%if [{$:/info/url/protocol}match[file:]]%>
Hidden.
<%endif%>

View File

@@ -1,7 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/Dash
type: text/vnd.tiddlywiki
This is an en-dash: --
This is an em-dash: ---

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/Entity
type: text/vnd.tiddlywiki
This is a copyright symbol: &copy;

View File

@@ -1,7 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/ExtLink
type: text/vnd.tiddlywiki
An external link: https://www.tiddlywiki.com/
A suppressed external link: ~http://www.tiddlyspace.com/

View File

@@ -1,13 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/FilteredTranscludeBlock
type: text/vnd.tiddlywiki
{{{ [tag[docs]] }}}
{{{ [tag[docs]] |tooltip}}}
{{{ [tag[docs]] ||TemplateTitle}}}
{{{ [tag[docs]] |tooltip||TemplateTitle}}}
{{{ [tag[docs]] }}width:40;height:50;}.class.class

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/FilteredTranscludeInline
type: text/vnd.tiddlywiki
{{{ [tag[docs]] }}} {{{ [tag[docs]] |tooltip}}} {{{ [tag[docs]] ||TemplateTitle}}} {{{ [tag[docs]] |tooltip||TemplateTitle}}} {{{ [tag[docs]] }}width:40;height:50;}.class.class

View File

@@ -1,15 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/FunctionDefinition
type: text/vnd.tiddlywiki
\function name(param:"defaultvalue", param2:"defaultvalue")
definition text
\end
\procedure name(param:"defaultvalue", param2:"defaultvalue")
definition text
\end
\widget $mywidget(param:"defaultvalue", param2:"defaultvalue")
definition text
\end

View File

@@ -1,12 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/HardLineBreaks
type: text/vnd.tiddlywiki
"""
This is some text
That is set like
It is a Poem
When it is
Clearly
Not
"""

View File

@@ -1,29 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/Heading
type: text/vnd.tiddlywiki
! Heading 1
!! Heading 2
!!! Heading 3
!!!! Heading 4
!!!!! Heading 5
!!!!!! Heading 6
! AAA
!! AAA
!!! AAA
!!!! AAA
!!!!! AAA
!!!!!! AAA
AAA

View File

@@ -1,15 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/Html
type: text/vnd.tiddlywiki
<aside>
This is an HTML5 aside element
</aside>
<$slider target="MyTiddler">
This is a widget invocation
</$slider>
<$list filter="[tag[ExampleTag]sort[title]]"/>
Plain text in next paragraph.

View File

@@ -1,10 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/Image
type: text/vnd.tiddlywiki
[img[https://tiddlywiki.com/fractalveg.jpg]]
[img width="23" height="24" [https://tiddlywiki.com/fractalveg.jpg]]
[img width={{!!width}} height={{!!height}} [https://tiddlywiki.com/fractalveg.jpg]]
[img[Description of image|https://tiddlywiki.com/fractalveg.jpg]]
[img[TiddlerTitle]]
[img[Description of image|TiddlerTitle]]

View File

@@ -1,6 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/Import
type: text/vnd.tiddlywiki
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
\import [[$:/core/ui/PageMacros]]

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/ItalicEmphasis
type: text/vnd.tiddlywiki
This is //italic// text

View File

@@ -1,40 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/List
type: text/vnd.tiddlywiki
* This is an unordered list
* It has two items
# This is a numbered list
## With a subitem
# And a third item
; This is a term that is being defined
: This is the definition of that term
#** One
#* Two
#** Three
#**** Four
#**# Five
#**## Six
## Seven
### Eight
## Nine
* List item one
*.active List item two has the class `active`
* List item three
# AAA
## [[BBB]]
### CCC
# AAA
## CCC
## DDD
## EEE
# BBB
## FF `/` FFF
## FFF
## GGG
##

View File

@@ -1,9 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/MacroCallBlock
type: text/vnd.tiddlywiki
<<name "value" "value2">>
<<.def "macro calls">>
<<alert "primary" "primary alert" width:"60%">>

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/MacroCallInline
type: text/vnd.tiddlywiki
These are macro calls in a line: <<name "value" "value2">> and <<.def "macro calls">> <<alert "primary" "primary alert" width:"60%">>

View File

@@ -1,9 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/MacroDef
type: text/vnd.tiddlywiki
\define name(param:defaultvalue,param2:defaultvalue)
definition text, including $param$ markers
\end
\define lingo-base() $:/language/ControlPanel/Basics/

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/Parameters
type: text/vnd.tiddlywiki
\parameters(param:defaultvalue,param2:defaultvalue)

View File

@@ -1,9 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/ParserMode
type: text/vnd.tiddlywiki
\parsermode block
\parsermode inline
Test.

View File

@@ -1,6 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/PrettyExtLink
type: text/vnd.tiddlywiki
[ext[https://tiddlywiki.com/fractalveg.jpg]]
[ext[Tooltip|https://tiddlywiki.com/fractalveg.jpg]]

View File

@@ -1,6 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/PrettyLink
type: text/vnd.tiddlywiki
[[Introduction]]
[[Link description|TiddlerTitle]]

View File

@@ -1,7 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/QuoteBlock
type: text/vnd.tiddlywiki
<<<tc-quote
Quote text
<<<

View File

@@ -1,6 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/RulesPragma
type: text/vnd.tiddlywiki
\rules except ruleone ruletwo rulethree
\rules only ruleone ruletwo rulethree

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/SimpleText
type: text/vnd.tiddlywiki
The quick brown fox

View File

@@ -1,6 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/SoftLineBreak
type: text/vnd.tiddlywiki
The rain in Spain
falls mainly on the plain

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/StrikethroughEmphasis
type: text/vnd.tiddlywiki
This is ~~strikethrough~~ text

View File

@@ -1,17 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/StyleBlock
type: text/vnd.tiddlywiki
@@background-color:red;
@@.myClass
This paragraph will have the CSS class `myClass`.
* The `<ul>` around this list will also have the class `myClass`
* List item 2
@@
@@font-size:1.5em;
@@.coloured-text.coloured-bg
* Block content
* With custom style and classes
@@

View File

@@ -1,13 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/StyleBlock2
type: text/vnd.tiddlywiki
@@width:100px;
@@.myFirstClass.mySecondClass.myThirdClass
This is a paragraph
@@
@@background-color:lightcyan;
* Item one
* Item two
@@

View File

@@ -1,7 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/StyleInline
type: text/vnd.tiddlywiki
@@.myClass This is some text with a class@@
@@background-color:red; This is some text with a background colour@@
@@width:100px;.myClass This is some text with a class and a width@@

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/SubscriptEmphasis
type: text/vnd.tiddlywiki
This is ,,subscript,, text

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/SuperscriptEmphasis
type: text/vnd.tiddlywiki
This is ^^superscript^^ text

View File

@@ -1,6 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/SysLink
type: text/vnd.tiddlywiki
$:TiddlerTitle
~$:TiddlerTitle

View File

@@ -1,11 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/Table
type: text/vnd.tiddlywiki
|!|!Alpha|!Beta|!Gamma|!Delta|
|!One|||||
|!Two|||||
|!Three|||||
|cell one|cell two|
|cell three|cell four|

View File

@@ -1,21 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/TranscludeBlock
type: text/vnd.tiddlywiki
{{MyTiddler}}
{{MyTiddler||TemplateTitle}}
{{||TemplateTitle}}
{{MyTiddler|Parameter}}
{{MyTiddler||TemplateTitle|Parameter|SecondParameter}}
{{MyTiddler!!field}}
{{!!field}}
{{MyTiddler##index}}
{{##index}}

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/TranscludeInline
type: text/vnd.tiddlywiki
{{MyTiddler}} {{MyTiddler||TemplateTitle}}

View File

@@ -1,15 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/TypedBlock1
type: text/vnd.tiddlywiki
$$$text/vnd.tiddlywiki > text/plain
This is ''some'' wikitext
$$$
$$$text/unknown
Some plain text, which will not be //formatted//.
$$$text/vnd.tiddlywiki > text/html
This is ''some'' wikitext
$$$

View File

@@ -1,19 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/TypedBlock2
type: text/vnd.tiddlywiki
$$$.js
This will be rendered as JavaScript
$$$
$$$.svg
<svg xmlns="http://www.w3.org/2000/svg" width="150" height="100">
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red" />
</svg>
$$$
$$$image/svg+xml
<svg xmlns="http://www.w3.org/2000/svg" width="150" height="100">
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="green" />
</svg>
$$$

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/UnderscoreEmphasis
type: text/vnd.tiddlywiki
This is __underscore__ text

View File

@@ -1,7 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/WikiLink
type: text/vnd.tiddlywiki
AWikiLink
AnotherLink
~SuppressedLink

View File

@@ -1,5 +0,0 @@
tags: $:/tags/wikitext-serialize-test-spec
title: Serialize/WikiLinkPrefix
type: text/vnd.tiddlywiki
~SuppressedLink

View File

@@ -26,4 +26,4 @@ title: TiddlerOne
+
title: ExpectedResult
<p>[{"type":"element","tag":"p","children":[{"type":"text","text":"This is a block","start":68,"end":83}],"start":68,"end":83,"rule":"parseblock"}]</p><p>[{"type":"text","text":"This is inline","start":136,"end":152}]</p>
<p>[{"type":"element","tag":"p","children":[{"type":"text","text":"This is a block","start":68,"end":83}],"start":68,"end":83}]</p><p>[{"type":"text","text":"This is inline","start":136,"end":152}]</p>

View File

@@ -29,11 +29,11 @@ Tests deserialize[] filter operator with various core deserializers
expect($tw.wiki.filterTiddlers("[{dezerializer test data case 5}deserialize[text/html]]")).toEqual(['[{"type":"text/vnd.tiddlywiki","text":"Abacus","title":"Hello \\"There\\""},{"title":"Hello \\"There\\"","text":"Calculator"},{"title":"Hello \\"There\\"","text":"Protractor"}]']);
// Deserialize JSON payload containing tiddlers
expect($tw.wiki.filterTiddlers("[{dezerializer test data case 6}deserialize[application/json]]")).toEqual( [ "[{\"created\":\"20230601125557184\",\"text\":\"Before you start storing important information in ~TiddlyWiki it is vital to make sure that you can reliably save changes. See https://tiddlywiki.com/#GettingStarted for details\\n\\n\",\"title\":\"GettingStarted\",\"modified\":\"20230601125601619\"},{\"created\":\"20230601125507054\",\"text\":\"Welcome to \\\"TiddlyWiki\\\".\\n\\nThis is a test tiddler.\",\"tags\":\"\",\"title\":\"Hello There \\\"Welcome\\\"\",\"modified\":\"20230601125551144\"},{\"title\":\"TiddlyWiki\",\"created\":\"20130822170700000\",\"modified\":\"20170127221451610\",\"tags\":\"Concepts\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"~TiddlyWiki is a rich, interactive tool for manipulating complex data with structure that doesn't easily fit into conventional tools like spreadsheets or wordprocessors.\\n\\n~TiddlyWiki is designed to fit around your brain, helping you deal with the things that won't fit.\"}]" ]);
expect($tw.wiki.filterTiddlers("[{dezerializer test data case 6}deserialize[application/json]jsonindexes[]] :map[{dezerializer test data case 6}jsonget<currentTiddler>,[title]]")).toEqual([ "GettingStarted", 'Hello There "Welcome"', "TiddlyWiki" ]);
expect($tw.wiki.filterTiddlers("[{dezerializer test data case 6}deserialize[application/json]]")).toEqual( [ `[{"created":"20230601125557184","text":"Before you start storing important information in ~TiddlyWiki it is vital to make sure that you can reliably save changes. See https://tiddlywiki.com/#GettingStarted for details\\n\\n","title":"GettingStarted","modified":"20230601125601619"},{"created":"20230601125507054","text":"Welcome to \\"TiddlyWiki\\".\\n\\nThis is a test tiddler.","tags":"","title":"Hello There \\"Welcome\\"","modified":"20230601125551144"},{"title":"TiddlyWiki","created":"20130822170700000","modified":"20170127221451610","tags":"Concepts","type":"text/vnd.tiddlywiki","text":"~TiddlyWiki is a rich, interactive tool for manipulating complex data with structure that doesn't easily fit into conventional tools like spreadsheets or wordprocessors.\\n\\n~TiddlyWiki is designed to fit around your brain, helping you deal with the things that won't fit."}]` ]);
expect($tw.wiki.filterTiddlers("[{dezerializer test data case 6}deserialize[application/json]jsonindexes[]] :map[{dezerializer test data case 6}jsonget<currentTiddler>,[title]]")).toEqual([ 'GettingStarted', 'Hello There "Welcome"', 'TiddlyWiki' ]);
//Deserialize TiddlyWiki file with an mismatched deserializer
expect($tw.wiki.filterTiddlers("[{dezerializer test data case 5}deserialize[application/json]]")).toEqual([jasmine.stringMatching("JSON error")]);
expect($tw.wiki.filterTiddlers("[{dezerializer test data case 5}deserialize[application/json]]")).toEqual([jasmine.stringMatching('JSON error')]);
});
});

View File

@@ -22,14 +22,14 @@ Tests various core deserializers
});
}
executeTestCase("dezerializer test data case 1",[ { text: "<!doctype html>\n", type: "text/html" } ]);
executeTestCase("dezerializer test data case 1",[ { text: '<!doctype html>\n', type: 'text/html' } ]);
executeTestCase("dezerializer test data case 2",[ { text: '<!doctype html>\n<html lang="en">\n<head>\n\t<meta charset="utf-8">\n\t<title>Test Data</title>\n</head>\n<body>\n</body>\n</html>\n', type: "text/html" } ]);
executeTestCase("dezerializer test data case 2",[ { text: '<!doctype html>\n<html lang="en">\n<head>\n\t<meta charset="utf-8">\n\t<title>Test Data</title>\n</head>\n<body>\n</body>\n</html>\n', type: 'text/html' } ]);
executeTestCase("dezerializer test data case 3",[ { title: 'Hello "There"', text: "Abacus", type: "text/vnd.tiddlywiki" } ]);
executeTestCase("dezerializer test data case 3",[ { title: 'Hello "There"', text: 'Abacus', type: 'text/vnd.tiddlywiki' } ]);
executeTestCase("dezerializer test data case 4",[ { title: 'Hello "There"', text: "Abacus", type: "text/vnd.tiddlywiki" }, { title: 'Hello "There"', text: "Calculator"} ]);
executeTestCase("dezerializer test data case 4",[ { title: 'Hello "There"', text: 'Abacus', type: 'text/vnd.tiddlywiki' }, { title: 'Hello "There"', text: 'Calculator'} ]);
executeTestCase("dezerializer test data case 5",[ { title: 'Hello "There"', text: "Abacus", type: "text/vnd.tiddlywiki" }, { title: 'Hello "There"', text: "Calculator"} , { title: 'Hello "There"', text: "Protractor"} ]);
executeTestCase("dezerializer test data case 5",[ { title: 'Hello "There"', text: 'Abacus', type: 'text/vnd.tiddlywiki' }, { title: 'Hello "There"', text: 'Calculator'} , { title: 'Hello "There"', text: 'Protractor'} ]);
});

View File

@@ -24,7 +24,7 @@ describe("HTML tag new parser tests", function() {
null
);
expect($tw.utils.parseWhiteSpace("p ",1)).toEqual(
{ type : "whitespace", start : 1, end : 3 }
{ type : 'whitespace', start : 1, end : 3 }
);
});
@@ -33,7 +33,7 @@ describe("HTML tag new parser tests", function() {
null
);
expect($tw.utils.parseTokenString("p= ",1,"=")).toEqual(
{ type : "token", value : "=", start : 1, end : 2 }
{ type : 'token', value : '=', start : 1, end : 2 }
);
});
@@ -42,10 +42,10 @@ describe("HTML tag new parser tests", function() {
null
);
expect($tw.utils.parseTokenRegExp("p=' ",1,/(=(?:'|"))/g).match[0]).toEqual(
"='"
'=\''
);
expect($tw.utils.parseTokenRegExp("p=blah ",2,/([^\s>]+)/g).match[0]).toEqual(
"blah"
'blah'
);
});
@@ -54,40 +54,40 @@ describe("HTML tag new parser tests", function() {
null
);
expect($tw.utils.parseStringLiteral("p='blah' ",2)).toEqual(
{ type : "string", start : 2, value : "blah", end : 8 }
{ type : 'string', start : 2, value : 'blah', end : 8 }
);
expect($tw.utils.parseStringLiteral("p='' ",2)).toEqual(
{ type : "string", start : 2, value : "", end : 4 }
{ type : 'string', start : 2, value : '', end : 4 }
);
expect($tw.utils.parseStringLiteral("p=\"blah' ",2)).toEqual(
null
);
expect($tw.utils.parseStringLiteral("p=\"\" ",2)).toEqual(
{ type : "string", start : 2, value : "", end : 4 }
{ type : 'string', start : 2, value : '', end : 4 }
);
});
it("should parse macro parameters", function() {
expect($tw.utils.parseMacroParameter("me",0)).toEqual(
{ type : "macro-parameter", start : 0, value : "me", end : 2 }
{ type : 'macro-parameter', start : 0, value : 'me', end : 2 }
);
expect($tw.utils.parseMacroParameter("me:one",0)).toEqual(
{ type : "macro-parameter", start : 0, value : "one", name : "me", end : 6 }
{ type : 'macro-parameter', start : 0, value : 'one', name : 'me', end : 6 }
);
expect($tw.utils.parseMacroParameter("me:'one two three'",0)).toEqual(
{ type : "macro-parameter", start : 0, value : "one two three", name : "me", end : 18 }
{ type : 'macro-parameter', start : 0, value : 'one two three', name : 'me', end : 18 }
);
expect($tw.utils.parseMacroParameter("'one two three'",0)).toEqual(
{ type : "macro-parameter", start : 0, value : "one two three", end : 15 }
{ type : 'macro-parameter', start : 0, value : 'one two three', end : 15 }
);
expect($tw.utils.parseMacroParameter("me:[[one two three]]",0)).toEqual(
{ type : "macro-parameter", start : 0, value : "one two three", name : "me", end : 20 }
{ type : 'macro-parameter', start : 0, value : 'one two three', name : 'me', end : 20 }
);
expect($tw.utils.parseMacroParameter("[[one two three]]",0)).toEqual(
{ type : "macro-parameter", start : 0, value : "one two three", end : 17 }
{ type : 'macro-parameter', start : 0, value : 'one two three', end : 17 }
);
expect($tw.utils.parseMacroParameter("myparam>",0)).toEqual(
{ type : "macro-parameter", start : 0, value : "myparam>", end : 8 }
{ type : 'macro-parameter', start : 0, value : 'myparam>', end : 8 }
);
});
@@ -96,22 +96,22 @@ describe("HTML tag new parser tests", function() {
null
);
expect($tw.utils.parseMacroInvocation("<<mymacro>>",0)).toEqual(
{ type : "macrocall", start : 0, params : [ ], name : "mymacro", end : 11 }
{ type : 'macrocall', start : 0, params : [ ], name : 'mymacro', end : 11 }
);
expect($tw.utils.parseMacroInvocation("<<mymacro one two three>>",0)).toEqual(
{ type : "macrocall", start : 0, params : [ { type : "macro-parameter", start : 9, value : "one", end : 13 }, { type : "macro-parameter", start : 13, value : "two", end : 17 }, { type : "macro-parameter", start : 17, value : "three", end : 23 } ], name : "mymacro", end : 25 }
{ type : 'macrocall', start : 0, params : [ { type : 'macro-parameter', start : 9, value : 'one', end : 13 }, { type : 'macro-parameter', start : 13, value : 'two', end : 17 }, { type : 'macro-parameter', start : 17, value : 'three', end : 23 } ], name : 'mymacro', end : 25 }
);
expect($tw.utils.parseMacroInvocation("<<mymacro p:one q:two three>>",0)).toEqual(
{ type : "macrocall", start : 0, params : [ { type : "macro-parameter", start : 9, value : "one", name : "p", end : 15 }, { type : "macro-parameter", start : 15, value : "two", name : "q", end : 21 }, { type : "macro-parameter", start : 21, value : "three", end : 27 } ], name : "mymacro", end : 29 }
{ type : 'macrocall', start : 0, params : [ { type : 'macro-parameter', start : 9, value : 'one', name : 'p', end : 15 }, { type : 'macro-parameter', start : 15, value : 'two', name : 'q', end : 21 }, { type : 'macro-parameter', start : 21, value : 'three', end : 27 } ], name : 'mymacro', end : 29 }
);
expect($tw.utils.parseMacroInvocation("<<mymacro 'one two three'>>",0)).toEqual(
{ type : "macrocall", start : 0, params : [ { type : "macro-parameter", start : 9, value : "one two three", end : 25 } ], name : "mymacro", end : 27 }
{ type : 'macrocall', start : 0, params : [ { type : 'macro-parameter', start : 9, value : 'one two three', end : 25 } ], name : 'mymacro', end : 27 }
);
expect($tw.utils.parseMacroInvocation("<<mymacro r:'one two three'>>",0)).toEqual(
{ type : "macrocall", start : 0, params : [ { type : "macro-parameter", start : 9, value : "one two three", name : "r", end : 27 } ], name : "mymacro", end : 29 }
{ type : 'macrocall', start : 0, params : [ { type : 'macro-parameter', start : 9, value : 'one two three', name : 'r', end : 27 } ], name : 'mymacro', end : 29 }
);
expect($tw.utils.parseMacroInvocation("<<myMacro one:two three:'four and five'>>",0)).toEqual(
{ type : "macrocall", start : 0, params : [ { type : "macro-parameter", start : 9, value : "two", name : "one", end : 17 }, { type : "macro-parameter", start : 17, value : "four and five", name : "three", end : 39 } ], name : "myMacro", end : 41 }
{ type : 'macrocall', start : 0, params : [ { type : 'macro-parameter', start : 9, value : 'two', name : 'one', end : 17 }, { type : 'macro-parameter', start : 17, value : 'four and five', name : 'three', end : 39 } ], name : 'myMacro', end : 41 }
);
});
@@ -120,87 +120,56 @@ describe("HTML tag new parser tests", function() {
null
);
expect($tw.utils.parseAttribute("p='blah' ",0)).toEqual(
{ type : "string", start : 0, name : "p", value : "blah", end : 8 }
{ type : 'string', start : 0, name : 'p', value : 'blah', end : 8 }
);
expect($tw.utils.parseAttribute("p=\"blah\" ",0)).toEqual(
{ type : "string", start : 0, name : "p", value : "blah", end : 8 }
{ type : 'string', start : 0, name : 'p', value : 'blah', end : 8 }
);
expect($tw.utils.parseAttribute("p=\"bl\nah\" ",0)).toEqual(
{ type : "string", start : 0, name : "p", value : "bl\nah", end : 9 }
{ type : 'string', start : 0, name : 'p', value : 'bl\nah', end : 9 }
);
expect($tw.utils.parseAttribute("p={{{blah}}} ",0)).toEqual(
{ type : "filtered", start : 0, name : "p", filter : "blah", end : 12 }
{ type : 'filtered', start : 0, name : 'p', filter : 'blah', end : 12 }
);
expect($tw.utils.parseAttribute("p={{{bl\nah}}} ",0)).toEqual(
{ type : "filtered", start : 0, name : "p", filter : "bl\nah", end : 13 }
{ type : 'filtered', start : 0, name : 'p', filter : 'bl\nah', end : 13 }
);
expect($tw.utils.parseAttribute("p={{{ [{$:/layout}] }}} ",0)).toEqual(
{ type : "filtered", start : 0, name : "p", filter : " [{$:/layout}] ", end : 23 }
{ type : 'filtered', start : 0, name : 'p', filter : ' [{$:/layout}] ', end : 23 }
);
expect($tw.utils.parseAttribute("p={{blah}} ",0)).toEqual(
{ type : "indirect", start : 0, name : "p", textReference : "blah", end : 10 }
{ type : 'indirect', start : 0, name : 'p', textReference : 'blah', end : 10 }
);
expect($tw.utils.parseAttribute("p=blah ",0)).toEqual(
{ type : "string", start : 0, name : "p", value : "blah", end : 6 }
{ type : 'string', start : 0, name : 'p', value : 'blah', end : 6 }
);
expect($tw.utils.parseAttribute("p =blah ",0)).toEqual(
{ type : "string", start : 0, name : "p", value : "blah", end : 7 }
{ type : 'string', start : 0, name : 'p', value : 'blah', end : 7 }
);
expect($tw.utils.parseAttribute("p= blah ",0)).toEqual(
{ type : "string", start : 0, name : "p", value : "blah", end : 7 }
{ type : 'string', start : 0, name : 'p', value : 'blah', end : 7 }
);
expect($tw.utils.parseAttribute("p = blah ",0)).toEqual(
{ type : "string", start : 0, name : "p", value : "blah", end : 8 }
{ type : 'string', start : 0, name : 'p', value : 'blah', end : 8 }
);
expect($tw.utils.parseAttribute("p = >blah ",0)).toEqual(
{ type : "string", value : "true", start : 0, name : "p", end : 4 }
{ type : 'string', value : 'true', start : 0, name : 'p', end : 4 }
);
expect($tw.utils.parseAttribute(" attrib1>",0)).toEqual(
{ type : "string", value : "true", start : 0, name : "attrib1", end : 8 }
{ type : 'string', value : 'true', start : 0, name : 'attrib1', end : 8 }
);
expect($tw.utils.parseAttribute("p=`blah` ",1)).toEqual(null);
expect($tw.utils.parseAttribute("p=`blah` ",0)).toEqual(
{ start: 0, name: "p", type: "substituted", rawValue: "blah", end: 8 }
{ start: 0, name: 'p', type: 'substituted', rawValue: 'blah', end: 8 }
);
expect($tw.utils.parseAttribute("p=```blah``` ",0)).toEqual(
{ start: 0, name: "p", type: "substituted", rawValue: "blah", end: 12 }
{ start: 0, name: 'p', type: 'substituted', rawValue: 'blah', end: 12 }
);
expect($tw.utils.parseAttribute("p=`Hello \"There\"`",0)).toEqual(
{ start: 0, name: "p", type: "substituted", rawValue: 'Hello "There"', end: 17 }
{ start: 0, name: 'p', type: 'substituted', rawValue: 'Hello "There"', end: 17 }
);
});
describe("serializeAttribute", function () {
it("should serialize string attributes", function () {
expect($tw.utils.serializeAttribute({ type: "string", name: "p", value: "blah" })).toBe('p="blah"');
expect($tw.utils.serializeAttribute({ type: "string", name: "p", value: "true" })).toBe("p");
});
it("should serialize filtered attributes", function () {
expect($tw.utils.serializeAttribute({ type: "filtered", name: "p", filter: "blah" })).toBe("p={{{blah}}}");
});
it("should serialize indirect attributes", function () {
expect($tw.utils.serializeAttribute({ type: "indirect", name: "p", textReference: "blah" })).toBe("p={{blah}}");
});
it("should serialize substituted attributes", function () {
expect($tw.utils.serializeAttribute({ type: "substituted", name: "p", rawValue: "blah" })).toBe("p=`blah`");
});
it("should return null for unsupported types", function () {
expect($tw.utils.serializeAttribute({ type: "unknown", name: "p", value: "blah" })).toBeNull();
});
it("should return null for invalid input", function () {
expect($tw.utils.serializeAttribute(null)).toBeNull();
expect($tw.utils.serializeAttribute({})).toBeNull();
expect($tw.utils.serializeAttribute({ type: "string" })).toBeNull();
expect($tw.utils.serializeAttribute({ name: "p" })).toBeNull();
});
});
it("should parse HTML tags", function() {
expect(parser.parseTag("<mytag>",1)).toEqual(
null
@@ -209,52 +178,52 @@ describe("HTML tag new parser tests", function() {
null
);
expect(parser.parseTag("<mytag>",0)).toEqual(
{ type : "element", start : 0, attributes : { }, orderedAttributes: [ ], tag : "mytag", end : 7 }
{ type : 'element', start : 0, attributes : { }, orderedAttributes: [ ], tag : 'mytag', end : 7 }
);
expect(parser.parseTag("<mytag attrib1>",0)).toEqual(
{ type : "element", start : 0, attributes : { attrib1 : { type : "string", value : "true", start : 6, name : "attrib1", end : 14 } }, orderedAttributes: [ { start: 6, name: "attrib1", type: "string", value: "true", end: 14 } ], tag : "mytag", end : 15 }
{ type : 'element', start : 0, attributes : { attrib1 : { type : 'string', value : 'true', start : 6, name : 'attrib1', end : 14 } }, orderedAttributes: [ { start: 6, name: 'attrib1', type: 'string', value: 'true', end: 14 } ], tag : 'mytag', end : 15 }
);
expect(parser.parseTag("<mytag attrib1/>",0)).toEqual(
{ type : "element", start : 0, attributes : { attrib1 : { type : "string", value : "true", start : 6, name : "attrib1", end : 14 } }, orderedAttributes: [ { start: 6, name: "attrib1", type: "string", value: "true", end: 14 } ], tag : "mytag", isSelfClosing : true, end : 16 }
{ type : 'element', start : 0, attributes : { attrib1 : { type : 'string', value : 'true', start : 6, name : 'attrib1', end : 14 } }, orderedAttributes: [ { start: 6, name: 'attrib1', type: 'string', value: 'true', end: 14 } ], tag : 'mytag', isSelfClosing : true, end : 16 }
);
expect(parser.parseTag("<$view field=\"title\" format=\"link\"/>",0)).toEqual(
{ type : "view", start : 0, attributes : { field : { start : 6, name : "field", type : "string", value : "title", end : 20 }, format : { start : 20, name : "format", type : "string", value : "link", end : 34 } }, orderedAttributes: [ { start: 6, name: "field", type: "string", value: "title", end: 20 }, { start: 20, name: "format", type: "string", value: "link", end: 34 } ], tag : "$view", isSelfClosing : true, end : 36 }
{ type : 'view', start : 0, attributes : { field : { start : 6, name : 'field', type : 'string', value : 'title', end : 20 }, format : { start : 20, name : 'format', type : 'string', value : 'link', end : 34 } }, orderedAttributes: [ { start: 6, name: 'field', type: 'string', value: 'title', end: 20 }, { start: 20, name: 'format', type: 'string', value: 'link', end: 34 } ], tag : '$view', isSelfClosing : true, end : 36 }
);
expect(parser.parseTag("<mytag attrib1='something'>",0)).toEqual(
{ type : "element", start : 0, attributes : { attrib1 : { type : "string", start : 6, name : "attrib1", value : "something", end : 26 } }, orderedAttributes: [ { start: 6, name: "attrib1", type: "string", value: "something", end: 26 } ], tag : "mytag", end : 27 }
{ type : 'element', start : 0, attributes : { attrib1 : { type : 'string', start : 6, name : 'attrib1', value : 'something', end : 26 } }, orderedAttributes: [ { start: 6, name: 'attrib1', type: 'string', value: 'something', end: 26 } ], tag : 'mytag', end : 27 }
);
expect(parser.parseTag("<mytag attrib1 attrib1='something'>",0)).toEqual(
{ type : "element", start : 0, attributes : { attrib1 : { type : "string", start : 15, name : "attrib1", value : "something", end : 34 } }, orderedAttributes: [ { start: 6, name: "attrib1", type: "string", value: "true", end: 15 }, { start: 15, name: "attrib1", type: "string", value: "something", end: 34 } ], tag : "mytag", end : 35 }
{ type : 'element', start : 0, attributes : { attrib1 : { type : 'string', start : 15, name : 'attrib1', value : 'something', end : 34 } }, orderedAttributes: [ { start: 6, name: 'attrib1', type: 'string', value: 'true', end: 15 }, { start: 15, name: 'attrib1', type: 'string', value: 'something', end: 34 } ], tag : 'mytag', end : 35 }
);
expect(parser.parseTag("<mytag attrib1 attrib1='something' attrib1='else'>",0)).toEqual(
{ type : "element", start : 0, attributes : { attrib1 : { type : "string", start : 34, name : "attrib1", value : "else", end : 49 } }, orderedAttributes: [ { start: 6, name: "attrib1", type: "string", value: "true", end: 15 }, { start: 15, name: "attrib1", type: "string", value: "something", end: 34 }, { start: 34, name: "attrib1", type: "string", value: "else", end: 49 } ], tag : "mytag", end : 50 }
{ type : 'element', start : 0, attributes : { attrib1 : { type : 'string', start : 34, name : 'attrib1', value : 'else', end : 49 } }, orderedAttributes: [ { start: 6, name: 'attrib1', type: 'string', value: 'true', end: 15 }, { start: 15, name: 'attrib1', type: 'string', value: 'something', end: 34 }, { start: 34, name: 'attrib1', type: 'string', value: 'else', end: 49 } ], tag : 'mytag', end : 50 }
);
expect(parser.parseTag("<$mytag attrib1='something' attrib2=else thing>",0)).toEqual(
{ type : "mytag", start : 0, attributes : { attrib1 : { type : "string", start : 7, name : "attrib1", value : "something", end : 27 }, attrib2 : { type : "string", start : 27, name : "attrib2", value : "else", end : 40 }, thing : { type : "string", start : 40, name : "thing", value : "true", end : 46 } }, orderedAttributes: [ { start: 7, name: "attrib1", type: "string", value: "something", end: 27 }, { start: 27, name: "attrib2", type: "string", value: "else", end: 40 }, { start: 40, name: "thing", type: "string", value: "true", end: 46 } ], tag : "$mytag", end : 47 }
{ type : 'mytag', start : 0, attributes : { attrib1 : { type : 'string', start : 7, name : 'attrib1', value : 'something', end : 27 }, attrib2 : { type : 'string', start : 27, name : 'attrib2', value : 'else', end : 40 }, thing : { type : 'string', start : 40, name : 'thing', value : 'true', end : 46 } }, orderedAttributes: [ { start: 7, name: 'attrib1', type: 'string', value: 'something', end: 27 }, { start: 27, name: 'attrib2', type: 'string', value: 'else', end: 40 }, { start: 40, name: 'thing', type: 'string', value: 'true', end: 46 } ], tag : '$mytag', end : 47 }
);
expect(parser.parseTag("< $mytag attrib1='something' attrib2=else thing>",0)).toEqual(
null
);
expect(parser.parseTag("<$mytag attrib3=<<myMacro one:two three:'four and five'>>>",0)).toEqual(
{ type : "mytag", start : 0, attributes : { attrib3 : { type : "macro", start : 7, name : "attrib3", value : { type : "macrocall", start : 16, params : [ { type : "macro-parameter", start : 25, value : "two", name : "one", end : 33 }, { type : "macro-parameter", start : 33, value : "four and five", name : "three", end : 55 } ], name : "myMacro", end : 57 }, end : 57 } }, orderedAttributes: [ { type : "macro", start : 7, name : "attrib3", value : { type : "macrocall", start : 16, params : [ { type : "macro-parameter", start : 25, value : "two", name : "one", end : 33 }, { type : "macro-parameter", start : 33, value : "four and five", name : "three", end : 55 } ], name : "myMacro", end : 57 }, end : 57 } ], tag : "$mytag", end : 58 }
{ type : 'mytag', start : 0, attributes : { attrib3 : { type : 'macro', start : 7, name : 'attrib3', value : { type : 'macrocall', start : 16, params : [ { type : 'macro-parameter', start : 25, value : 'two', name : 'one', end : 33 }, { type : 'macro-parameter', start : 33, value : 'four and five', name : 'three', end : 55 } ], name : 'myMacro', end : 57 }, end : 57 } }, orderedAttributes: [ { type : 'macro', start : 7, name : 'attrib3', value : { type : 'macrocall', start : 16, params : [ { type : 'macro-parameter', start : 25, value : 'two', name : 'one', end : 33 }, { type : 'macro-parameter', start : 33, value : 'four and five', name : 'three', end : 55 } ], name : 'myMacro', end : 57 }, end : 57 } ], tag : '$mytag', end : 58 }
);
expect(parser.parseTag("<$mytag attrib1='something' attrib2=else thing attrib3=<<myMacro one:two three:'four and five'>>>",0)).toEqual(
{ type : "mytag", start : 0, attributes : { attrib1 : { type : "string", start : 7, name : "attrib1", value : "something", end : 27 }, attrib2 : { type : "string", start : 27, name : "attrib2", value : "else", end : 40 }, thing : { type : "string", start : 40, name : "thing", value : "true", end : 47 }, attrib3 : { type : "macro", start : 47, name : "attrib3", value : { type : "macrocall", start : 55, params : [ { type : "macro-parameter", start : 64, value : "two", name : "one", end : 72 }, { type : "macro-parameter", start : 72, value : "four and five", name : "three", end : 94 } ], name : "myMacro", end : 96 }, end : 96 } }, orderedAttributes: [ { type : "string", start : 7, name : "attrib1", value : "something", end : 27 }, { type : "string", start : 27, name : "attrib2", value : "else", end : 40 }, { type : "string", start : 40, name : "thing", value : "true", end : 47 }, { type : "macro", start : 47, name : "attrib3", value : { type : "macrocall", start : 55, params : [ { type : "macro-parameter", start : 64, value : "two", name : "one", end : 72 }, { type : "macro-parameter", start : 72, value : "four and five", name : "three", end : 94 } ], name : "myMacro", end : 96 }, end : 96 } ], tag : "$mytag", end : 97 }
{ type : 'mytag', start : 0, attributes : { attrib1 : { type : 'string', start : 7, name : 'attrib1', value : 'something', end : 27 }, attrib2 : { type : 'string', start : 27, name : 'attrib2', value : 'else', end : 40 }, thing : { type : 'string', start : 40, name : 'thing', value : 'true', end : 47 }, attrib3 : { type : 'macro', start : 47, name : 'attrib3', value : { type : 'macrocall', start : 55, params : [ { type : 'macro-parameter', start : 64, value : 'two', name : 'one', end : 72 }, { type : 'macro-parameter', start : 72, value : 'four and five', name : 'three', end : 94 } ], name : 'myMacro', end : 96 }, end : 96 } }, orderedAttributes: [ { type : 'string', start : 7, name : 'attrib1', value : 'something', end : 27 }, { type : 'string', start : 27, name : 'attrib2', value : 'else', end : 40 }, { type : 'string', start : 40, name : 'thing', value : 'true', end : 47 }, { type : 'macro', start : 47, name : 'attrib3', value : { type : 'macrocall', start : 55, params : [ { type : 'macro-parameter', start : 64, value : 'two', name : 'one', end : 72 }, { type : 'macro-parameter', start : 72, value : 'four and five', name : 'three', end : 94 } ], name : 'myMacro', end : 96 }, end : 96 } ], tag : '$mytag', end : 97 }
);
});
it("should find and parse HTML tags", function() {
expect(parser.findNextTag("<something <mytag>",1)).toEqual(
{ type : "element", start : 11, attributes : { }, orderedAttributes: [ ], tag : "mytag", end : 18 }
{ type : 'element', start : 11, attributes : { }, orderedAttributes: [ ], tag : 'mytag', end : 18 }
);
expect(parser.findNextTag("something else </mytag>",0)).toEqual(
null
);
expect(parser.findNextTag("<<some other stuff>> <mytag>",0)).toEqual(
{ type : "element", start : 1, attributes : { other : { type : "string", value : "true", start : 6, name : "other", end : 13 }, stuff : { type : "string", value : "true", start : 13, name : "stuff", end : 18 } }, orderedAttributes: [ { type : "string", value : "true", start : 6, name : "other", end : 13 }, { type : "string", value : "true", start : 13, name : "stuff", end : 18 } ], tag : "some", end : 19 }
{ type : 'element', start : 1, attributes : { other : { type : 'string', value : 'true', start : 6, name : 'other', end : 13 }, stuff : { type : 'string', value : 'true', start : 13, name : 'stuff', end : 18 } }, orderedAttributes: [ { type : 'string', value : 'true', start : 6, name : 'other', end : 13 }, { type : 'string', value : 'true', start : 13, name : 'stuff', end : 18 } ], tag : 'some', end : 19 }
);
expect(parser.findNextTag("<<some other stuff>> <mytag>",2)).toEqual(
{ type : "element", start : 21, attributes : { }, orderedAttributes: [ ], tag : "mytag", end : 28 }
{ type : 'element', start : 21, attributes : { }, orderedAttributes: [ ], tag : 'mytag', end : 28 }
);
});

View File

@@ -23,87 +23,87 @@ describe("WikiText parser tests", function() {
it("should parse tags", function() {
expect(parse("<br>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start : 0, end : 4, children : [ { type : "element", tag : "br", start : 0, end : 4, openTagStart: 0, openTagEnd: 4, rule: "html", isBlock : false, attributes : { }, orderedAttributes: [ ] } ] } ]
[ { type : 'element', tag : 'p', start : 0, end : 4, children : [ { type : 'element', tag : 'br', start : 0, end : 4, openTagStart: 0, openTagEnd: 4, rule: 'html', isBlock : false, attributes : { }, orderedAttributes: [ ] } ] } ]
);
expect(parse("</br>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start : 0, end : 5, children : [ { type : "text", text : "</br>", start : 0, end : 5 } ] } ]
[ { type : 'element', tag : 'p', start : 0, end : 5, children : [ { type : 'text', text : '</br>', start : 0, end : 5 } ] } ]
);
expect(parse("<div>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start : 0, end : 5, children : [ { type : "element", tag : "div", start : 0, end : 5, openTagStart: 0, openTagEnd: 5, closeTagStart: 5, closeTagEnd: 5, rule: "html", isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ ] } ] } ]
[ { type : 'element', tag : 'p', start : 0, end : 5, children : [ { type : 'element', tag : 'div', start : 0, end : 5, openTagStart: 0, openTagEnd: 5, closeTagStart: 5, closeTagEnd: 5, rule: 'html', isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ ] } ] } ]
);
expect(parse("<div/>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start : 0, end : 6, children : [ { type : "element", tag : "div", isSelfClosing : true, isBlock : false, attributes : { }, orderedAttributes: [ ], start : 0, end : 6, rule: "html" } ] } ]
[ { type : 'element', tag : 'p', start : 0, end : 6, children : [ { type : 'element', tag : 'div', isSelfClosing : true, isBlock : false, attributes : { }, orderedAttributes: [ ], start : 0, end : 6, rule: 'html' } ] } ]
);
expect(parse("<div></div>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start : 0, end : 11, children : [ { type : "element", tag : "div", isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ ], start : 0, end : 11, openTagStart: 0, openTagEnd: 5, closeTagStart: 5, closeTagEnd: 11, rule: "html" } ] } ]
[ { type : 'element', tag : 'p', start : 0, end : 11, children : [ { type : 'element', tag : 'div', isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ ], start : 0, end : 11, openTagStart: 0, openTagEnd: 5, closeTagStart: 5, closeTagEnd: 11, rule: 'html' } ] } ]
);
expect(parse("<div>some text</div>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start : 0, end : 20, children : [ { type : "element", tag : "div", openTagStart: 0, openTagEnd: 5, closeTagStart: 14, closeTagEnd: 20, rule: "html", isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ { type : "text", text : "some text", start : 5, end : 14 } ], start : 0, end : 20 } ] } ]
[ { type : 'element', tag : 'p', start : 0, end : 20, children : [ { type : 'element', tag : 'div', openTagStart: 0, openTagEnd: 5, closeTagStart: 14, closeTagEnd: 20, rule: 'html', isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ { type : 'text', text : 'some text', start : 5, end : 14 } ], start : 0, end : 20 } ] } ]
);
expect(parse("<div attribute>some text</div>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start : 0, end : 30, children : [ { type : "element", tag : "div", isBlock : false, attributes : { attribute : { type : "string", value : "true", start : 4, end : 14, name: "attribute" } }, orderedAttributes: [ { type : "string", value : "true", start : 4, end : 14, name: "attribute" } ], children : [ { type : "text", text : "some text", start : 15, end : 24 } ], start : 0, end : 30, openTagStart: 0, openTagEnd: 15, closeTagStart: 24, closeTagEnd: 30, rule: "html" } ] } ]
[ { type : 'element', tag : 'p', start : 0, end : 30, children : [ { type : 'element', tag : 'div', isBlock : false, attributes : { attribute : { type : 'string', value : 'true', start : 4, end : 14, name: 'attribute' } }, orderedAttributes: [ { type : 'string', value : 'true', start : 4, end : 14, name: 'attribute' } ], children : [ { type : 'text', text : 'some text', start : 15, end : 24 } ], start : 0, end : 30, openTagStart: 0, openTagEnd: 15, closeTagStart: 24, closeTagEnd: 30, rule: 'html' } ] } ]
);
expect(parse("<div attribute='value'>some text</div>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start : 0, end : 38, children : [ { type : "element", tag : "div", openTagStart: 0, openTagEnd: 23, closeTagStart: 32, closeTagEnd: 38, rule: "html", isBlock : false, attributes : { attribute : { type : "string", name: "attribute", value : "value", start: 4, end: 22 } }, orderedAttributes: [ { type: "string", name: "attribute", value : "value", start: 4, end: 22 } ], children : [ { type : "text", text : "some text", start : 23, end : 32 } ], start : 0, end : 38 } ] } ]
[ { type : 'element', tag : 'p', start : 0, end : 38, children : [ { type : 'element', tag : 'div', openTagStart: 0, openTagEnd: 23, closeTagStart: 32, closeTagEnd: 38, rule: 'html', isBlock : false, attributes : { attribute : { type : 'string', name: 'attribute', value : 'value', start: 4, end: 22 } }, orderedAttributes: [ { type: 'string', name: 'attribute', value : 'value', start: 4, end: 22 } ], children : [ { type : 'text', text : 'some text', start : 23, end : 32 } ], start : 0, end : 38 } ] } ]
);
expect(parse("<div attribute={{TiddlerTitle}}>some text</div>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start: 0, end: 47, children : [ { type : "element", tag : "div", isBlock : false, attributes : { attribute : { type : "indirect", name: "attribute", textReference : "TiddlerTitle", start : 4, end : 31 } }, orderedAttributes: [ { type : "indirect", name: "attribute", textReference : "TiddlerTitle", start : 4, end : 31 } ], children : [ { type : "text", text : "some text", start : 32, end : 41 } ], start : 0, end : 47, openTagStart: 0, openTagEnd: 32, closeTagStart: 41, closeTagEnd: 47, rule: "html" } ] } ]
[ { type : 'element', tag : 'p', start: 0, end: 47, children : [ { type : 'element', tag : 'div', isBlock : false, attributes : { attribute : { type : 'indirect', name: 'attribute', textReference : 'TiddlerTitle', start : 4, end : 31 } }, orderedAttributes: [ { type : 'indirect', name: 'attribute', textReference : 'TiddlerTitle', start : 4, end : 31 } ], children : [ { type : 'text', text : 'some text', start : 32, end : 41 } ], start : 0, end : 47, openTagStart: 0, openTagEnd: 32, closeTagStart: 41, closeTagEnd: 47, rule: 'html' } ] } ]
);
expect(parse("<$reveal state='$:/temp/search' type='nomatch' text=''>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start: 0, end: 55, children : [ { type : "reveal", tag: "$reveal", rule: "html", attributes : { state : { start : 8, name : "state", type : "string", value : "$:/temp/search", end : 31 }, type : { start : 31, name : "type", type : "string", value : "nomatch", end : 46 }, text : { start : 46, name : "text", type : "string", value : "", end : 54 } }, orderedAttributes: [ { start : 8, name : "state", type : "string", value : "$:/temp/search", end : 31 }, { start : 31, name : "type", type : "string", value : "nomatch", end : 46 }, { start : 46, name : "text", type : "string", value : "", end : 54 } ], start: 0, end : 55, openTagStart: 0, openTagEnd: 55, closeTagStart: 55, closeTagEnd: 55, isBlock : false, children : [ ] } ] } ]
[ { type : 'element', tag : 'p', start: 0, end: 55, children : [ { type : 'reveal', tag: '$reveal', rule: 'html', attributes : { state : { start : 8, name : 'state', type : 'string', value : '$:/temp/search', end : 31 }, type : { start : 31, name : 'type', type : 'string', value : 'nomatch', end : 46 }, text : { start : 46, name : 'text', type : 'string', value : '', end : 54 } }, orderedAttributes: [ { start : 8, name : 'state', type : 'string', value : '$:/temp/search', end : 31 }, { start : 31, name : 'type', type : 'string', value : 'nomatch', end : 46 }, { start : 46, name : 'text', type : 'string', value : '', end : 54 } ], start: 0, end : 55, openTagStart: 0, openTagEnd: 55, closeTagStart: 55, closeTagEnd: 55, isBlock : false, children : [ ] } ] } ]
);
expect(parse("<div attribute={{TiddlerTitle!!field}}>some text</div>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start: 0, end: 54, children : [ { type : "element", tag : "div", rule: "html", isBlock : false, attributes : { attribute : { type : "indirect", name : "attribute", textReference : "TiddlerTitle!!field", start : 4, end : 38 } }, orderedAttributes: [ { type : "indirect", name : "attribute", textReference : "TiddlerTitle!!field", start : 4, end : 38 } ], children : [ { type : "text", text : "some text", start : 39, end : 48 } ], start : 0, end : 54, openTagStart: 0, openTagEnd: 39, closeTagStart: 48, closeTagEnd: 54 } ] } ]
[ { type : 'element', tag : 'p', start: 0, end: 54, children : [ { type : 'element', tag : 'div', rule: 'html', isBlock : false, attributes : { attribute : { type : 'indirect', name : 'attribute', textReference : 'TiddlerTitle!!field', start : 4, end : 38 } }, orderedAttributes: [ { type : 'indirect', name : 'attribute', textReference : 'TiddlerTitle!!field', start : 4, end : 38 } ], children : [ { type : 'text', text : 'some text', start : 39, end : 48 } ], start : 0, end : 54, openTagStart: 0, openTagEnd: 39, closeTagStart: 48, closeTagEnd: 54 } ] } ]
);
expect(parse("<div attribute={{Tiddler Title!!field}}>some text</div>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start: 0, end: 55, children : [ { type : "element", tag : "div", rule: "html", isBlock : false, attributes : { attribute : { type : "indirect", name : "attribute", textReference : "Tiddler Title!!field", start : 4, end : 39 } }, orderedAttributes: [ { type : "indirect", name : "attribute", textReference : "Tiddler Title!!field", start : 4, end : 39 } ], children : [ { type : "text", text : "some text", start : 40, end : 49 } ], start : 0, end : 55, openTagStart: 0, openTagEnd: 40, closeTagStart: 49, closeTagEnd: 55 } ] } ]
[ { type : 'element', tag : 'p', start: 0, end: 55, children : [ { type : 'element', tag : 'div', rule: 'html', isBlock : false, attributes : { attribute : { type : 'indirect', name : 'attribute', textReference : 'Tiddler Title!!field', start : 4, end : 39 } }, orderedAttributes: [ { type : 'indirect', name : 'attribute', textReference : 'Tiddler Title!!field', start : 4, end : 39 } ], children : [ { type : 'text', text : 'some text', start : 40, end : 49 } ], start : 0, end : 55, openTagStart: 0, openTagEnd: 40, closeTagStart: 49, closeTagEnd: 55 } ] } ]
);
expect(parse("<div attribute={{TiddlerTitle!!field}}>\n\nsome text</div>")).toEqual(
[ { type : "element", start : 0, attributes : { attribute : { start : 4, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 38 } }, orderedAttributes: [ { start : 4, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 38 } ], tag : "div", rule: "html", end : 56, openTagStart: 0, openTagEnd: 39, closeTagStart: 50, closeTagEnd: 56, isBlock : true, children : [ { type : "element", tag : "p", rule: "parseblock", start : 41, end : 50, children : [ { type : "text", text : "some text", start : 41, end : 50 } ] } ] } ]
[ { type : 'element', start : 0, attributes : { attribute : { start : 4, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 38 } }, orderedAttributes: [ { start : 4, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 38 } ], tag : 'div', rule: 'html', end : 56, openTagStart: 0, openTagEnd: 39, closeTagStart: 50, closeTagEnd: 56, isBlock : true, children : [ { type : 'element', tag : 'p', start : 41, end : 50, children : [ { type : 'text', text : 'some text', start : 41, end : 50 } ] } ] } ]
);
expect(parse("<div><div attribute={{TiddlerTitle!!field}}>\n\nsome text</div></div>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start: 0, end: 67, children : [ { type : "element", start : 0, end: 67, openTagStart: 0, openTagEnd: 5, closeTagStart: 61, closeTagEnd: 67, attributes : { }, orderedAttributes: [ ], tag : "div", rule: "html", isBlock : false, children : [ { type : "element", start : 5, attributes : { attribute : { start : 9, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 43 } }, orderedAttributes: [ { start : 9, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 43 } ], tag : "div", end : 61, openTagStart: 5, openTagEnd: 44, closeTagStart: 55, closeTagEnd: 61, rule: "html", isBlock : true, children : [ { type : "element", tag : "p", rule: "parseblock", start : 46, end : 55, children : [ { type : "text", text : "some text", start : 46, end : 55 } ] } ] } ] } ] } ]
[ { type : 'element', tag : 'p', start: 0, end: 67, children : [ { type : 'element', start : 0, end: 67, openTagStart: 0, openTagEnd: 5, closeTagStart: 61, closeTagEnd: 67, attributes : { }, orderedAttributes: [ ], tag : 'div', rule: 'html', isBlock : false, children : [ { type : 'element', start : 5, attributes : { attribute : { start : 9, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 43 } }, orderedAttributes: [ { start : 9, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 43 } ], tag : 'div', end : 61, openTagStart: 5, openTagEnd: 44, closeTagStart: 55, closeTagEnd: 61, rule: 'html', isBlock : true, children : [ { type : 'element', tag : 'p', start : 46, end : 55, children : [ { type : 'text', text : 'some text', start : 46, end : 55 } ] } ] } ] } ] } ]
);
expect(parse("<div><div attribute={{TiddlerTitle!!field}}>\n\n!some heading</div></div>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start: 0, end: 71, children : [ { type : "element", start : 0, end: 71, openTagStart: 0, openTagEnd: 5, closeTagStart: 71, closeTagEnd: 71, attributes : { }, orderedAttributes: [ ], tag : "div", rule: "html", isBlock : false, children : [ { type : "element", start : 5, attributes : { attribute : { start : 9, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 43 } }, orderedAttributes: [ { start : 9, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 43 } ], tag : "div", end : 71, openTagStart: 5, openTagEnd: 44, closeTagStart: 71, closeTagEnd: 71, rule: "html", isBlock : true, children : [ { type : "element", tag : "h1", start: 46, end: 71, rule: "heading", attributes : { class : { type : "string", value : "", start: 47, end: 47 } }, children : [ { type : "text", text : "some heading</div></div>", start : 47, end : 71 } ] } ] } ] } ] } ]
[ { type : 'element', tag : 'p', start: 0, end: 71, children : [ { type : 'element', start : 0, end: 71, openTagStart: 0, openTagEnd: 5, closeTagStart: 71, closeTagEnd: 71, attributes : { }, orderedAttributes: [ ], tag : 'div', rule: 'html', isBlock : false, children : [ { type : 'element', start : 5, attributes : { attribute : { start : 9, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 43 } }, orderedAttributes: [ { start : 9, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 43 } ], tag : 'div', end : 71, openTagStart: 5, openTagEnd: 44, closeTagStart: 71, closeTagEnd: 71, rule: 'html', isBlock : true, children : [ { type : 'element', tag : 'h1', start: 46, end: 71, rule: 'heading', attributes : { class : { type : 'string', value : '', start: 47, end: 47 } }, children : [ { type : 'text', text : 'some heading</div></div>', start : 47, end : 71 } ] } ] } ] } ] } ]
);
expect(parse("<div><div attribute={{TiddlerTitle!!field}}>\n!some heading</div></div>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start: 0, end: 70, children : [ { type : "element", start : 0, end: 70, openTagStart: 0, openTagEnd: 5, closeTagStart: 64, closeTagEnd: 70, attributes : { }, orderedAttributes: [ ], tag : "div", rule: "html", isBlock : false, children : [ { type : "element", start : 5, attributes : { attribute : { start : 9, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 43 } }, orderedAttributes: [ { start : 9, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 43 } ], tag : "div", end : 64, openTagStart: 5, openTagEnd: 44, closeTagStart: 58, closeTagEnd: 64, rule: "html", isBlock : false, children : [ { type : "text", text : "\n!some heading", start : 44, end : 58 } ] } ] } ] } ]
[ { type : 'element', tag : 'p', start: 0, end: 70, children : [ { type : 'element', start : 0, end: 70, openTagStart: 0, openTagEnd: 5, closeTagStart: 64, closeTagEnd: 70, attributes : { }, orderedAttributes: [ ], tag : 'div', rule: 'html', isBlock : false, children : [ { type : 'element', start : 5, attributes : { attribute : { start : 9, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 43 } }, orderedAttributes: [ { start : 9, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 43 } ], tag : 'div', end : 64, openTagStart: 5, openTagEnd: 44, closeTagStart: 58, closeTagEnd: 64, rule: 'html', isBlock : false, children : [ { type : 'text', text : '\n!some heading', start : 44, end : 58 } ] } ] } ] } ]
);
// Regression test for issue (#3306)
expect(parse("<div><span><span>\n\nSome text</span></span></div>")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start: 0, end: 48, children : [ { type : "element", start : 0, end: 48, openTagStart: 0, openTagEnd: 5, closeTagStart: 42, closeTagEnd: 48, attributes : { }, orderedAttributes: [ ], tag : "div", rule: "html", isBlock : false, children : [ { type : "element", start : 5, attributes : { }, orderedAttributes: [ ], tag : "span", end : 42, openTagStart: 5, openTagEnd: 11, closeTagStart: 35, closeTagEnd: 42, rule: "html", isBlock : false, children : [ { type : "element", start : 11, attributes : { }, orderedAttributes: [ ], tag : "span", end : 35, openTagStart: 11, openTagEnd: 17, closeTagStart: 28, closeTagEnd: 35, rule: "html", isBlock : true, children : [ { type : "element", tag : "p", rule: "parseblock", start : 19, end : 28, children : [ { type : "text", text : "Some text", start : 19, end : 28 } ] } ] } ] } ] } ] } ]
[ { type : 'element', tag : 'p', start: 0, end: 48, children : [ { type : 'element', start : 0, end: 48, openTagStart: 0, openTagEnd: 5, closeTagStart: 42, closeTagEnd: 48, attributes : { }, orderedAttributes: [ ], tag : 'div', rule: 'html', isBlock : false, children : [ { type : 'element', start : 5, attributes : { }, orderedAttributes: [ ], tag : 'span', end : 42, openTagStart: 5, openTagEnd: 11, closeTagStart: 35, closeTagEnd: 42, rule: 'html', isBlock : false, children : [ { type : 'element', start : 11, attributes : { }, orderedAttributes: [ ], tag : 'span', end : 35, openTagStart: 11, openTagEnd: 17, closeTagStart: 28, closeTagEnd: 35, rule: 'html', isBlock : true, children : [ { type : 'element', tag : 'p', start : 19, end : 28, children : [ { type : 'text', text : 'Some text', start : 19, end : 28 } ] } ] } ] } ] } ] } ]
);
});
@@ -111,12 +111,7 @@ describe("WikiText parser tests", function() {
it("should parse macro definitions", function() {
expect(parse("\\define myMacro()\nnothing\n\\end\n")).toEqual(
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"isMacroDefinition":true,"isBlock":false,"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"start":0,"end":30,"rule":"macrodef"}]
);
expect(parse("\\define myMacro() nothing\n\n")).toEqual(
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"isMacroDefinition":true,"isBlock":true,"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"start":0,"end":25,"rule":"macrodef"}]
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"isMacroDefinition":true,"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"start":0,"end":30,"rule":"macrodef"}]
);
});
@@ -124,7 +119,7 @@ describe("WikiText parser tests", function() {
it("should parse macro definitions with end statements followed by spaces", function() {
expect(parse("\\define myMacro()\nnothing\n\\end \n")).toEqual(
[{"type":"set","isBlock": false,"attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"isMacroDefinition":true,"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"start":0,"end":33,"rule":"macrodef"}]
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"isMacroDefinition":true,"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"start":0,"end":33,"rule":"macrodef"}]
);
});
@@ -132,7 +127,7 @@ describe("WikiText parser tests", function() {
it("should parse macro definitions with named end statements followed by spaces", function() {
expect(parse("\\define myMacro()\nnothing\n\\end myMacro \n")).toEqual(
[{"type":"set","isBlock": false,"attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"isMacroDefinition":true,"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"start":0,"end":40,"rule":"macrodef"}]
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"isMacroDefinition":true,"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"start":0,"end":40,"rule":"macrodef"}]
);
});
@@ -235,7 +230,7 @@ describe("WikiText parser tests", function() {
it("should parse comment in pragma area. Comment will be invisible", function() {
expect(parse("<!-- comment in pragma area -->\n\\define aMacro()\nnothing\n\\end\n")).toEqual(
[{"type":"void","children":[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"aMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"isMacroDefinition":true,"isBlock":false,"orderedAttributes":[{"name":"name","type":"string","value":"aMacro"},{"name":"value","type":"string","value":"nothing"}],"start":32,"end":61,"rule":"macrodef"}],"text":"<!-- comment in pragma area -->","start":0,"end":31,"rule":"commentblock"}]
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"aMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"isMacroDefinition":true,"orderedAttributes":[{"name":"name","type":"string","value":"aMacro"},{"name":"value","type":"string","value":"nothing"}],"start":32,"end":61,"rule":"macrodef"}]
);
});
@@ -243,12 +238,12 @@ describe("WikiText parser tests", function() {
it("should block mode filtered transclusions", function() {
expect(parse("{{{ filter }}}")).toEqual(
[ { type: "list", attributes: { filter: { type: "string", value: " filter ", start: 3, end: 11 } }, isBlock: true, start: 0, end: 14, rule: "filteredtranscludeblock" } ]
[ { type: 'list', attributes: { filter: { type: 'string', value: ' filter ', start: 3, end: 11 } }, isBlock: true, start: 0, end: 14, rule: "filteredtranscludeblock" } ]
);
expect(parse("{{{ fil\nter }}}")).toEqual(
[ { type: "list", attributes: { filter: { type: "string", value: " fil\nter ", start: 3, end: 12 } }, isBlock: true, start: 0, end: 15, rule: "filteredtranscludeblock" } ]
[ { type: 'list', attributes: { filter: { type: 'string', value: ' fil\nter ', start: 3, end: 12 } }, isBlock: true, start: 0, end: 15, rule: "filteredtranscludeblock" } ]
);
});
@@ -256,38 +251,38 @@ describe("WikiText parser tests", function() {
it("should parse inline macro calls", function() {
expect(parse("<<john>><<paul>><<george>><<ringo>>")).toEqual(
[{"type":"element","tag":"p",rule:"parseblock","children":[{"type":"transclude","start":0,"end":8,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"}]},{"type":"transclude","start":8,"end":16,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"paul"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"paul"}]},{"type":"transclude","start":16,"end":26,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"george"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"george"}]},{"type":"transclude","start":26,"end":35,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"ringo"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"ringo"}]}],"start":0,"end":35}]
[{"type":"element","tag":"p","children":[{"type":"transclude","start":0,"end":8,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"}]},{"type":"transclude","start":8,"end":16,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"paul"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"paul"}]},{"type":"transclude","start":16,"end":26,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"george"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"george"}]},{"type":"transclude","start":26,"end":35,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"ringo"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"ringo"}]}],"start":0,"end":35}]
);
expect(parse("text <<john one:val1 two: 'val \"2\"' three: \"val '3'\" four: \"\"\"val 4\"5'\"\"\" five: [[val 5]] >>")).toEqual(
[{"type":"element","tag":"p",rule:"parseblock","children":[{"type":"text","text":"text ","start":0,"end":5},{"type":"transclude","start":5,"end":92,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"john"},"one":{"name":"one","type":"string","value":"val1","start":11,"end":20},"two":{"name":"two","type":"string","value":"val \"2\"","start":20,"end":35},"three":{"name":"three","type":"string","value":"val '3'","start":35,"end":52},"four":{"name":"four","type":"string","value":"val 4\"5'","start":52,"end":73},"five":{"name":"five","type":"string","value":"val 5","start":73,"end":89}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"},{"name":"one","type":"string","value":"val1","start":11,"end":20},{"name":"two","type":"string","value":"val \"2\"","start":20,"end":35},{"name":"three","type":"string","value":"val '3'","start":35,"end":52},{"name":"four","type":"string","value":"val 4\"5'","start":52,"end":73},{"name":"five","type":"string","value":"val 5","start":73,"end":89}]}],"start":0,"end":92}]
[{"type":"element","tag":"p","children":[{"type":"text","text":"text ","start":0,"end":5},{"type":"transclude","start":5,"end":92,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"john"},"one":{"name":"one","type":"string","value":"val1","start":11,"end":20},"two":{"name":"two","type":"string","value":"val \"2\"","start":20,"end":35},"three":{"name":"three","type":"string","value":"val '3'","start":35,"end":52},"four":{"name":"four","type":"string","value":"val 4\"5'","start":52,"end":73},"five":{"name":"five","type":"string","value":"val 5","start":73,"end":89}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"},{"name":"one","type":"string","value":"val1","start":11,"end":20},{"name":"two","type":"string","value":"val \"2\"","start":20,"end":35},{"name":"three","type":"string","value":"val '3'","start":35,"end":52},{"name":"four","type":"string","value":"val 4\"5'","start":52,"end":73},{"name":"five","type":"string","value":"val 5","start":73,"end":89}]}],"start":0,"end":92}]
);
expect(parse("ignored << carrots <<john>>")).toEqual(
[{"type":"element","tag":"p",rule:"parseblock","children":[{"type":"text","text":"ignored << carrots ","start":0,"end":19},{"type":"transclude","start":19,"end":27,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"}]}],"start":0,"end":27}]
[{"type":"element","tag":"p","children":[{"type":"text","text":"ignored << carrots ","start":0,"end":19},{"type":"transclude","start":19,"end":27,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"}]}],"start":0,"end":27}]
);
expect(parse("text <<<john>>")).toEqual(
[{"type":"element","tag":"p",rule:"parseblock","children":[{"type":"text","text":"text ","start":0,"end":5},{"type":"transclude","start":5,"end":14,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"<john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"<john"}]}],"start":0,"end":14}]
[{"type":"element","tag":"p","children":[{"type":"text","text":"text ","start":0,"end":5},{"type":"transclude","start":5,"end":14,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"<john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"<john"}]}],"start":0,"end":14}]
);
expect(parse("before\n<<john>>")).toEqual(
[{"type":"element","tag":"p",rule:"parseblock","children":[{"type":"text","text":"before\n","start":0,"end":7},{"type":"transclude","start":7,"end":15,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"}]}],"start":0,"end":15}]
[{"type":"element","tag":"p","children":[{"type":"text","text":"before\n","start":0,"end":7},{"type":"transclude","start":7,"end":15,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"}]}],"start":0,"end":15}]
);
// A single space will cause it to be inline
expect(parse("<<john>> ")).toEqual(
[{"type":"element","tag":"p",rule:"parseblock","children":[{"type":"transclude","start":0,"end":8,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"}]},{"type":"text","text":" ","start":8,"end":9}],"start":0,"end":9}]
[{"type":"element","tag":"p","children":[{"type":"transclude","start":0,"end":8,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"}]},{"type":"text","text":" ","start":8,"end":9}],"start":0,"end":9}]
);
expect(parse("text <<outie one:'my <<innie>>' >>")).toEqual(
[{"type":"element","tag":"p",rule:"parseblock","children":[{"type":"text","text":"text ","start":0,"end":5},{"type":"transclude","start":5,"end":34,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"outie"},"one":{"name":"one","type":"string","value":"my <<innie>>","start":12,"end":31}},"orderedAttributes":[{"name":"$variable","type":"string","value":"outie"},{"name":"one","type":"string","value":"my <<innie>>","start":12,"end":31}]}],"start":0,"end":34}]
[{"type":"element","tag":"p","children":[{"type":"text","text":"text ","start":0,"end":5},{"type":"transclude","start":5,"end":34,"rule":"macrocallinline","attributes":{"$variable":{"name":"$variable","type":"string","value":"outie"},"one":{"name":"one","type":"string","value":"my <<innie>>","start":12,"end":31}},"orderedAttributes":[{"name":"$variable","type":"string","value":"outie"},{"name":"one","type":"string","value":"my <<innie>>","start":12,"end":31}]}],"start":0,"end":34}]
);
@@ -296,7 +291,7 @@ describe("WikiText parser tests", function() {
it("should parse block macro calls", function() {
expect(parse("<<john>>\n<<paul>>\r\n<<george>>\n<<ringo>>")).toEqual(
[ { type: "transclude", start: 0, rule: "macrocallblock", attributes: { $variable: { name: "$variable", type: "string", value: "john" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "john" }], end: 8, isBlock: true }, { type: "transclude", start: 9, rule: "macrocallblock", attributes: { $variable: { name: "$variable", type: "string", value: "paul" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "paul" }], end: 17, isBlock: true }, { type: "transclude", start: 19, rule: "macrocallblock", attributes: { $variable: { name: "$variable", type: "string", value: "george" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "george" }], end: 29, isBlock: true }, { type: "transclude", start: 30, rule: "macrocallblock", attributes: { $variable: { name: "$variable", type: "string", value: "ringo" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "ringo" }], end: 39, isBlock: true } ]
[ { type: 'transclude', start: 0, rule: 'macrocallblock', attributes: { $variable: { name: "$variable", type: "string", value: "john" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "john" }], end: 8, isBlock: true }, { type: 'transclude', start: 9, rule: 'macrocallblock', attributes: { $variable: { name: "$variable", type: "string", value: "paul" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "paul" }], end: 17, isBlock: true }, { type: 'transclude', start: 19, rule: 'macrocallblock', attributes: { $variable: { name: "$variable", type: "string", value: "george" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "george" }], end: 29, isBlock: true }, { type: 'transclude', start: 30, rule: 'macrocallblock', attributes: { $variable: { name: "$variable", type: "string", value: "ringo" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "ringo" }], end: 39, isBlock: true } ]
);
expect(parse("<<john one:val1 two: 'val \"2\"' three: \"val '3'\" four: \"\"\"val 4\"5'\"\"\" five: [[val 5]] >>")).toEqual(
@@ -306,17 +301,17 @@ describe("WikiText parser tests", function() {
);
expect(parse("<< carrots\n\n<<john>>")).toEqual(
[ { type: "element", tag: "p", rule: "parseblock", start : 0, end : 10, children: [ { type: "text", text: "<< carrots", start : 0, end : 10 } ] }, { type: "transclude", start: 12, rule: "macrocallblock", attributes: { $variable: {name: "$variable", type:"string", value: "john"} }, orderedAttributes: [ {name: "$variable", type:"string", value: "john"} ], end: 20, isBlock: true } ]
[ { type: 'element', tag: 'p', start : 0, end : 10, children: [ { type: 'text', text: '<< carrots', start : 0, end : 10 } ] }, { type: 'transclude', start: 12, rule: 'macrocallblock', attributes: { $variable: {name: "$variable", type:"string", value: "john"} }, orderedAttributes: [ {name: "$variable", type:"string", value: "john"} ], end: 20, isBlock: true } ]
);
expect(parse("before\n\n<<john>>")).toEqual(
[ { type: "element", tag: "p", rule: "parseblock", start : 0, end : 6, children: [ { type: "text", text: "before", start : 0, end : 6 } ] }, { type: "transclude", start: 8, rule: "macrocallblock", attributes: { $variable: {name: "$variable", type:"string", value: "john"} }, orderedAttributes: [ {name: "$variable", type:"string", value: "john"} ], end: 16, isBlock: true } ]
[ { type: 'element', tag: 'p', start : 0, end : 6, children: [ { type: 'text', text: 'before', start : 0, end : 6 } ] }, { type: 'transclude', start: 8, rule: 'macrocallblock', attributes: { $variable: {name: "$variable", type:"string", value: "john"} }, orderedAttributes: [ {name: "$variable", type:"string", value: "john"} ], end: 16, isBlock: true } ]
);
expect(parse("<<john>>\nafter")).toEqual(
[ { type: "transclude", start: 0, rule: "macrocallblock", attributes: { $variable: {name: "$variable", type:"string", value: "john"} }, orderedAttributes: [ {name: "$variable", type:"string", value: "john"} ], end: 8, isBlock: true }, { type: "element", tag: "p", rule: "parseblock", start: 9, end: 14, children: [ { type: "text", text: "after", start: 9, end: 14 } ] } ]
[ { type: 'transclude', start: 0, rule: 'macrocallblock', attributes: { $variable: {name: "$variable", type:"string", value: "john"} }, orderedAttributes: [ {name: "$variable", type:"string", value: "john"} ], end: 8, isBlock: true }, { type: 'element', tag: 'p', start: 9, end: 14, children: [ { type: 'text', text: 'after', start: 9, end: 14 } ] } ]
);
expect(parse("<<multiline arg:\"\"\"\n\nwikitext\n\"\"\" >>")).toEqual(
@@ -326,7 +321,7 @@ describe("WikiText parser tests", function() {
);
expect(parse("<<outie one:'my <<innie>>' >>")).toEqual(
[ { type: "transclude", start: 0, rule: "macrocallblock", attributes: { $variable: {name: "$variable", type:"string", value: "outie"}, one: {name: "one", type:"string", value: "my <<innie>>", start: 7, end: 26} }, orderedAttributes: [ {name: "$variable", type:"string", value: "outie"}, {name: "one", type:"string", value: "my <<innie>>", start: 7, end: 26} ], end: 29, isBlock: true } ]
[ { type: 'transclude', start: 0, rule: 'macrocallblock', attributes: { $variable: {name: "$variable", type:"string", value: "outie"}, one: {name: "one", type:"string", value: "my <<innie>>", start: 7, end: 26} }, orderedAttributes: [ {name: "$variable", type:"string", value: "outie"}, {name: "one", type:"string", value: "my <<innie>>", start: 7, end: 26} ], end: 29, isBlock: true } ]
);
});
@@ -344,7 +339,7 @@ describe("WikiText parser tests", function() {
);
expect(parse("<<john param>>>")).toEqual(
[{"type":"element","tag":"p",rule:"parseblock","children":[{"type":"transclude","start":0,"end":14,"rule":"macrocallinline","attributes":{"0":{"name":"0","type":"string","value":"param","start":6,"end":12},"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"},{"name":"0","type":"string","value":"param","start":6,"end":12}]},{"type":"text","text":">","start":14,"end":15}],"start":0,"end":15}]
[{"type":"element","tag":"p","children":[{"type":"transclude","start":0,"end":14,"rule":"macrocallinline","attributes":{"0":{"name":"0","type":"string","value":"param","start":6,"end":12},"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"},{"name":"0","type":"string","value":"param","start":6,"end":12}]},{"type":"text","text":">","start":14,"end":15}],"start":0,"end":15}]
);
// equals signs should be allowed
@@ -359,7 +354,7 @@ describe("WikiText parser tests", function() {
it("should parse horizontal rules", function() {
expect(parse("---Not a rule\n\n----\n\nBetween\n\n---")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", start : 0, end : 13, children : [ { type : "entity", entity : "&mdash;", start: 0, end: 3, rule: "dash" }, { type : "text", text : "Not a rule", start : 3, end : 13 } ] }, { type : "element", tag : "hr", start: 15, end: 20, rule: "horizrule" }, { type : "element", tag : "p", rule: "parseblock", start : 21, end : 28, children : [ { type : "text", text : "Between", start : 21, end : 28 } ] }, { type : "element", tag : "hr", start: 30, end: 33, rule: "horizrule" } ]
[ { type : 'element', tag : 'p', start : 0, end : 13, children : [ { type : 'entity', entity : '&mdash;', start: 0, end: 3, rule: 'dash' }, { type : 'text', text : 'Not a rule', start : 3, end : 13 } ] }, { type : 'element', tag : 'hr', start: 15, end: 20, rule: 'horizrule' }, { type : 'element', tag : 'p', start : 21, end : 28, children : [ { type : 'text', text : 'Between', start : 21, end : 28 } ] }, { type : 'element', tag : 'hr', start: 30, end: 33, rule: 'horizrule' } ]
);
@@ -368,7 +363,7 @@ describe("WikiText parser tests", function() {
it("should parse hard linebreak areas", function() {
expect(parse("\"\"\"Something\nin the\nway she moves\n\"\"\"\n\n")).toEqual(
[ { type : "element", tag : "p", rule: "parseblock", children : [ { type : "text", text : "Something", start : 3, end : 12, rule: "hardlinebreaks", isRuleStart: true }, { type : "element", tag : "br", rule: "hardlinebreaks", start: 12, end: 13 }, { type : "text", text : "in the", start : 13, end : 19, rule: "hardlinebreaks" }, { type : "element", tag : "br", rule: "hardlinebreaks", start: 19, end: 20 }, { type : "text", text : "way she moves", start : 20, end : 33, rule: "hardlinebreaks" }, { type : "element", tag : "br", rule: "hardlinebreaks", start: 33, end: 34, isRuleEnd: true } ], start : 0, end : 37 } ]
[ { type : 'element', tag : 'p', children : [ { type : 'text', text : 'Something', start : 3, end : 12, rule: 'hardlinebreaks' }, { type : 'element', tag : 'br', rule: 'hardlinebreaks', start: 12, end: 13 }, { type : 'text', text : 'in the', start : 13, end : 19, rule: 'hardlinebreaks' }, { type : 'element', tag : 'br', rule: 'hardlinebreaks', start: 19, end: 20 }, { type : 'text', text : 'way she moves', start : 20, end : 33, rule: 'hardlinebreaks' }, { type : 'element', tag : 'br', rule: 'hardlinebreaks', start: 33, end: 34 } ], start : 0, end : 37 } ]
);
@@ -380,87 +375,87 @@ describe("WikiText parser tests", function() {
|Cell3 |Cell4 |`.trim();
let expectedParseTree = [{
type: "element",
tag: "table",
type: 'element',
tag: 'table',
start: 0,
end: 33,
rule: "table",
rule: 'table',
children: [{
type: "element",
tag: "tbody",
type: 'element',
tag: 'tbody',
start: 0,
end: 33,
children: [{
type: "element",
tag: "tr",
type: 'element',
tag: 'tr',
attributes: {
"class": { name: "class", type: "string", value: "evenRow" },
'class': { name: 'class', type: 'string', value: 'evenRow' },
},
orderedAttributes: [
{ name: "class", type: "string", value: "evenRow" },
{ name: 'class', type: 'string', value: 'evenRow' },
],
start: 0,
end: 18,
children: [{
type: "element",
tag: "th",
type: 'element',
tag: 'th',
attributes: {
"align": { name: "align", type: "string", value: "left" },
'align': { name: 'align', type: 'string', value: 'left' },
},
orderedAttributes: [
{ name: "align", type: "string", value: "left" },
{ name: 'align', type: 'string', value: 'left' },
],
start: 1,
end: 8,
children: [{type: "text", text: "Cell1", start: 2, end: 7}],
children: [{type: 'text', text: 'Cell1', start: 2, end: 7}],
}, {
type: "element",
tag: "th",
type: 'element',
tag: 'th',
attributes: {
"align": { name: "align", type: "string", value: "left" },
'align': { name: 'align', type: 'string', value: 'left' },
},
orderedAttributes: [
{ name: "align", type: "string", value: "left" },
{ name: 'align', type: 'string', value: 'left' },
],
start: 9,
end: 16,
children: [{type: "text", text: "Cell2", start: 10, end: 15}],
children: [{type: 'text', text: 'Cell2', start: 10, end: 15}],
}],
}, {
type: "element",
tag: "tr",
type: 'element',
tag: 'tr',
attributes: {
"class": { name: "class", type: "string", value: "oddRow" },
'class': { name: 'class', type: 'string', value: 'oddRow' },
},
orderedAttributes: [
{ name: "class", type: "string", value: "oddRow" },
{ name: 'class', type: 'string', value: 'oddRow' },
],
start: 18,
end: 33,
children: [{
type: "element",
tag: "td",
type: 'element',
tag: 'td',
attributes: {
"align": { name: "align", type: "string", value: "left" },
'align': { name: 'align', type: 'string', value: 'left' },
},
orderedAttributes: [
{ name: "align", type: "string", value: "left" },
{ name: 'align', type: 'string', value: 'left' },
],
start: 19,
end: 25,
children: [{type: "text", text: "Cell3", start: 19, end: 24}],
children: [{type: 'text', text: 'Cell3', start: 19, end: 24}],
}, {
type: "element",
tag: "td",
type: 'element',
tag: 'td',
attributes: {
"align": { name: "align", type: "string", value: "left" },
'align': { name: 'align', type: 'string', value: 'left' },
},
orderedAttributes: [
{ name: "align", type: "string", value: "left" },
{ name: 'align', type: 'string', value: 'left' },
],
start: 26,
end: 32,
children: [{type: "text", text: "Cell4", start: 26, end: 31}],
children: [{type: 'text', text: 'Cell4', start: 26, end: 31}],
}],
}],
}],

View File

@@ -1,18 +0,0 @@
/*\
title: test-wikitext-serialize.js
type: application/javascript
tags: [[$:/tags/test-spec]]
Tests the wikitext inverse-rendering from Wiki AST.
\*/
describe("WikiAST serialization unit tests", function () {
var cases = $tw.wiki.filterTiddlers("[all[shadows+tiddlers]tag[$:/tags/wikitext-serialize-test-spec]]");
$tw.utils.each(cases, function (title) {
it("should serialize correctly for " + title, function () {
var serialized = $tw.utils.serializeWikitextParseTree($tw.wiki.parseTiddler(title).tree).trimEnd();
expect(serialized).toBe($tw.wiki.getTiddlerText(title).trimEnd());
});
});
});

View File

@@ -2,7 +2,6 @@
"description": "TiddlyWiki core tests",
"plugins": [
"tiddlywiki/jasmine",
"tiddlywiki/wikitext-serialize",
"tiddlywiki/geospatial"
],
"themes": [

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

View File

@@ -1,4 +1,4 @@
title: New Release Banner
type: image/webp
type: image/png
tags: picture
alt-text: Release banner, with a custom background and a release version in big letters.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 KiB

View File

@@ -4,5 +4,5 @@ release: 5.3.8
tags: $:/tags/ChangeNote
change-type: enhancement
change-category: translation
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9133
links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9133
github-contributors: BramChen

View File

@@ -4,5 +4,5 @@ release: 5.3.8
tags: $:/tags/ChangeNote
change-type: bugfix
change-category: translation
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/issue/9166
links: https://github.com/TiddlyWiki/TiddlyWiki5/issue/9166
github-contributors: Leilei332

View File

@@ -4,5 +4,5 @@ release: 5.3.8
tags: $:/tags/ChangeNote
change-type: bugfix
change-category: palette
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9175
links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9175
github-contributors: Leilei332

View File

@@ -4,5 +4,5 @@ release: 5.3.8
tags: $:/tags/ChangeNote
change-type: enhancement
change-category: translation
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9184
links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9184
github-contributors: EvidentlyCube

View File

@@ -4,5 +4,5 @@ release: 5.3.8
tags: $:/tags/ChangeNote
change-type: bugfix
change-category: plugin
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9185
links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9185
github-contributors: Leilei332

View File

@@ -4,7 +4,7 @@ release: 5.3.8
tags: $:/tags/ChangeNote
change-type: bugfix
change-category: hackability
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/commit/32caeb69c3e7b75a80a84a1e14363e87175b164e
links: https://github.com/TiddlyWiki/TiddlyWiki5/commit/32caeb69c3e7b75a80a84a1e14363e87175b164e
github-contributors: Jermolene
Reverted the [[change in v5.3.7|https://github.com/TiddlyWiki/TiddlyWiki5/pull/8721]] that broke the [[list-tagged-draggable Macro]]. The change involved updating some core macros to use procedures

View File

@@ -4,5 +4,5 @@ release: 5.3.8
tags: $:/tags/ChangeNote
change-type: enhancement
change-category: translation
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/commit/75502266176de9d4a5e1f89cd7f2e455b7a2f6da
links: https://github.com/TiddlyWiki/TiddlyWiki5/commit/75502266176de9d4a5e1f89cd7f2e455b7a2f6da
github-contributors: superuser-does

View File

@@ -4,5 +4,5 @@ release: 5.3.8
tags: $:/tags/ChangeNote
change-type: bugfix
change-category: usability
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/commit/93d30f374da4a6b2037b335f7f7d4eddce8192db
links: https://github.com/TiddlyWiki/TiddlyWiki5/commit/93d30f374da4a6b2037b335f7f7d4eddce8192db
github-contributors: Jermolene

View File

@@ -1,8 +0,0 @@
title: $:/changenotes/5.4.0/#8702/impacts/darkmode-info-tiddler
changenote: $:/changenotes/5.4.0/#8702
created: 20250901000000000
modified: 20250901000000000
tags: $:/tags/ImpactNote
description: `$:/info/darkmode` has been superseded by `$:/info/browser/darkmode`
impact-type: deprecation

View File

@@ -1,9 +0,0 @@
title: $:/changenotes/5.4.0/#8702/impacts/palette-pluginisation
changenote: $:/changenotes/5.4.0/#8702
created: 20250901000000000
modified: 20250901000000000
tags: $:/tags/ImpactNote
description: Existing colour palettes have been moved to a new "palettes-legacy" plugin
impact-type: pluginisation
Add the plugin to your wiki in order to continue using the legacy palettes.

View File

@@ -1,27 +0,0 @@
title: $:/changenotes/5.4.0/#8702
description: Colour handling improvements
release: 5.4.0-disabled because this PR is not yet merged
tags: $:/tags/ChangeNote
change-type: enhancement
change-category: hackability
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/8702
github-contributors: Jermolene
This PR brings several new features for end users:
* Automatically switching between a dark and light palette as the operating system setting changes (and to do so without making the wiki dirty)
* Customisation options for palettes. For example, users might choose a base hue, with the colours of the palette automatically adapting to it
* A generalisation of the dark vs. light mechanism to allow an arbitrary number of distinct schemes that are dynamically selected. For example, a palette that has a different scheme for night, morning, day and evening that automatically change with the time of day
There are also new capabilities for palette authors:
* Inheritance for palettes, making it easy to create chains of variants of a base palette
* Self contained palettes that can contain both dark and light variants (or variants for any other custom scheme)
To make all of these new features possible, this PR also includes some useful new general purpose mechanisms and features:
* Background actions that are triggered whenever there is a change to the results of a specified filter
* Several new filter operators for manipulating colour values. The underlying functionality comes from the [[color.js|https://colorjs.io/]] library
* New media query tracking mechanism that can track the results of any CSS media query (not just dark mode), storing the results in a shadow `$:/info/...` tiddler
* New `changecount` filter operator
* New `:apply` filter run prefix (to be replaced by the `:let` filter run prefix in [[#8972|https://github.com/TiddlyWiki/TiddlyWiki5/pull/8972]]))

View File

@@ -1,8 +0,0 @@
title: $:/changenotes/5.4.0/#9103
description: Add support for commands and startups which return promises
release: 5.4.0
tags: $:/tags/ChangeNote
change-type: enhancement
change-category: developer
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9103
github-contributors: Arlen22

View File

@@ -1,9 +0,0 @@
title: $:/changenotes/5.4.0/#9183/impacts/core-server-pluginisation
changenote: $:/changenotes/5.4.0/#9183
created: 20250901000000000
modified: 20250901000000000
tags: $:/tags/ImpactNote
description: Server components of the core have been moved into a new `$:/core-server` plugin
impact-type: pluginisation
It is not necessary for wikis to explicitly include the `$:/core-server` plugin.

View File

@@ -2,9 +2,9 @@ title: $:/changenotes/5.4.0/#9183
description: Offload server-only components to a plugin
release: 5.4.0
tags: $:/tags/ChangeNote
change-type: performance
change-type: pluginisation
change-category: internal
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9183 https://github.com/TiddlyWiki/TiddlyWiki5/pull/9288
links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9183 https://github.com/TiddlyWiki/TiddlyWiki5/pull/9288
github-contributors: Jermolene Leilei332
This change reduces the size of the core plugin by 119.3KB or about 4.5%.

View File

@@ -4,7 +4,7 @@ release: 5.4.0
tags: $:/tags/ChangeNote
change-type: enhancement
change-category: internal
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9287
links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9287
github-contributors: Jermolene
Doing so enables us to filter and group changes. For example, we could show all the breaking changes between two releases.

View File

@@ -6,12 +6,8 @@ title: Release 5.4.0
type: text/vnd.tiddlywiki
description: Under development
\procedure release-introduction()
Release v5.4.0 is an important release because it deliberately and forensically loosens backwards compatibility where needed to allow significant new features and fundamental improvements to be made.
''Please note that this release note is not yet fully completed, please see the change history on ~GitHub for the full list of changes included in this release.''
See the [[project plan|https://github.com/orgs/TiddlyWiki/projects/4]] for full details.
\define release-introduction()
Release v5.4.0 includes major improvements in a number of areas. See the [[project plan|https://github.com/orgs/TiddlyWiki/projects/4]] for more details.
\end release-introduction
<<releasenote 5.4.0>>

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