Merge branch 'master' into confetti-plugin
@ -3,4 +3,4 @@ title: $:/language/Exporters/
|
||||
StaticRiver: Static HTML
|
||||
JsonFile: JSON file
|
||||
CsvFile: CSV file
|
||||
TidFile: ".tid" file
|
||||
TidFile: TID text file
|
||||
|
@ -1,5 +1,5 @@
|
||||
title: $:/language/Docs/Types/image/svg+xml
|
||||
description: Structured Vector Graphics image
|
||||
description: SVG image
|
||||
name: image/svg+xml
|
||||
group: Image
|
||||
group-sort: 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
title: $:/language/Docs/Types/image/x-icon
|
||||
description: ICO format icon file
|
||||
description: ICO icon
|
||||
name: image/x-icon
|
||||
group: Image
|
||||
group-sort: 1
|
||||
|
@ -68,6 +68,54 @@ exports["jsontype"] = function(source,operator,options) {
|
||||
return results;
|
||||
};
|
||||
|
||||
exports["jsonset"] = function(source,operator,options) {
|
||||
var suffixes = operator.suffixes || [],
|
||||
type = suffixes[0] && suffixes[0][0],
|
||||
indexes = operator.operands.slice(0,-1),
|
||||
value = operator.operands[operator.operands.length - 1],
|
||||
results = [];
|
||||
if(operator.operands.length === 1 && operator.operands[0] === "") {
|
||||
value = undefined; // Prevents the value from being assigned
|
||||
}
|
||||
switch(type) {
|
||||
case "string":
|
||||
// Use value unchanged
|
||||
break;
|
||||
case "boolean":
|
||||
value = (value === "true" ? true : (value === "false" ? false : undefined));
|
||||
break;
|
||||
case "number":
|
||||
value = $tw.utils.parseNumber(value);
|
||||
break;
|
||||
case "array":
|
||||
indexes = operator.operands;
|
||||
value = [];
|
||||
break;
|
||||
case "object":
|
||||
indexes = operator.operands;
|
||||
value = {};
|
||||
break;
|
||||
case "null":
|
||||
indexes = operator.operands;
|
||||
value = null;
|
||||
break;
|
||||
case "json":
|
||||
value = $tw.utils.parseJSONSafe(value,function() {return undefined;});
|
||||
break;
|
||||
default:
|
||||
// Use value unchanged
|
||||
break;
|
||||
}
|
||||
source(function(tiddler,title) {
|
||||
var data = $tw.utils.parseJSONSafe(title,title);
|
||||
if(data) {
|
||||
data = setDataItem(data,indexes,value);
|
||||
results.push(JSON.stringify(data));
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
/*
|
||||
Given a JSON data structure and an array of index strings, return an array of the string representation of the values at the end of the index chain, or "undefined" if any of the index strings are invalid
|
||||
*/
|
||||
@ -186,5 +234,34 @@ function getDataItem(data,indexes) {
|
||||
return item;
|
||||
}
|
||||
|
||||
/*
|
||||
Given a JSON data structure, an array of index strings and a value, return the data structure with the value added at the end of the index chain. If any of the index strings are invalid then the JSON data structure is returned unmodified. If the root item is targetted then a different data object will be returned
|
||||
*/
|
||||
function setDataItem(data,indexes,value) {
|
||||
// Ignore attempts to assign undefined
|
||||
if(value === undefined) {
|
||||
return data;
|
||||
}
|
||||
// Check for the root item
|
||||
if(indexes.length === 0 || (indexes.length === 1 && indexes[0] === "")) {
|
||||
return value;
|
||||
}
|
||||
// Traverse the JSON data structure using the index chain
|
||||
var current = data;
|
||||
for(var i = 0; i < indexes.length - 1; i++) {
|
||||
var index = indexes[i];
|
||||
if($tw.utils.hop(current,index)) {
|
||||
current = current[index];
|
||||
} else {
|
||||
// Return the original JSON data structure if any of the index strings are invalid
|
||||
return data;
|
||||
}
|
||||
}
|
||||
// Add the value to the end of the index chain
|
||||
var lastIndex = indexes[indexes.length - 1];
|
||||
current[lastIndex] = value;
|
||||
return data;
|
||||
}
|
||||
|
||||
})();
|
||||
|
120
core/modules/parsers/wikiparser/rules/conditional.js
Normal file
@ -0,0 +1,120 @@
|
||||
/*\
|
||||
title: $:/core/modules/parsers/wikiparser/rules/conditional.js
|
||||
type: application/javascript
|
||||
module-type: wikirule
|
||||
|
||||
Conditional shortcut syntax
|
||||
|
||||
```
|
||||
This is a <% if [{something}] %>Elephant<% elseif [{else}] %>Pelican<% else %>Crocodile<% endif %>
|
||||
```
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.name = "conditional";
|
||||
exports.types = {inline: true, block: true};
|
||||
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /\<\%\s*if\s+/mg;
|
||||
this.terminateIfRegExp = /\%\>/mg;
|
||||
};
|
||||
|
||||
exports.findNextMatch = function(startPos) {
|
||||
// Look for the next <% if shortcut
|
||||
this.matchRegExp.lastIndex = startPos;
|
||||
this.match = this.matchRegExp.exec(this.parser.source);
|
||||
// If not found then return no match
|
||||
if(!this.match) {
|
||||
return undefined;
|
||||
}
|
||||
// Check for the next %>
|
||||
this.terminateIfRegExp.lastIndex = this.match.index;
|
||||
this.terminateIfMatch = this.terminateIfRegExp.exec(this.parser.source);
|
||||
// If not found then return no match
|
||||
if(!this.terminateIfMatch) {
|
||||
return undefined;
|
||||
}
|
||||
// Return the position at which the construction was found
|
||||
return this.match.index;
|
||||
};
|
||||
|
||||
/*
|
||||
Parse the most recent match
|
||||
*/
|
||||
exports.parse = function() {
|
||||
// Get the filter condition
|
||||
var filterCondition = this.parser.source.substring(this.match.index + this.match[0].length,this.terminateIfMatch.index);
|
||||
// Advance the parser position to past the %>
|
||||
this.parser.pos = this.terminateIfMatch.index + this.terminateIfMatch[0].length;
|
||||
// Parse the if clause
|
||||
return this.parseIfClause(filterCondition);
|
||||
};
|
||||
|
||||
exports.parseIfClause = function(filterCondition) {
|
||||
// Create the list widget
|
||||
var listWidget = {
|
||||
type: "list",
|
||||
tag: "$list",
|
||||
isBlock: this.is.block,
|
||||
children: [
|
||||
{
|
||||
type: "list-template",
|
||||
tag: "$list-template"
|
||||
},
|
||||
{
|
||||
type: "list-empty",
|
||||
tag: "$list-empty"
|
||||
}
|
||||
]
|
||||
};
|
||||
$tw.utils.addAttributeToParseTreeNode(listWidget,"filter",filterCondition);
|
||||
$tw.utils.addAttributeToParseTreeNode(listWidget,"variable","condition");
|
||||
$tw.utils.addAttributeToParseTreeNode(listWidget,"limit","1");
|
||||
// Check for an immediately following double linebreak
|
||||
var hasLineBreak = !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g);
|
||||
// Parse the body looking for else or endif
|
||||
var reEndString = "\\<\\%\\s*(endif)\\s*\\%\\>|\\<\\%\\s*(else)\\s*\\%\\>|\\<\\%\\s*(elseif)\\s+([\\s\\S]+?)\\%\\>",
|
||||
ex;
|
||||
if(hasLineBreak) {
|
||||
ex = this.parser.parseBlocksTerminatedExtended(reEndString);
|
||||
} else {
|
||||
var reEnd = new RegExp(reEndString,"mg");
|
||||
ex = this.parser.parseInlineRunTerminatedExtended(reEnd,{eatTerminator: true});
|
||||
}
|
||||
// Put the body into the list template
|
||||
listWidget.children[0].children = ex.tree;
|
||||
// Check for an else or elseif
|
||||
if(ex.match) {
|
||||
if(ex.match[1] === "endif") {
|
||||
// Nothing to do if we just found an endif
|
||||
} else if(ex.match[2] === "else") {
|
||||
// Check for an immediately following double linebreak
|
||||
hasLineBreak = !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g);
|
||||
// If we found an else then we need to parse the body looking for the endif
|
||||
var reEndString = "\\<\\%\\s*(endif)\\s*\\%\\>",
|
||||
ex;
|
||||
if(hasLineBreak) {
|
||||
ex = this.parser.parseBlocksTerminatedExtended(reEndString);
|
||||
} else {
|
||||
var reEnd = new RegExp(reEndString,"mg");
|
||||
ex = this.parser.parseInlineRunTerminatedExtended(reEnd,{eatTerminator: true});
|
||||
}
|
||||
// Put the parsed content inside the list empty template
|
||||
listWidget.children[1].children = ex.tree;
|
||||
} else if(ex.match[3] === "elseif") {
|
||||
// Parse the elseif clause by reusing this parser, passing the new filter condition
|
||||
listWidget.children[1].children = this.parseIfClause(ex.match[4]);
|
||||
}
|
||||
}
|
||||
// Return the parse tree node
|
||||
return [listWidget];
|
||||
};
|
||||
|
||||
})();
|
@ -81,6 +81,9 @@ exports.parse = function() {
|
||||
}
|
||||
return [tiddlerNode];
|
||||
} else {
|
||||
// No template or text reference is provided, so we'll use a blank target. Otherwise we'll generate
|
||||
// a transclude widget that transcludes the current tiddler, often leading to recursion errors
|
||||
transcludeNode.attributes["$tiddler"] = {name: "$tiddler", type: "string", value: ""};
|
||||
return [transcludeNode];
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,9 @@ exports.parse = function() {
|
||||
}
|
||||
return [tiddlerNode];
|
||||
} else {
|
||||
// No template or text reference is provided, so we'll use a blank target. Otherwise we'll generate
|
||||
// a transclude widget that transcludes the current tiddler, often leading to recursion errors
|
||||
transcludeNode.attributes["$tiddler"] = {name: "$tiddler", type: "string", value: ""};
|
||||
return [transcludeNode];
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ Parse a block from the current position
|
||||
terminatorRegExpString: optional regular expression string that identifies the end of plain paragraphs. Must not include capturing parenthesis
|
||||
*/
|
||||
WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
|
||||
var terminatorRegExp = terminatorRegExpString ? new RegExp("(" + terminatorRegExpString + "|\\r?\\n\\r?\\n)","mg") : /(\r?\n\r?\n)/mg;
|
||||
var terminatorRegExp = terminatorRegExpString ? new RegExp(terminatorRegExpString + "|\\r?\\n\\r?\\n","mg") : /(\r?\n\r?\n)/mg;
|
||||
this.skipWhitespace();
|
||||
if(this.pos >= this.sourceLength) {
|
||||
return [];
|
||||
@ -264,11 +264,21 @@ WikiParser.prototype.parseBlocksUnterminated = function() {
|
||||
};
|
||||
|
||||
/*
|
||||
Parse blocks of text until a terminating regexp is encountered
|
||||
Parse blocks of text until a terminating regexp is encountered. Wrapper for parseBlocksTerminatedExtended that just returns the parse tree
|
||||
*/
|
||||
WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
|
||||
var terminatorRegExp = new RegExp("(" + terminatorRegExpString + ")","mg"),
|
||||
tree = [];
|
||||
var ex = this.parseBlocksTerminatedExtended(terminatorRegExpString);
|
||||
return ex.tree;
|
||||
};
|
||||
|
||||
/*
|
||||
Parse blocks of text until a terminating regexp is encountered
|
||||
*/
|
||||
WikiParser.prototype.parseBlocksTerminatedExtended = function(terminatorRegExpString) {
|
||||
var terminatorRegExp = new RegExp(terminatorRegExpString,"mg"),
|
||||
result = {
|
||||
tree: []
|
||||
};
|
||||
// Skip any whitespace
|
||||
this.skipWhitespace();
|
||||
// Check if we've got the end marker
|
||||
@ -277,7 +287,7 @@ WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
|
||||
// Parse the text into blocks
|
||||
while(this.pos < this.sourceLength && !(match && match.index === this.pos)) {
|
||||
var blocks = this.parseBlock(terminatorRegExpString);
|
||||
tree.push.apply(tree,blocks);
|
||||
result.tree.push.apply(result.tree,blocks);
|
||||
// Skip any whitespace
|
||||
this.skipWhitespace();
|
||||
// Check if we've got the end marker
|
||||
@ -286,8 +296,9 @@ WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
|
||||
}
|
||||
if(match && match.index === this.pos) {
|
||||
this.pos = match.index + match[0].length;
|
||||
result.match = match;
|
||||
}
|
||||
return tree;
|
||||
return result;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -330,6 +341,11 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
|
||||
};
|
||||
|
||||
WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,options) {
|
||||
var ex = this.parseInlineRunTerminatedExtended(terminatorRegExp,options);
|
||||
return ex.tree;
|
||||
};
|
||||
|
||||
WikiParser.prototype.parseInlineRunTerminatedExtended = function(terminatorRegExp,options) {
|
||||
options = options || {};
|
||||
var tree = [];
|
||||
// Find the next occurrence of the terminator
|
||||
@ -349,7 +365,10 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
|
||||
if(options.eatTerminator) {
|
||||
this.pos += terminatorMatch[0].length;
|
||||
}
|
||||
return tree;
|
||||
return {
|
||||
match: terminatorMatch,
|
||||
tree: tree
|
||||
};
|
||||
}
|
||||
}
|
||||
// Process any inline rule, along with the text preceding it
|
||||
@ -373,7 +392,9 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
|
||||
this.pushTextWidget(tree,this.source.substr(this.pos),this.pos,this.sourceLength);
|
||||
}
|
||||
this.pos = this.sourceLength;
|
||||
return tree;
|
||||
return {
|
||||
tree: tree
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -60,6 +60,7 @@ ListWidget.prototype.render = function(parent,nextSibling) {
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
ListWidget.prototype.execute = function() {
|
||||
var self = this;
|
||||
// Get our attributes
|
||||
this.template = this.getAttribute("template");
|
||||
this.editTemplate = this.getAttribute("editTemplate");
|
||||
@ -67,6 +68,8 @@ ListWidget.prototype.execute = function() {
|
||||
this.counterName = this.getAttribute("counter");
|
||||
this.storyViewName = this.getAttribute("storyview");
|
||||
this.historyTitle = this.getAttribute("history");
|
||||
// Look for <$list-template> and <$list-empty> widgets as immediate child widgets
|
||||
this.findExplicitTemplates();
|
||||
// Compose the list elements
|
||||
this.list = this.getTiddlerList();
|
||||
var members = [],
|
||||
@ -85,19 +88,49 @@ ListWidget.prototype.execute = function() {
|
||||
this.history = [];
|
||||
};
|
||||
|
||||
ListWidget.prototype.findExplicitTemplates = function() {
|
||||
var self = this;
|
||||
this.explicitListTemplate = null;
|
||||
this.explicitEmptyTemplate = null;
|
||||
var searchChildren = function(childNodes) {
|
||||
$tw.utils.each(childNodes,function(node) {
|
||||
if(node.type === "list-template") {
|
||||
self.explicitListTemplate = node.children;
|
||||
} else if(node.type === "list-empty") {
|
||||
self.explicitEmptyTemplate = node.children;
|
||||
} else if(node.type === "element" && node.tag === "p") {
|
||||
searchChildren(node.children);
|
||||
}
|
||||
});
|
||||
};
|
||||
searchChildren(this.parseTreeNode.children);
|
||||
}
|
||||
|
||||
ListWidget.prototype.getTiddlerList = function() {
|
||||
var limit = $tw.utils.getInt(this.getAttribute("limit",""),undefined);
|
||||
var defaultFilter = "[!is[system]sort[title]]";
|
||||
return this.wiki.filterTiddlers(this.getAttribute("filter",defaultFilter),this);
|
||||
var results = this.wiki.filterTiddlers(this.getAttribute("filter",defaultFilter),this);
|
||||
if(limit !== undefined) {
|
||||
if(limit >= 0) {
|
||||
results = results.slice(0,limit);
|
||||
} else {
|
||||
results = results.slice(limit);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
ListWidget.prototype.getEmptyMessage = function() {
|
||||
var parser,
|
||||
emptyMessage = this.getAttribute("emptyMessage","");
|
||||
// this.wiki.parseText() calls
|
||||
// new Parser(..), which should only be done, if needed, because it's heavy!
|
||||
if (emptyMessage === "") {
|
||||
emptyMessage = this.getAttribute("emptyMessage");
|
||||
// If emptyMessage attribute is not present or empty then look for an explicit empty template
|
||||
if(!emptyMessage) {
|
||||
if(this.explicitEmptyTemplate) {
|
||||
return this.explicitEmptyTemplate;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
parser = this.wiki.parseText("text/vnd.tiddlywiki",emptyMessage,{parseAsInline: true});
|
||||
if(parser) {
|
||||
return parser.tree;
|
||||
@ -122,9 +155,16 @@ ListWidget.prototype.makeItemTemplate = function(title,index) {
|
||||
if(template) {
|
||||
templateTree = [{type: "transclude", attributes: {tiddler: {type: "string", value: template}}}];
|
||||
} else {
|
||||
// Check for child nodes of the list widget
|
||||
if(this.parseTreeNode.children && this.parseTreeNode.children.length > 0) {
|
||||
// Check for a <$list-item> widget
|
||||
if(this.explicitListTemplate) {
|
||||
templateTree = this.explicitListTemplate;
|
||||
} else if (!this.explicitEmptyTemplate) {
|
||||
templateTree = this.parseTreeNode.children;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
if(!templateTree) {
|
||||
// Default template is a link to the title
|
||||
templateTree = [{type: "element", tag: this.parseTreeNode.isBlock ? "div" : "span", children: [{type: "link", attributes: {to: {type: "string", value: title}}, children: [
|
||||
{type: "text", text: title}
|
||||
|
@ -109,6 +109,7 @@ TranscludeWidget.prototype.collectAttributes = function() {
|
||||
this.recursionMarker = this.getAttribute("recursionMarker","yes");
|
||||
} else {
|
||||
this.transcludeVariable = this.getAttribute("$variable");
|
||||
this.transcludeVariableIsFunction = false;
|
||||
this.transcludeType = this.getAttribute("$type");
|
||||
this.transcludeOutput = this.getAttribute("$output","text/html");
|
||||
this.transcludeTitle = this.getAttribute("$tiddler",this.getVariable("currentTiddler"));
|
||||
@ -184,7 +185,9 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
||||
if(this.transcludeVariable) {
|
||||
// Transcluding a variable
|
||||
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()});
|
||||
this.transcludeVariableIsFunction = variableInfo.srcVariable && variableInfo.srcVariable.isFunctionDefinition;
|
||||
text = variableInfo.text;
|
||||
this.transcludeFunctionResult = text;
|
||||
return {
|
||||
text: variableInfo.text,
|
||||
type: this.transcludeType
|
||||
@ -219,21 +222,24 @@ TranscludeWidget.prototype.parseTransclusionTarget = function(parseAsInline) {
|
||||
// Transcluding a variable
|
||||
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()}),
|
||||
srcVariable = variableInfo && variableInfo.srcVariable;
|
||||
if(srcVariable && srcVariable.isFunctionDefinition) {
|
||||
this.transcludeVariableIsFunction = true;
|
||||
this.transcludeFunctionResult = (variableInfo.resultList ? variableInfo.resultList[0] : variableInfo.text) || "";
|
||||
}
|
||||
if(variableInfo.text) {
|
||||
if(srcVariable && srcVariable.isFunctionDefinition) {
|
||||
var result = (variableInfo.resultList ? variableInfo.resultList[0] : variableInfo.text) || "";
|
||||
parser = {
|
||||
tree: [{
|
||||
type: "text",
|
||||
text: result
|
||||
text: this.transcludeFunctionResult
|
||||
}],
|
||||
source: result,
|
||||
source: this.transcludeFunctionResult,
|
||||
type: "text/vnd.tiddlywiki"
|
||||
};
|
||||
if(parseAsInline) {
|
||||
parser.tree[0] = {
|
||||
type: "text",
|
||||
text: result
|
||||
text: this.transcludeFunctionResult
|
||||
};
|
||||
} else {
|
||||
parser.tree[0] = {
|
||||
@ -241,7 +247,7 @@ TranscludeWidget.prototype.parseTransclusionTarget = function(parseAsInline) {
|
||||
tag: "p",
|
||||
children: [{
|
||||
type: "text",
|
||||
text: result
|
||||
text: this.transcludeFunctionResult
|
||||
}]
|
||||
}
|
||||
}
|
||||
@ -430,12 +436,19 @@ TranscludeWidget.prototype.parserNeedsRefresh = function() {
|
||||
return (this.sourceText === undefined || parserInfo.sourceText !== this.sourceText || parserInfo.parserType !== this.parserType)
|
||||
};
|
||||
|
||||
TranscludeWidget.prototype.functionNeedsRefresh = function() {
|
||||
var oldResult = this.transcludeFunctionResult;
|
||||
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()});
|
||||
var newResult = (variableInfo.resultList ? variableInfo.resultList[0] : variableInfo.text) || "";
|
||||
return oldResult !== newResult;
|
||||
}
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
TranscludeWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(($tw.utils.count(changedAttributes) > 0) || (!this.transcludeVariable && changedTiddlers[this.transcludeTitle] && this.parserNeedsRefresh())) {
|
||||
if(($tw.utils.count(changedAttributes) > 0) || (this.transcludeVariableIsFunction && this.functionNeedsRefresh()) || (!this.transcludeVariable && changedTiddlers[this.transcludeTitle] && this.parserNeedsRefresh())) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
|
@ -1,5 +1,9 @@
|
||||
title: $:/core/ui/EditTemplate/body/default
|
||||
|
||||
\function edit-preview-state()
|
||||
[{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] +[get[text]] :else[[no]]
|
||||
\end
|
||||
|
||||
\define config-visibility-title()
|
||||
$:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
||||
\end
|
||||
@ -10,15 +14,16 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
||||
|
||||
\whitespace trim
|
||||
<$let
|
||||
edit-preview-state={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] }}}
|
||||
importTitle=<<qualify $:/ImportImage>>
|
||||
importState=<<qualify $:/state/ImportImage>> >
|
||||
<$dropzone importTitle=<<importTitle>> autoOpenOnImport="no" contentTypesFilter={{$:/config/Editor/ImportContentTypesFilter}} class="tc-dropzone-editor" enable={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}} filesOnly="yes" actions=<<importFileActions>> >
|
||||
<$reveal stateTitle=<<edit-preview-state>> type="match" text="yes" tag="div">
|
||||
<div class="tc-tiddler-preview">
|
||||
<div>
|
||||
<div class={{{ [function[edit-preview-state]match[yes]then[tc-tiddler-preview]] +[join[ ]] }}}>
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||
|
||||
<$list filter="[function[edit-preview-state]match[yes]]" variable="ignore">
|
||||
|
||||
<div class="tc-tiddler-preview-preview" data-tiddler-title={{!!draft.title}} data-tags={{!!tags}}>
|
||||
|
||||
<$transclude tiddler={{$:/state/editpreviewtype}} mode="inline">
|
||||
@ -29,13 +34,12 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
||||
|
||||
</div>
|
||||
|
||||
</$list>
|
||||
|
||||
</div>
|
||||
</$reveal>
|
||||
|
||||
<$reveal stateTitle=<<edit-preview-state>> type="nomatch" text="yes" tag="div">
|
||||
</div>
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||
|
||||
</$reveal>
|
||||
</$dropzone>
|
||||
|
||||
</$let>
|
||||
|
@ -9,11 +9,17 @@ button-classes: tc-text-editor-toolbar-item-start-group
|
||||
shortcuts: ((preview))
|
||||
|
||||
\whitespace trim
|
||||
<$let
|
||||
edit-preview-state={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] }}}
|
||||
>
|
||||
<$reveal state=<<edit-preview-state>> type="match" text="yes" tag="span">
|
||||
{{$:/core/images/preview-open}}
|
||||
<$action-setfield $tiddler=<<edit-preview-state>> $value="no"/>
|
||||
<$action-sendmessage $message="tm-edit-text-operation" $param="focus-editor"/>
|
||||
</$reveal>
|
||||
<$reveal state=<<edit-preview-state>> type="nomatch" text="yes" tag="span">
|
||||
{{$:/core/images/preview-closed}}
|
||||
<$action-setfield $tiddler=<<edit-preview-state>> $value="yes"/>
|
||||
<$action-sendmessage $message="tm-edit-text-operation" $param="focus-editor"/>
|
||||
</$reveal>
|
||||
</$let>
|
||||
|
Before Width: | Height: | Size: 6.4 KiB |
BIN
editions/de-AT-server/tiddlers/system/favicon.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
@ -1,2 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
||||
type: image/png
|
Before Width: | Height: | Size: 6.4 KiB |
BIN
editions/dev/tiddlers/images/favicon.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
@ -1,2 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
||||
type: image/png
|
Before Width: | Height: | Size: 6.4 KiB |
BIN
editions/es-ES-server/tiddlers/system/favicon.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
@ -1,2 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
||||
type: image/png
|
Before Width: | Height: | Size: 6.4 KiB |
BIN
editions/es-ES/tiddlers/images/favicon.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
@ -1,2 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
||||
type: image/png
|
Before Width: | Height: | Size: 6.4 KiB |
BIN
editions/es-ES/tiddlers/images/green_favicon.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
@ -1,2 +1,2 @@
|
||||
title: $:/green_favicon.ico
|
||||
type: image/x-icon
|
||||
type: image/png
|
Before Width: | Height: | Size: 6.4 KiB |
@ -1,2 +0,0 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
BIN
editions/fr-FR-server/tiddlers/system/favicon.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
2
editions/fr-FR-server/tiddlers/system/favicon.png.meta
Normal file
@ -0,0 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/png
|
Before Width: | Height: | Size: 6.4 KiB |
@ -1,2 +0,0 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
BIN
editions/fr-FR/tiddlers/images/favicon.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
2
editions/fr-FR/tiddlers/images/favicon.png.meta
Normal file
@ -0,0 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/png
|
Before Width: | Height: | Size: 6.4 KiB |
BIN
editions/fr-FR/tiddlers/images/green_favicon.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
@ -1,2 +1,2 @@
|
||||
title: $:/green_favicon.ico
|
||||
type: image/x-icon
|
||||
type: image/png
|
Before Width: | Height: | Size: 6.4 KiB |
@ -1,2 +0,0 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
BIN
editions/ja-JP/tiddlers/images/favicon.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
2
editions/ja-JP/tiddlers/images/favicon.png.meta
Normal file
@ -0,0 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/png
|
Before Width: | Height: | Size: 6.4 KiB |
BIN
editions/ja-JP/tiddlers/images/green_favicon.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
@ -1,2 +1,2 @@
|
||||
title: $:/green_favicon.ico
|
||||
type: image/x-icon
|
||||
type: image/png
|
Before Width: | Height: | Size: 6.4 KiB |
@ -1,2 +0,0 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
BIN
editions/ko-KR-server/tiddlers/system/favicon.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
2
editions/ko-KR-server/tiddlers/system/favicon.png.meta
Normal file
@ -0,0 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/png
|
Before Width: | Height: | Size: 6.4 KiB |
@ -1,2 +0,0 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
BIN
editions/ko-KR/tiddlers/images/favicon.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
2
editions/ko-KR/tiddlers/images/favicon.png.meta
Normal file
@ -0,0 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/png
|
Before Width: | Height: | Size: 6.4 KiB |
BIN
editions/ko-KR/tiddlers/images/green_favicon.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
@ -1,2 +1,2 @@
|
||||
title: $:/green_favicon.ico
|
||||
type: image/x-icon
|
||||
type: image/png
|
@ -4,6 +4,7 @@ modified: 20230820114855583
|
||||
tags: ReleaseNotes
|
||||
title: Release 5.3.2
|
||||
type: text/vnd.tiddlywiki
|
||||
description: Under development
|
||||
|
||||
//[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.3.1...master]]//
|
||||
|
||||
@ -11,27 +12,50 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
Improvements to the following translations:
|
||||
|
||||
*
|
||||
* Chinese
|
||||
* Polish
|
||||
* Spanish
|
||||
|
||||
! Plugin Improvements
|
||||
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/1be8f0a9336952d4745d2bd4f2327e353580a272">> comments plugin to use predefined palette colours
|
||||
|
||||
! Widget Improvements
|
||||
|
||||
*
|
||||
|
||||
! Usability Improvements
|
||||
|
||||
* <<.link-badge-updated "https://github.com/Jermolene/TiddlyWiki5/pull/7747">> editor preview button to automatically focus the editor
|
||||
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7764">> file type names in the export menu
|
||||
|
||||
! Hackability Improvements
|
||||
|
||||
*
|
||||
* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7737">> an automatic build of the external core TiddlyWiki at https://tiddlywiki.com/empty-external-core.html
|
||||
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7690">> the default page layout to better support CSS grid and flexbox layouts
|
||||
|
||||
! Bug Fixes
|
||||
|
||||
*
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7665">> `{{}}` generating a recursion error
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7758">> ordering of Vanilla stylesheets
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/fa9bfa07a095548eb2f8339b0b1b816d2e6794ef">> missing closing tag in tag-pill-inner macro
|
||||
* <<.link-badge-removed "https://github.com/Jermolene/TiddlyWiki5/issues/7732">> invalid "type" attribute from textarea elements generated by the EditTextWidget
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7749">> editor "type" dropdown state tiddlers
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7712">> handling of "counter-last" variable when appending items with the ListWidget
|
||||
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/6088">> upgrade download link in Firefox
|
||||
|
||||
! Node.js Improvements
|
||||
|
||||
*
|
||||
|
||||
! Performance Improvements
|
||||
|
||||
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7702">> performance of predefined patterns with [[all Operator]]
|
||||
* <<.link-badge-updated "https://github.com/Jermolene/TiddlyWiki5/issues/7671">> favicon format to PNG
|
||||
|
||||
! Developer Improvements
|
||||
|
||||
*
|
||||
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7751">> global hook handling to support removing hooks
|
||||
|
||||
! Acknowledgements
|
||||
|
||||
@ -39,22 +63,16 @@ Improvements to the following translations:
|
||||
|
||||
<<.contributors """
|
||||
AnthonyMuscio
|
||||
btheado
|
||||
catter-fly
|
||||
cmo-pomerium
|
||||
CrossEye
|
||||
flibbles
|
||||
hffqyd
|
||||
lilscribby
|
||||
BramChen
|
||||
BuckarooBanzay
|
||||
BurningTreeC
|
||||
EvidentlyCube
|
||||
joebordes
|
||||
kookma
|
||||
linonetwo
|
||||
Marxsal
|
||||
mateuszwilczek
|
||||
pille1842
|
||||
pmario
|
||||
rmunn
|
||||
saqimtiaz
|
||||
stevesunypoly
|
||||
TiddlyTweeter
|
||||
twMat
|
||||
yaisog
|
||||
simonbaird
|
||||
T1mL3arn
|
||||
""">>
|
||||
|
Before Width: | Height: | Size: 118 KiB |
@ -1,2 +0,0 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
BIN
editions/prerelease/tiddlers/system/favicon.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
2
editions/prerelease/tiddlers/system/favicon.png.meta
Normal file
@ -0,0 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/png
|
26
editions/test/tiddlers/tests/data/conditionals/Basic.tid
Normal file
@ -0,0 +1,26 @@
|
||||
title: Conditionals/Basic
|
||||
description: Basic conditional shortcut syntax
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Text
|
||||
|
||||
This is a <% if [<something>match[one]] %>Elephant<% endif %>, I think.
|
||||
+
|
||||
title: Output
|
||||
|
||||
<$let something="one">
|
||||
{{Text}}
|
||||
</$let>
|
||||
|
||||
<$let something="two">
|
||||
{{Text}}
|
||||
</$let>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>
|
||||
This is a Elephant, I think.
|
||||
</p><p>
|
||||
This is a , I think.
|
||||
</p>
|
37
editions/test/tiddlers/tests/data/conditionals/BlockMode.tid
Normal file
@ -0,0 +1,37 @@
|
||||
title: Conditionals/BlockMode
|
||||
description: Basic conditional shortcut syntax in block mode
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure test(animal)
|
||||
<% if [<animal>match[Elephant]] %>
|
||||
|
||||
! It is an elephant
|
||||
|
||||
<% else %>
|
||||
|
||||
<% if [<animal>match[Giraffe]] %>
|
||||
|
||||
! It is a giraffe
|
||||
|
||||
<% else %>
|
||||
|
||||
! It is completely unknown
|
||||
|
||||
<% endif %>
|
||||
|
||||
<% endif %>
|
||||
|
||||
\end
|
||||
|
||||
<<test "Giraffe">>
|
||||
|
||||
<<test "Elephant">>
|
||||
|
||||
<<test "Antelope">>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<h1 class="">It is a giraffe</h1><h1 class="">It is an elephant</h1><h1 class="">It is completely unknown</h1>
|
26
editions/test/tiddlers/tests/data/conditionals/Else.tid
Normal file
@ -0,0 +1,26 @@
|
||||
title: Conditionals/Else
|
||||
description: Else conditional shortcut syntax
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Text
|
||||
|
||||
This is a <% if [<something>match[one]] %>Elephant<% else %>Crocodile<% endif %>, I think.
|
||||
+
|
||||
title: Output
|
||||
|
||||
<$let something="one">
|
||||
{{Text}}
|
||||
</$let>
|
||||
|
||||
<$let something="two">
|
||||
{{Text}}
|
||||
</$let>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>
|
||||
This is a Elephant, I think.
|
||||
</p><p>
|
||||
This is a Crocodile, I think.
|
||||
</p>
|
32
editions/test/tiddlers/tests/data/conditionals/Elseif.tid
Normal file
@ -0,0 +1,32 @@
|
||||
title: Conditionals/Elseif
|
||||
description: Elseif conditional shortcut syntax
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Text
|
||||
|
||||
This is a <% if [<something>match[one]] %>Elephant<% elseif [<something>match[two]] %>Antelope<% else %>Crocodile<% endif %>, I think.
|
||||
+
|
||||
title: Output
|
||||
|
||||
<$let something="one">
|
||||
{{Text}}
|
||||
</$let>
|
||||
|
||||
<$let something="two">
|
||||
{{Text}}
|
||||
</$let>
|
||||
|
||||
<$let something="three">
|
||||
{{Text}}
|
||||
</$let>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>
|
||||
This is a Elephant, I think.
|
||||
</p><p>
|
||||
This is a Antelope, I think.
|
||||
</p><p>
|
||||
This is a Crocodile, I think.
|
||||
</p>
|
@ -0,0 +1,26 @@
|
||||
title: Conditionals/MissingEndif
|
||||
description: Conditional shortcut syntax with missing endif
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Text
|
||||
|
||||
This is a <% if [<something>match[one]] %>Elephant
|
||||
+
|
||||
title: Output
|
||||
|
||||
<$let something="one">
|
||||
{{Text}}
|
||||
</$let>
|
||||
|
||||
<$let something="two">
|
||||
{{Text}}
|
||||
</$let>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>
|
||||
This is a Elephant
|
||||
</p><p>
|
||||
This is a
|
||||
</p>
|
@ -0,0 +1,12 @@
|
||||
title: Conditionals/MultipleResults
|
||||
description: Check that multiple results from the filter are ignored
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
This is a <% if 1 2 3 4 5 6 %>Elephant<% endif %>, I think.
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>This is a Elephant, I think.</p>
|
38
editions/test/tiddlers/tests/data/conditionals/Nested.tid
Normal file
@ -0,0 +1,38 @@
|
||||
title: Conditionals/Nested
|
||||
description: Nested conditional shortcut syntax
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure test(animal)
|
||||
<% if [<animal>match[Elephant]] %>
|
||||
It is an elephant
|
||||
<% else %>
|
||||
<% if [<animal>match[Giraffe]] %>
|
||||
It is a giraffe
|
||||
<% else %>
|
||||
It is completely unknown
|
||||
<% endif %>
|
||||
<% endif %>
|
||||
\end
|
||||
|
||||
<<test "Giraffe">>
|
||||
|
||||
<<test "Elephant">>
|
||||
|
||||
<<test "Antelope">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
|
||||
|
||||
It is a giraffe
|
||||
|
||||
|
||||
It is an elephant
|
||||
|
||||
|
||||
It is completely unknown
|
||||
|
@ -0,0 +1,60 @@
|
||||
title: Conditionals/NestedElseif
|
||||
description: Nested elseif conditional shortcut syntax
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Text
|
||||
|
||||
\whitespace trim
|
||||
This is a 
|
||||
<% if [<something>match[one]] %>
|
||||
<% if [<another>match[one]] %>
|
||||
Indian
|
||||
<% elseif [<another>match[two]] %>
|
||||
African
|
||||
<% else %>
|
||||
Unknown
|
||||
<% endif %>
|
||||
 Elephant
|
||||
<% elseif [<something>match[two]] %>
|
||||
Antelope
|
||||
<% else %>
|
||||
Crocodile
|
||||
<% endif %>
|
||||
, I think.
|
||||
+
|
||||
title: Output
|
||||
|
||||
<$let something="one" another="one">
|
||||
{{Text}}
|
||||
</$let>
|
||||
|
||||
<$let something="one" another="two">
|
||||
{{Text}}
|
||||
</$let>
|
||||
|
||||
<$let something="one" another="three">
|
||||
{{Text}}
|
||||
</$let>
|
||||
|
||||
<$let something="two">
|
||||
{{Text}}
|
||||
</$let>
|
||||
|
||||
<$let something="three">
|
||||
{{Text}}
|
||||
</$let>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>
|
||||
This is a Indian Elephant, I think.
|
||||
</p><p>
|
||||
This is a African Elephant, I think.
|
||||
</p><p>
|
||||
This is a Unknown Elephant, I think.
|
||||
</p><p>
|
||||
This is a Antelope, I think.
|
||||
</p><p>
|
||||
This is a Crocodile, I think.
|
||||
</p>
|
@ -0,0 +1,29 @@
|
||||
title: ListWidget/WithExplicitTemplates
|
||||
description: List widget with explicit templates
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
|
||||
\procedure test(filter)
|
||||
<$list filter=<<filter>>>
|
||||
<$list-template>
|
||||
<$text text=<<currentTiddler>>/>
|
||||
</$list-template>
|
||||
<$list-empty>
|
||||
None!
|
||||
</$list-empty>
|
||||
</$list>
|
||||
\end
|
||||
|
||||
<<test "1 2 3">>
|
||||
|
||||
<<test "">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>123</p><p>None!</p>
|
@ -0,0 +1,32 @@
|
||||
title: ListWidget/WithExplicitTemplatesInBlockMode
|
||||
description: List widget with explicit templates in block mode
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
|
||||
\procedure test(filter)
|
||||
<$list filter=<<filter>>>
|
||||
|
||||
<$list-template>
|
||||
<$text text=<<currentTiddler>>/>
|
||||
</$list-template>
|
||||
|
||||
<$list-empty>
|
||||
None!
|
||||
</$list-empty>
|
||||
|
||||
</$list>
|
||||
\end
|
||||
|
||||
<<test "1 2 3">>
|
||||
|
||||
<<test "">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
123None!
|
@ -0,0 +1,33 @@
|
||||
title: ListWidget/WithExplicitTemplatesOverriddenByAttributes
|
||||
description: List widget with explicit templates
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
|
||||
\procedure test(filter)
|
||||
<$list filter=<<filter>> emptyMessage="Zero" template="Template">
|
||||
<$list-template>
|
||||
<$text text=<<currentTiddler>>/>
|
||||
</$list-template>
|
||||
<$list-empty>
|
||||
None!
|
||||
</$list-empty>
|
||||
</$list>
|
||||
\end
|
||||
|
||||
<<test "1 2 3">>
|
||||
|
||||
<<test "">>
|
||||
|
||||
+
|
||||
title: Template
|
||||
|
||||
<$text text=<<currentTiddler>>/><$text text=<<currentTiddler>>/>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>112233</p><p>Zero</p>
|
25
editions/test/tiddlers/tests/data/list-widget/WithLimit.tid
Normal file
@ -0,0 +1,25 @@
|
||||
title: ListWidget/WithLimit
|
||||
description: List widget with limit
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
Zero: <$list filter="1 2 3 4" limit="0" template="Template"/>
|
||||
|
||||
One: <$list filter="1 2 3 4" limit="1" template="Template"/>
|
||||
|
||||
Two: <$list filter="1 2 3 4" limit="2" template="Template"/>
|
||||
|
||||
Minus Two: <$list filter="1 2 3 4" limit="-2" template="Template"/>
|
||||
|
||||
+
|
||||
title: Template
|
||||
|
||||
<$text text=<<currentTiddler>>/>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Zero: </p><p>One: 1</p><p>Two: 12</p><p>Minus Two: 34
|
||||
</p>
|
@ -0,0 +1,26 @@
|
||||
title: ListWidget/WithMissingTemplate
|
||||
description: List widget with explicit templates
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
|
||||
\procedure test(filter)
|
||||
<$list filter=<<filter>>>
|
||||
<$list-empty>
|
||||
None!
|
||||
</$list-empty>
|
||||
</$list>
|
||||
\end
|
||||
|
||||
<<test "1 2 3">>
|
||||
|
||||
<<test "">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p><span><a class="tc-tiddlylink tc-tiddlylink-missing" href="#1">1</a></span><span><a class="tc-tiddlylink tc-tiddlylink-missing" href="#2">2</a></span><span><a class="tc-tiddlylink tc-tiddlylink-missing" href="#3">3</a></span></p><p>None!</p>
|
@ -0,0 +1,27 @@
|
||||
title: Transclude/Variable/Refreshing
|
||||
description: Transcluding and refreshing a function
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\function list-join(filter, sep:", ") [subfilter<filter>join<sep>]
|
||||
|
||||
<$tiddler tiddler="TestData">
|
||||
|
||||
<<list-join "[enlist{!!items}]">>
|
||||
|
||||
</$tiddler>
|
||||
|
||||
+
|
||||
title: TestData
|
||||
|
||||
|
||||
+
|
||||
title: Actions
|
||||
|
||||
<$action-setfield $tiddler="TestData" items={{{ [range[10]join[ ]] }}}/>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>1, 2, 3, 4, 5, 6, 7, 8, 9, 10</p>
|
@ -0,0 +1,15 @@
|
||||
title: Transclude/Variable/Static
|
||||
description: Transcluding a function
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
items: 1 2 3 4 5 6 7 8 9 10
|
||||
|
||||
\function list-join(filter, sep:", ") [subfilter<filter>join<sep>]
|
||||
|
||||
<<list-join "[enlist{!!items}]">>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>1, 2, 3, 4, 5, 6, 7, 8, 9, 10</p>
|
@ -103,6 +103,24 @@ describe("json filter tests", function() {
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[4]]")).toEqual(["null"]);
|
||||
});
|
||||
|
||||
it("should support the jsonset operator", function() {
|
||||
expect(wiki.filterTiddlers("[{First}jsonset[]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset[],[Antelope]]")).toEqual(['"Antelope"']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:number[],[not a number]]")).toEqual(['0']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset[id],[Antelope]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]},"id":"Antelope"}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:notatype[id],[Antelope]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]},"id":"Antelope"}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:boolean[id],[false]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]},"id":false}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:boolean[id],[Antelope]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:number[id],[42]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]},"id":42}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:null[id]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]},"id":null}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:array[d],[f],[5]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null,[]]}}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:object[d],[f],[5]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null,{}]}}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset[missing],[id],[Antelope]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:json[\"Antelope\"]]")).toEqual(['"Antelope"']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:json[id],[{\"a\":313}]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]},"id":{"a":313}}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonset:json[notjson]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}']);
|
||||
});
|
||||
|
||||
it("should support the format:json operator", function() {
|
||||
expect(wiki.filterTiddlers("[{First}format:json[]]")).toEqual(["{\"a\":\"one\",\"b\":\"\",\"c\":1.618,\"d\":{\"e\":\"four\",\"f\":[\"five\",\"six\",true,false,null]}}"]);
|
||||
expect(wiki.filterTiddlers("[{First}format:json[4]]")).toEqual(["{\n \"a\": \"one\",\n \"b\": \"\",\n \"c\": 1.618,\n \"d\": {\n \"e\": \"four\",\n \"f\": [\n \"five\",\n \"six\",\n true,\n false,\n null\n ]\n }\n}"]);
|
||||
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 6.4 KiB |
@ -1,2 +0,0 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
After Width: | Height: | Size: 5.6 KiB |
@ -0,0 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/png
|
Before Width: | Height: | Size: 894 B |
After Width: | Height: | Size: 235 B |
@ -1,3 +1,3 @@
|
||||
title: $:/_tw_shared/favicons/classic.tiddlywiki.com
|
||||
type: image/x-icon
|
||||
type: image/png
|
||||
tags: TiddlyWikiSitesMenu
|
Before Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 4.3 KiB |
@ -1,3 +1,3 @@
|
||||
title: $:/_tw_shared/favicons/links.tiddlywiki.org
|
||||
type: image/x-icon
|
||||
type: image/png
|
||||
tags: TiddlyWikiSitesMenu
|
Before Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 5.4 KiB |
@ -1,3 +1,3 @@
|
||||
title: $:/_tw_shared/favicons/tiddlywiki.com.dev
|
||||
type: image/x-icon
|
||||
type: image/png
|
||||
tags: TiddlyWikiSitesMenu
|
Before Width: | Height: | Size: 106 KiB |
BIN
editions/tw5.com/tiddlers/_tw_shared/favicons/tiddlywiki.com.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
@ -1,3 +1,3 @@
|
||||
title: $:/_tw_shared/favicons/tiddlywiki.com
|
||||
type: image/x-icon
|
||||
type: image/png
|
||||
tags: TiddlyWikiSitesMenu
|
Before Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 4.8 KiB |
@ -1,3 +1,3 @@
|
||||
title: $:/_tw_shared/favicons/tiddlywiki.com.prerelease
|
||||
type: image/x-icon
|
||||
type: image/png
|
||||
tags: TiddlyWikiSitesMenu
|
Before Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 5.4 KiB |
@ -1,3 +1,3 @@
|
||||
title: $:/_tw_shared/favicons/tiddlywiki.com.upgrade
|
||||
type: image/x-icon
|
||||
type: image/png
|
||||
tags: TiddlyWikiSitesMenu
|