Compare commits
45 Commits
b9f540ed90
...
e174955804
Author | SHA1 | Date |
---|---|---|
Ke Wang | e174955804 | |
Matt Lauber | a081e58273 | |
Joshua Fontany | 5f74f4c2fa | |
Joshua Fontany | 9167b190d2 | |
Cameron Fischer | df8731f760 | |
Rob Hoelz | e9aa3c6c93 | |
Jeremy Ruston | 105e8195d5 | |
Simon Huber | eeb4e7a7f7 | |
Simon Huber | 7ce85a2ddb | |
Crystal Person | 804f227815 | |
Rob Hoelz | 9939759690 | |
Mario Pietsch | b595651fe1 | |
Mario Pietsch | 9cd6affcae | |
Mario Pietsch | e43cd2d989 | |
Mario Pietsch | f1e707bff4 | |
Mario Pietsch | 2d92a6fd78 | |
Mario Pietsch | 2e0e541ebf | |
Mario Pietsch | b4d7e34a5a | |
Mario Pietsch | b6eab1afd6 | |
Télumire | 32cbd53423 | |
Jeremy Ruston | 90a6f31db2 | |
Jeremy Ruston | d37d6595b5 | |
Jeremy Ruston | e02cafb938 | |
Jeremy Ruston | 801ed0ea11 | |
Mario Pietsch | 31ec1bdd50 | |
Jeremy Ruston | 62a5fc075b | |
Mario Pietsch | 0b6db6e860 | |
poc2go | 09f04cb5a6 | |
Mario Pietsch | 511d480a60 | |
Mario Pietsch | 3342cfc886 | |
Mario Pietsch | ec0b264426 | |
Mario Pietsch | 8f741e8e67 | |
Mario Pietsch | 32bf9fd7a1 | |
Jeremy Ruston | 3657e59a08 | |
Mateusz Wilczek | 21a5841aab | |
Mateusz Wilczek | edfd27fa45 | |
Jeremy Ruston | 0e7d566df7 | |
Mario Pietsch | 8481b7d137 | |
Mario Pietsch | 0fbfdce4b6 | |
Gk0Wk | 5687d9f44b | |
Gk0Wk | df0a1b184e | |
Gk0Wk | ac8dda0a1a | |
Gk0Wk | e2b9a4ed57 | |
Gk0Wk | d3e62ec56a | |
Gk0Wk | 4200495055 |
|
@ -43,7 +43,9 @@ Saves individual tiddlers in their raw text or binary format to the specified fi
|
|||
directory: path.resolve(self.commander.outputPath),
|
||||
pathFilters: [filenameFilter],
|
||||
wiki: wiki,
|
||||
fileInfo: {}
|
||||
fileInfo: {
|
||||
overwrite: true
|
||||
}
|
||||
});
|
||||
if(self.commander.verbose) {
|
||||
console.log("Saving \"" + title + "\" to \"" + fileInfo.filepath + "\"");
|
||||
|
|
|
@ -202,7 +202,7 @@ Extended filter operators to manipulate the current list.
|
|||
}
|
||||
if(resultsIndex !== -1) {
|
||||
i = i + step;
|
||||
nextOperandIndex = (i < opLength ? i : i - opLength);
|
||||
nextOperandIndex = (i < opLength ? i : i % opLength);
|
||||
if(operands.length > 1) {
|
||||
results.splice(resultsIndex,1,operands[nextOperandIndex]);
|
||||
} else {
|
||||
|
|
|
@ -114,7 +114,7 @@ exports.parseStringLiteral = function(source,pos) {
|
|||
var match = reString.exec(source);
|
||||
if(match && match.index === pos) {
|
||||
node.value = match[1] !== undefined ? match[1] :(
|
||||
match[2] !== undefined ? match[2] : match[3]
|
||||
match[2] !== undefined ? match[2] : match[3]
|
||||
);
|
||||
node.end = pos + match[0].length;
|
||||
return node;
|
||||
|
|
|
@ -29,13 +29,16 @@ exports.init = function(parser) {
|
|||
|
||||
exports.parse = function() {
|
||||
var reEnd = /(\r?\n```$)/mg;
|
||||
var languageStart = this.parser.pos + 3,
|
||||
languageEnd = languageStart + this.match[1].length;
|
||||
// Move past the match
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
|
||||
// Look for the end of the block
|
||||
reEnd.lastIndex = this.parser.pos;
|
||||
var match = reEnd.exec(this.parser.source),
|
||||
text;
|
||||
text,
|
||||
codeStart = this.parser.pos;
|
||||
// Process the block
|
||||
if(match) {
|
||||
text = this.parser.source.substring(this.parser.pos,match.index);
|
||||
|
@ -48,8 +51,8 @@ exports.parse = function() {
|
|||
return [{
|
||||
type: "codeblock",
|
||||
attributes: {
|
||||
code: {type: "string", value: text},
|
||||
language: {type: "string", value: this.match[1]}
|
||||
code: {type: "string", value: text, start: codeStart, end: this.parser.pos},
|
||||
language: {type: "string", value: this.match[1], start: languageStart, end: languageEnd}
|
||||
}
|
||||
}];
|
||||
};
|
||||
|
|
|
@ -33,7 +33,8 @@ exports.parse = function() {
|
|||
// Look for the end marker
|
||||
reEnd.lastIndex = this.parser.pos;
|
||||
var match = reEnd.exec(this.parser.source),
|
||||
text;
|
||||
text,
|
||||
start = this.parser.pos;
|
||||
// Process the text
|
||||
if(match) {
|
||||
text = this.parser.source.substring(this.parser.pos,match.index);
|
||||
|
@ -47,7 +48,9 @@ exports.parse = function() {
|
|||
tag: "code",
|
||||
children: [{
|
||||
type: "text",
|
||||
text: text
|
||||
text: text,
|
||||
start: start,
|
||||
end: this.parser.pos
|
||||
}]
|
||||
}];
|
||||
};
|
||||
|
|
|
@ -31,6 +31,7 @@ exports.init = function(parser) {
|
|||
|
||||
exports.parse = function() {
|
||||
// Move past the match
|
||||
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) === "~") {
|
||||
|
@ -46,7 +47,7 @@ exports.parse = function() {
|
|||
rel: {type: "string", value: "noopener noreferrer"}
|
||||
},
|
||||
children: [{
|
||||
type: "text", text: this.match[0]
|
||||
type: "text", text: this.match[0], start: start, end: this.parser.pos
|
||||
}]
|
||||
}];
|
||||
}
|
||||
|
|
|
@ -31,6 +31,16 @@ exports.init = function(parser) {
|
|||
|
||||
exports.parse = function() {
|
||||
// Move past the match
|
||||
var filterStart = this.parser.pos + 3;
|
||||
var filterEnd = filterStart + this.match[1].length;
|
||||
var toolTipStart = filterEnd + 1;
|
||||
var toolTipEnd = toolTipStart + (this.match[2] ? this.match[2].length : 0);
|
||||
var templateStart = toolTipEnd + 2;
|
||||
var templateEnd = templateStart + (this.match[3] ? this.match[3].length : 0);
|
||||
var styleStart = templateEnd + 2;
|
||||
var styleEnd = styleStart + (this.match[4] ? this.match[4].length : 0);
|
||||
var classesStart = styleEnd + 1;
|
||||
var classesEnd = classesStart + (this.match[5] ? this.match[5].length : 0);
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
// Get the match details
|
||||
var filter = this.match[1],
|
||||
|
@ -42,21 +52,21 @@ exports.parse = function() {
|
|||
var node = {
|
||||
type: "list",
|
||||
attributes: {
|
||||
filter: {type: "string", value: filter}
|
||||
filter: {type: "string", value: filter, start: filterStart, end: filterEnd},
|
||||
},
|
||||
isBlock: true
|
||||
};
|
||||
if(tooltip) {
|
||||
node.attributes.tooltip = {type: "string", value: tooltip};
|
||||
node.attributes.tooltip = {type: "string", value: tooltip, start: toolTipStart, end: toolTipEnd};
|
||||
}
|
||||
if(template) {
|
||||
node.attributes.template = {type: "string", value: template};
|
||||
node.attributes.template = {type: "string", value: template, start: templateStart, end: templateEnd};
|
||||
}
|
||||
if(style) {
|
||||
node.attributes.style = {type: "string", value: style};
|
||||
node.attributes.style = {type: "string", value: style, start: styleStart, end: styleEnd};
|
||||
}
|
||||
if(classes) {
|
||||
node.attributes.itemClass = {type: "string", value: classes.split(".").join(" ")};
|
||||
node.attributes.itemClass = {type: "string", value: classes.split(".").join(" "), start: classesStart, end: classesEnd};
|
||||
}
|
||||
return [node];
|
||||
};
|
||||
|
|
|
@ -30,6 +30,16 @@ exports.init = function(parser) {
|
|||
};
|
||||
|
||||
exports.parse = function() {
|
||||
var filterStart = this.parser.pos + 3;
|
||||
var filterEnd = filterStart + this.match[1].length;
|
||||
var toolTipStart = filterEnd + 1;
|
||||
var toolTipEnd = toolTipStart + (this.match[2] ? this.match[2].length : 0);
|
||||
var templateStart = toolTipEnd + 2;
|
||||
var templateEnd = templateStart + (this.match[3] ? this.match[3].length : 0);
|
||||
var styleStart = templateEnd + 2;
|
||||
var styleEnd = styleStart + (this.match[4] ? this.match[4].length : 0);
|
||||
var classesStart = styleEnd + 1;
|
||||
var classesEnd = classesStart + (this.match[5] ? this.match[5].length : 0);
|
||||
// Move past the match
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
// Get the match details
|
||||
|
@ -42,20 +52,20 @@ exports.parse = function() {
|
|||
var node = {
|
||||
type: "list",
|
||||
attributes: {
|
||||
filter: {type: "string", value: filter}
|
||||
filter: {type: "string", value: filter, start: filterStart, end: filterEnd},
|
||||
}
|
||||
};
|
||||
if(tooltip) {
|
||||
node.attributes.tooltip = {type: "string", value: tooltip};
|
||||
node.attributes.tooltip = {type: "string", value: tooltip, start: toolTipStart, end: toolTipEnd};
|
||||
}
|
||||
if(template) {
|
||||
node.attributes.template = {type: "string", value: template};
|
||||
node.attributes.template = {type: "string", value: template, start: templateStart, end: templateEnd};
|
||||
}
|
||||
if(style) {
|
||||
node.attributes.style = {type: "string", value: style};
|
||||
node.attributes.style = {type: "string", value: style, start: styleStart, end: styleEnd};
|
||||
}
|
||||
if(classes) {
|
||||
node.attributes.itemClass = {type: "string", value: classes.split(".").join(" ")};
|
||||
node.attributes.itemClass = {type: "string", value: classes.split(".").join(" "), start: classesStart, end: classesEnd};
|
||||
}
|
||||
return [node];
|
||||
};
|
||||
|
|
|
@ -45,10 +45,11 @@ exports.parse = function() {
|
|||
reEnd.lastIndex = this.parser.pos;
|
||||
match = reEnd.exec(this.parser.source);
|
||||
if(match) {
|
||||
var start = this.parser.pos;
|
||||
this.parser.pos = reEnd.lastIndex;
|
||||
// Add a line break if the terminator was a line break
|
||||
if(match[2]) {
|
||||
tree.push({type: "element", tag: "br"});
|
||||
tree.push({type: "element", tag: "br", start: start, end: this.parser.pos});
|
||||
}
|
||||
}
|
||||
} while(match && !match[1]);
|
||||
|
|
|
@ -30,15 +30,17 @@ exports.parse = function() {
|
|||
// Move past the !s
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
// Parse any classes, whitespace and then the heading itself
|
||||
var classStart = this.parser.pos;
|
||||
var classes = this.parser.parseClasses();
|
||||
var classEnd = this.parser.pos;
|
||||
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
||||
var tree = this.parser.parseInlineRun(/(\r?\n)/mg);
|
||||
// Return the heading
|
||||
return [{
|
||||
type: "element",
|
||||
tag: "h" + headingLevel,
|
||||
tag: "h" + headingLevel,
|
||||
attributes: {
|
||||
"class": {type: "string", value: classes.join(" ")}
|
||||
"class": {type: "string", value: classes.join(" "), start: classStart, end: classEnd}
|
||||
},
|
||||
children: tree
|
||||
}];
|
||||
|
|
|
@ -44,6 +44,10 @@ 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) {
|
||||
tag.openTagStart = tag.start;
|
||||
tag.openTagEnd = tag.end;
|
||||
}
|
||||
this.nextTag = null;
|
||||
// Advance the parser position to past the tag
|
||||
this.parser.pos = tag.end;
|
||||
|
@ -60,6 +64,27 @@ exports.parse = function() {
|
|||
var reEnd = new RegExp("(" + reEndString + ")","mg");
|
||||
tag.children = this.parser.parseInlineRun(reEnd,{eatTerminator: true});
|
||||
}
|
||||
tag.end = this.parser.pos;
|
||||
tag.closeTagEnd = tag.end;
|
||||
if (tag.closeTagEnd === tag.openTagEnd || this.parser.source[tag.closeTagEnd - 1] !== '>') {
|
||||
tag.closeTagStart = tag.end;
|
||||
} else {
|
||||
tag.closeTagStart = tag.closeTagEnd - 2;
|
||||
var closeTagMinPos = tag.children.length > 0 ? tag.children[tag.children.length-1].end : tag.openTagEnd;
|
||||
if (!Number.isSafeInteger(closeTagMinPos)) closeTagMinPos = tag.openTagEnd;
|
||||
while (tag.closeTagStart >= closeTagMinPos) {
|
||||
var char = this.parser.source[tag.closeTagStart];
|
||||
if (char === '>') {
|
||||
tag.closeTagStart = -1;
|
||||
break;
|
||||
}
|
||||
if (char === '<') break;
|
||||
tag.closeTagStart -= 1;
|
||||
}
|
||||
if (tag.closeTagStart < closeTagMinPos) {
|
||||
tag.closeTagStart = tag.end;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Return the tag
|
||||
return [tag];
|
||||
|
|
|
@ -122,9 +122,9 @@ exports.parseImage = function(source,pos) {
|
|||
}
|
||||
pos = token.end;
|
||||
if(token.match[1]) {
|
||||
node.attributes.tooltip = {type: "string", value: token.match[1].trim()};
|
||||
node.attributes.tooltip = {type: "string", value: token.match[1].trim(),start: token.start,end:token.start + token.match[1].length - 1};
|
||||
}
|
||||
node.attributes.source = {type: "string", value: (token.match[2] || "").trim()};
|
||||
node.attributes.source = {type: "string", value: (token.match[2] || "").trim(), start: token.start + (token.match[1] ? token.match[1].length : 0), end: token.end - 2};
|
||||
// Update the end position
|
||||
node.end = pos;
|
||||
return node;
|
||||
|
|
|
@ -38,13 +38,14 @@ exports.parse = function() {
|
|||
// Parse the filter terminated by a line break
|
||||
var reMatch = /(.*)(?:$|\r?\n)/mg;
|
||||
reMatch.lastIndex = this.parser.pos;
|
||||
var filterStart = this.parser.source;
|
||||
var match = reMatch.exec(this.parser.source);
|
||||
this.parser.pos = reMatch.lastIndex;
|
||||
// Parse tree nodes to return
|
||||
return [{
|
||||
type: "importvariables",
|
||||
attributes: {
|
||||
filter: {type: "string", value: match[1]}
|
||||
filter: {type: "string", value: match[1], start: filterStart, end: this.parser.pos}
|
||||
},
|
||||
children: []
|
||||
}];
|
||||
|
|
|
@ -74,6 +74,7 @@ exports.parse = function() {
|
|||
// Match the list marker
|
||||
var reMatch = /([\*#;:>]+)/mg;
|
||||
reMatch.lastIndex = this.parser.pos;
|
||||
var start = this.parser.pos;
|
||||
var match = reMatch.exec(this.parser.source);
|
||||
if(!match || match.index !== this.parser.pos) {
|
||||
break;
|
||||
|
@ -94,9 +95,21 @@ exports.parse = function() {
|
|||
}
|
||||
// Construct the list element or reuse the previous one at this level
|
||||
if(listStack.length <= t) {
|
||||
var listElement = {type: "element", tag: listInfo.listTag, children: [
|
||||
{type: "element", tag: listInfo.itemTag, children: []}
|
||||
]};
|
||||
var listElement = {
|
||||
type: "element",
|
||||
tag: listInfo.listTag,
|
||||
children: [
|
||||
{
|
||||
type: "element",
|
||||
tag: listInfo.itemTag,
|
||||
children: [],
|
||||
start: start,
|
||||
end: this.parser.pos,
|
||||
}
|
||||
],
|
||||
start: start,
|
||||
end: this.parser.pos,
|
||||
};
|
||||
// Link this list element into the last child item of the parent list item
|
||||
if(t) {
|
||||
var prevListItem = listStack[t-1].children[listStack[t-1].children.length-1];
|
||||
|
@ -105,21 +118,33 @@ exports.parse = function() {
|
|||
// Save this element in the stack
|
||||
listStack[t] = listElement;
|
||||
} else if(t === (match[0].length - 1)) {
|
||||
listStack[t].children.push({type: "element", tag: listInfo.itemTag, children: []});
|
||||
listStack[t].children.push({
|
||||
type: "element",
|
||||
tag: listInfo.itemTag,
|
||||
children: [],
|
||||
start: start,
|
||||
end: this.parser.pos,
|
||||
});
|
||||
}
|
||||
}
|
||||
if(listStack.length > match[0].length) {
|
||||
listStack.splice(match[0].length,listStack.length - match[0].length);
|
||||
}
|
||||
// Process the body of the list item into the last list item
|
||||
var classStart = this.parser.pos;
|
||||
var lastListChildren = listStack[listStack.length-1].children,
|
||||
lastListItem = lastListChildren[lastListChildren.length-1],
|
||||
classes = this.parser.parseClasses();
|
||||
var classEnd = this.parser.pos;
|
||||
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
||||
var tree = this.parser.parseInlineRun(/(\r?\n)/mg);
|
||||
lastListItem.children.push.apply(lastListItem.children,tree);
|
||||
lastListItem.end = this.parser.pos;
|
||||
listStack[listStack.length-1].end = this.parser.pos;
|
||||
if(classes.length > 0) {
|
||||
$tw.utils.addClassToParseTreeNode(lastListItem,classes.join(" "));
|
||||
lastListItem.attributes.class.start = classStart;
|
||||
lastListItem.attributes.class.end = classEnd;
|
||||
}
|
||||
// Consume any whitespace following the list item
|
||||
this.parser.skipWhitespace();
|
||||
|
|
|
@ -96,15 +96,20 @@ exports.parseLink = function(source,pos) {
|
|||
splitPos = null;
|
||||
}
|
||||
// Pull out the tooltip and URL
|
||||
var tooltip, URL;
|
||||
var tooltip, URL, urlStart;
|
||||
textNode.start = pos;
|
||||
if(splitPos) {
|
||||
urlStart = splitPos + 1;
|
||||
URL = source.substring(splitPos + 1,closePos).trim();
|
||||
textNode.text = source.substring(pos,splitPos).trim();
|
||||
textNode.end = splitPos;
|
||||
} else {
|
||||
urlStart = pos;
|
||||
URL = source.substring(pos,closePos).trim();
|
||||
textNode.text = URL;
|
||||
textNode.end = closePos;
|
||||
}
|
||||
node.attributes.href = {type: "string", value: URL};
|
||||
node.attributes.href = {type: "string", value: URL, start: urlStart, end: closePos};
|
||||
node.attributes.target = {type: "string", value: "_blank"};
|
||||
node.attributes.rel = {type: "string", value: "noopener noreferrer"};
|
||||
// Update the end position
|
||||
|
|
|
@ -29,32 +29,39 @@ exports.init = function(parser) {
|
|||
|
||||
exports.parse = function() {
|
||||
// Move past the match
|
||||
var start = this.parser.pos + 2;
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
// Process the link
|
||||
var text = this.match[1],
|
||||
link = this.match[2] || text;
|
||||
link = this.match[2] || text,
|
||||
textEndPos = this.parser.source.indexOf("|", start);
|
||||
if (textEndPos < 0 || textEndPos > this.matchRegExp.lastIndex) {
|
||||
textEndPos = this.matchRegExp.lastIndex - 2;
|
||||
}
|
||||
var linkStart = this.match[2] ? (start + this.match[1].length + 1) : start;
|
||||
var linkEnd = linkStart + link.length;
|
||||
if($tw.utils.isLinkExternal(link)) {
|
||||
return [{
|
||||
type: "element",
|
||||
tag: "a",
|
||||
attributes: {
|
||||
href: {type: "string", value: link},
|
||||
href: {type: "string", value: link, start: linkStart, end: linkEnd},
|
||||
"class": {type: "string", value: "tc-tiddlylink-external"},
|
||||
target: {type: "string", value: "_blank"},
|
||||
rel: {type: "string", value: "noopener noreferrer"}
|
||||
},
|
||||
children: [{
|
||||
type: "text", text: text
|
||||
type: "text", text: text, start: start, end: textEndPos
|
||||
}]
|
||||
}];
|
||||
} else {
|
||||
return [{
|
||||
type: "link",
|
||||
attributes: {
|
||||
to: {type: "string", value: link}
|
||||
to: {type: "string", value: link, start: linkStart, end: linkEnd}
|
||||
},
|
||||
children: [{
|
||||
type: "text", text: text
|
||||
type: "text", text: text, start: start, end: textEndPos
|
||||
}]
|
||||
}];
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ Wiki text rule for quote blocks. For example:
|
|||
<<<.optionalClass(es) optional cited from
|
||||
a quote
|
||||
<<<
|
||||
|
||||
|
||||
<<<.optionalClass(es)
|
||||
a quote
|
||||
<<< optional cited from
|
||||
|
@ -20,11 +20,11 @@ Quotes can be quoted by putting more <s
|
|||
```
|
||||
<<<
|
||||
Quote Level 1
|
||||
|
||||
|
||||
<<<<
|
||||
QuoteLevel 2
|
||||
<<<<
|
||||
|
||||
|
||||
<<<
|
||||
```
|
||||
|
||||
|
@ -50,30 +50,40 @@ exports.parse = function() {
|
|||
var reEndString = "^" + this.match[1] + "(?!<)";
|
||||
// Move past the <s
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
|
||||
|
||||
// Parse any classes, whitespace and then the optional cite itself
|
||||
var classStart = this.parser.pos;
|
||||
classes.push.apply(classes, this.parser.parseClasses());
|
||||
var classEnd = this.parser.pos;
|
||||
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
||||
var citeStart = this.parser.pos;
|
||||
var cite = this.parser.parseInlineRun(/(\r?\n)/mg);
|
||||
var citeEnd = this.parser.pos;
|
||||
// before handling the cite, parse the body of the quote
|
||||
var tree= this.parser.parseBlocks(reEndString);
|
||||
var tree = this.parser.parseBlocks(reEndString);
|
||||
// If we got a cite, put it before the text
|
||||
if(cite.length > 0) {
|
||||
tree.unshift({
|
||||
type: "element",
|
||||
tag: "cite",
|
||||
children: cite
|
||||
children: cite,
|
||||
start: citeStart,
|
||||
end: citeEnd
|
||||
});
|
||||
}
|
||||
// Parse any optional cite
|
||||
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
||||
citeStart = this.parser.pos;
|
||||
cite = this.parser.parseInlineRun(/(\r?\n)/mg);
|
||||
citeEnd = this.parser.pos;
|
||||
// If we got a cite, push it
|
||||
if(cite.length > 0) {
|
||||
tree.push({
|
||||
type: "element",
|
||||
tag: "cite",
|
||||
children: cite
|
||||
children: cite,
|
||||
start: citeStart,
|
||||
end: citeEnd
|
||||
});
|
||||
}
|
||||
// Return the blockquote element
|
||||
|
@ -81,7 +91,7 @@ exports.parse = function() {
|
|||
type: "element",
|
||||
tag: "blockquote",
|
||||
attributes: {
|
||||
class: { type: "string", value: classes.join(" ") },
|
||||
class: { type: "string", value: classes.join(" "), start: classStart, end: classEnd },
|
||||
},
|
||||
children: tree
|
||||
}];
|
||||
|
|
|
@ -29,10 +29,11 @@ exports.init = function(parser) {
|
|||
exports.parse = function() {
|
||||
var match = this.match[0];
|
||||
// Move past the match
|
||||
var start = this.parser.pos;
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
// Create the link unless it is suppressed
|
||||
if(match.substr(0,1) === "~") {
|
||||
return [{type: "text", text: match.substr(1)}];
|
||||
return [{type: "text", text: match.substr(1), start: start+1, end: this.parser.pos}];
|
||||
} else {
|
||||
return [{
|
||||
type: "link",
|
||||
|
@ -41,10 +42,12 @@ exports.parse = function() {
|
|||
},
|
||||
children: [{
|
||||
type: "text",
|
||||
text: match
|
||||
text: match,
|
||||
start: start,
|
||||
end: this.parser.pos
|
||||
}]
|
||||
}];
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
})();
|
||||
|
|
|
@ -150,7 +150,7 @@ exports.parse = function() {
|
|||
} else {
|
||||
// Otherwise, create a new row if this one is of a different type
|
||||
if(rowType !== currRowType) {
|
||||
rowContainer = {type: "element", tag: rowContainerTypes[rowType], children: []};
|
||||
rowContainer = {type: "element", tag: rowContainerTypes[rowType], children: [], start: this.parser.pos, end: this.parser.pos};
|
||||
table.children.push(rowContainer);
|
||||
currRowType = rowType;
|
||||
}
|
||||
|
@ -178,6 +178,7 @@ exports.parse = function() {
|
|||
// Increment the row count
|
||||
rowCount++;
|
||||
}
|
||||
rowContainer.end = this.parser.pos;
|
||||
}
|
||||
rowMatch = rowRegExp.exec(this.parser.source);
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ exports.parse = function() {
|
|||
renderType = this.match[2];
|
||||
// Move past the match
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
var start = this.parser.pos;
|
||||
// Look for the end of the block
|
||||
reEnd.lastIndex = this.parser.pos;
|
||||
var match = reEnd.exec(this.parser.source),
|
||||
|
@ -74,7 +75,9 @@ exports.parse = function() {
|
|||
tag: "pre",
|
||||
children: [{
|
||||
type: "text",
|
||||
text: text
|
||||
text: text,
|
||||
start: start,
|
||||
end: this.parser.pos
|
||||
}]
|
||||
}];
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ exports.parse = function() {
|
|||
// Get the details of the match
|
||||
var linkText = this.match[0];
|
||||
// Move past the macro call
|
||||
var start = this.parser.pos;
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
// If the link starts with the unwikilink character then just output it as plain text
|
||||
if(linkText.substr(0,1) === $tw.config.textPrimitives.unWikiLink) {
|
||||
|
@ -57,7 +58,9 @@ exports.parse = function() {
|
|||
},
|
||||
children: [{
|
||||
type: "text",
|
||||
text: linkText
|
||||
text: linkText,
|
||||
start: start,
|
||||
end: this.parser.pos
|
||||
}]
|
||||
}];
|
||||
};
|
||||
|
|
|
@ -91,6 +91,11 @@ var WikiParser = function(type,text,options) {
|
|||
} else {
|
||||
topBranch.push.apply(topBranch,this.parseBlocks());
|
||||
}
|
||||
// Build rules' name map
|
||||
this.usingRuleMap = {};
|
||||
$tw.utils.each(this.pragmaRules, function (ruleInfo) { self.usingRuleMap[ruleInfo.rule.name] = Object.getPrototypeOf(ruleInfo.rule); });
|
||||
$tw.utils.each(this.blockRules, function (ruleInfo) { self.usingRuleMap[ruleInfo.rule.name] = Object.getPrototypeOf(ruleInfo.rule); });
|
||||
$tw.utils.each(this.inlineRules, function (ruleInfo) { self.usingRuleMap[ruleInfo.rule.name] = Object.getPrototypeOf(ruleInfo.rule); });
|
||||
// Return the parse tree
|
||||
};
|
||||
|
||||
|
@ -209,8 +214,13 @@ WikiParser.prototype.parsePragmas = function() {
|
|||
break;
|
||||
}
|
||||
// Process the pragma rule
|
||||
var start = this.pos;
|
||||
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;
|
||||
$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);
|
||||
subTree[0].children = [];
|
||||
|
@ -235,13 +245,21 @@ WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
|
|||
// Look for a block rule that applies at the current position
|
||||
var nextMatch = this.findNextMatch(this.blockRules,this.pos);
|
||||
if(nextMatch && nextMatch.matchIndex === this.pos) {
|
||||
return nextMatch.rule.parse();
|
||||
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;
|
||||
}
|
||||
$tw.utils.each(subTree, function (node) { node.rule = nextMatch.rule.name; });
|
||||
return subTree;
|
||||
}
|
||||
// Treat it as a paragraph if we didn't find a block rule
|
||||
var start = this.pos;
|
||||
var children = this.parseInlineRun(terminatorRegExp);
|
||||
var end = this.pos;
|
||||
return [{type: "element", tag: "p", children: children, start: start, end: end }];
|
||||
return [{type: "element", tag: "p", children: children, start: start, end: end, rule: null }];
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -332,7 +350,16 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
|
|||
this.pos = nextMatch.matchIndex;
|
||||
}
|
||||
// Process the run rule
|
||||
tree.push.apply(tree,nextMatch.rule.parse());
|
||||
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) {
|
||||
// Set the start and end positions of the first and last child if they're not already set
|
||||
if (subTree[0].start === undefined) subTree[0].start = start;
|
||||
if (subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
|
||||
}
|
||||
$tw.utils.each(subTree, function (node) { node.rule = nextMatch.rule.name; });
|
||||
tree.push.apply(tree,subTree);
|
||||
// Look for the next run rule
|
||||
nextMatch = this.findNextMatch(this.inlineRules,this.pos);
|
||||
}
|
||||
|
@ -383,7 +410,15 @@ WikiParser.prototype.parseInlineRunTerminatedExtended = function(terminatorRegEx
|
|||
this.pos = inlineRuleMatch.matchIndex;
|
||||
}
|
||||
// Process the inline rule
|
||||
tree.push.apply(tree,inlineRuleMatch.rule.parse());
|
||||
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;
|
||||
}
|
||||
$tw.utils.each(subTree, function (node) { node.rule = inlineRuleMatch.rule.name; });
|
||||
tree.push.apply(tree,subTree);
|
||||
// Look for the next inline rule
|
||||
inlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos);
|
||||
// Look for the next terminator match
|
||||
|
@ -409,7 +444,7 @@ WikiParser.prototype.pushTextWidget = function(array,text,start,end) {
|
|||
text = $tw.utils.trim(text);
|
||||
}
|
||||
if(text) {
|
||||
array.push({type: "text", text: text, start: start, end: end});
|
||||
array.push({type: "text", text: text, start: start, end: end, rule: null});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -462,4 +497,3 @@ WikiParser.prototype.amendRules = function(type,names) {
|
|||
exports["text/vnd.tiddlywiki"] = WikiParser;
|
||||
|
||||
})();
|
||||
|
||||
|
|
|
@ -140,6 +140,11 @@ function sendResponse(request,response,statusCode,headers,data,encoding) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// RFC 7231, 6.1. Overview of Status Codes:
|
||||
// Browser clients may cache 200, 203, 204, 206, 300, 301,
|
||||
// 404, 405, 410, 414, and 501 unless given explicit cache controls
|
||||
headers["Cache-Control"] = headers["Cache-Control"] || "no-store";
|
||||
}
|
||||
/*
|
||||
If the gzip=yes is set, check if the user agent permits compression. If so,
|
||||
|
|
|
@ -81,6 +81,8 @@ exports.startup = function() {
|
|||
deferredChanges = Object.create(null);
|
||||
$tw.hooks.invokeHook("th-page-refreshed");
|
||||
}
|
||||
var throttledRefresh = $tw.perf.report("throttledRefresh",refresh);
|
||||
|
||||
// Add the change event handler
|
||||
$tw.wiki.addEventListener("change",$tw.perf.report("mainRefresh",function(changes) {
|
||||
// Check if only tiddlers that are throttled have changed
|
||||
|
@ -101,7 +103,7 @@ exports.startup = function() {
|
|||
if(isNaN(timeout)) {
|
||||
timeout = THROTTLE_REFRESH_TIMEOUT;
|
||||
}
|
||||
timerId = setTimeout(refresh,timeout);
|
||||
timerId = setTimeout(throttledRefresh,timeout);
|
||||
$tw.utils.extend(deferredChanges,changes);
|
||||
} else {
|
||||
$tw.utils.extend(deferredChanges,changes);
|
||||
|
|
|
@ -56,7 +56,7 @@ exports.startup = function() {
|
|||
return;
|
||||
}
|
||||
// Initialise the document
|
||||
srcDocument.write("<html><head></head><body class='tc-body tc-single-tiddler-window'></body></html>");
|
||||
srcDocument.write("<!DOCTYPE html><head></head><body class='tc-body tc-single-tiddler-window'></body></html>");
|
||||
srcDocument.close();
|
||||
srcDocument.title = windowTitle;
|
||||
srcWindow.addEventListener("beforeunload",function(event) {
|
||||
|
|
|
@ -283,7 +283,7 @@ exports.httpRequest = function(options) {
|
|||
// Set up the state change handler
|
||||
request.onreadystatechange = function() {
|
||||
if(this.readyState === 4) {
|
||||
if(this.status === 200 || this.status === 201 || this.status === 204) {
|
||||
if(this.status >= 200 && this.status < 300) {
|
||||
// Success!
|
||||
options.callback(null,this[returnProp],this);
|
||||
return;
|
||||
|
|
|
@ -316,11 +316,13 @@ Options include:
|
|||
pathFilters: optional array of filters to be used to generate the base path
|
||||
wiki: optional wiki for evaluating the pathFilters
|
||||
fileInfo: an existing fileInfo object to check against
|
||||
fileInfo.overwrite: if true, turns off filename clash numbers (defaults to false)
|
||||
*/
|
||||
exports.generateTiddlerFilepath = function(title,options) {
|
||||
var directory = options.directory || "",
|
||||
extension = options.extension || "",
|
||||
originalpath = (options.fileInfo && options.fileInfo.originalpath) ? options.fileInfo.originalpath : "",
|
||||
overwrite = options.fileInfo && options.fileInfo.overwrite || false,
|
||||
filepath;
|
||||
// Check if any of the pathFilters applies
|
||||
if(options.pathFilters && options.wiki) {
|
||||
|
@ -381,19 +383,20 @@ exports.generateTiddlerFilepath = function(title,options) {
|
|||
filepath += char.charCodeAt(0).toString();
|
||||
});
|
||||
}
|
||||
// Add a uniquifier if the file already exists
|
||||
var fullPath, oldPath = (options.fileInfo) ? options.fileInfo.filepath : undefined,
|
||||
// Add a uniquifier if the file already exists (default)
|
||||
var fullPath = path.resolve(directory, filepath + extension);
|
||||
if (!overwrite) {
|
||||
var oldPath = (options.fileInfo) ? options.fileInfo.filepath : undefined,
|
||||
count = 0;
|
||||
do {
|
||||
fullPath = path.resolve(directory,filepath + (count ? "_" + count : "") + extension);
|
||||
if(oldPath && oldPath == fullPath) {
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
} while(fs.existsSync(fullPath));
|
||||
do {
|
||||
fullPath = path.resolve(directory,filepath + (count ? "_" + count : "") + extension);
|
||||
if(oldPath && oldPath == fullPath) break;
|
||||
count++;
|
||||
} while(fs.existsSync(fullPath));
|
||||
}
|
||||
// If the last write failed with an error, or if path does not start with:
|
||||
// the resolved options.directory, the resolved wikiPath directory, the wikiTiddlersPath directory,
|
||||
// or the 'originalpath' directory, then $tw.utils.encodeURIComponentExtended() and resolve to tiddler directory.
|
||||
// or the 'originalpath' directory, then $tw.utils.encodeURIComponentExtended() and resolve to options.directory.
|
||||
var writePath = $tw.hooks.invokeHook("th-make-tiddler-path",fullPath,fullPath),
|
||||
encode = (options.fileInfo || {writeError: false}).writeError == true;
|
||||
if(!encode) {
|
||||
|
|
|
@ -37,6 +37,7 @@ Compute the internal state of the widget
|
|||
DeleteFieldWidget.prototype.execute = function() {
|
||||
this.actionTiddler = this.getAttribute("$tiddler",this.getVariable("currentTiddler"));
|
||||
this.actionField = this.getAttribute("$field",null);
|
||||
this.actionTimestamp = this.getAttribute("$timestamp","yes") === "yes";
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -69,11 +70,15 @@ DeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
|||
$tw.utils.each(this.attributes,function(attribute,name) {
|
||||
if(name.charAt(0) !== "$" && name !== "title") {
|
||||
removeFields[name] = undefined;
|
||||
hasChanged = true;
|
||||
if(name in tiddler.fields) {
|
||||
hasChanged = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
if(hasChanged) {
|
||||
this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,removeFields,this.wiki.getModificationFields()));
|
||||
var creationFields = this.actionTimestamp ? this.wiki.getCreationFields() : {};
|
||||
var modificationFields = this.actionTimestamp ? this.wiki.getModificationFields() : {};
|
||||
this.wiki.addTiddler(new $tw.Tiddler(creationFields,tiddler,removeFields,modificationFields));
|
||||
}
|
||||
}
|
||||
return true; // Action was invoked
|
||||
|
|
|
@ -3,7 +3,7 @@ title: $:/core/save/all-external-js
|
|||
\whitespace trim
|
||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||
\end
|
||||
|
||||
<!-- Important: core library is provided by serving URI encoded $:/core/templates/tiddlywiki5.js -->
|
||||
|
|
|
@ -3,7 +3,7 @@ title: $:/core/save/offline-external-js
|
|||
\whitespace trim
|
||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||
\end
|
||||
\define defaultCoreURL() tiddlywikicore-$(version)$.js
|
||||
<$let coreURL={{{ [[coreURL]is[variable]then<coreURL>else<defaultCoreURL>] }}}>
|
||||
|
|
|
@ -2,6 +2,6 @@ title: $:/core/save/all
|
|||
|
||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||
\end
|
||||
{{$:/core/templates/tiddlywiki5.html}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
title: $:/core/save/empty
|
||||
|
||||
\define saveTiddlerFilter()
|
||||
[is[system]] -[prefix[$:/state/popup/]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
||||
[is[system]] -[prefix[$:/state/popup/]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
||||
\end
|
||||
{{$:/core/templates/tiddlywiki5.html}}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
title: $:/core/save/lazy-all
|
||||
|
||||
\define saveTiddlerFilter()
|
||||
[is[system]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] [is[tiddler]type[application/javascript]] +[sort[title]]
|
||||
[is[system]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] [is[tiddler]type[application/javascript]] +[sort[title]]
|
||||
\end
|
||||
\define skinnySaveTiddlerFilter()
|
||||
[!is[system]] -[type[application/javascript]]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
title: $:/core/save/lazy-images
|
||||
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[!is[system]is[image]] +[sort[title]]
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[!is[system]is[image]] +[sort[title]]
|
||||
\end
|
||||
\define skinnySaveTiddlerFilter()
|
||||
[!is[system]is[image]]
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
title: $:/core/ui/EditTemplate/controls
|
||||
tags: $:/tags/EditTemplate
|
||||
|
||||
\define config-title()
|
||||
$:/config/EditToolbarButtons/Visibility/$(listItem)$
|
||||
\end
|
||||
\define config-title() $:/config/EditToolbarButtons/Visibility/$(listItem)$
|
||||
\whitespace trim
|
||||
<div class="tc-tiddler-title tc-tiddler-edit-title">
|
||||
<$view field="title"/>
|
||||
<span class="tc-tiddler-controls tc-titlebar"><$list filter="[all[shadows+tiddlers]tag[$:/tags/EditToolbar]!has[draft.of]]" variable="listItem"><$let tv-config-toolbar-class={{{ [enlist<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]] +[join[ ]]}}}><$reveal type="nomatch" state=<<config-title>> text="hide"><$transclude tiddler=<<listItem>>/></$reveal></$let></$list></span>
|
||||
<div style="clear: both;"></div>
|
||||
<$view field="title"/>
|
||||
<span class="tc-tiddler-controls tc-titlebar">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditToolbar]!has[draft.of]]" variable="listItem">
|
||||
<$let tv-config-toolbar-class={{{ [enlist<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]] +[join[ ]] }}}>
|
||||
<$reveal type="nomatch" state=<<config-title>> text="hide">
|
||||
<$transclude $tiddler=<<listItem>>/>
|
||||
</$reveal>
|
||||
</$let>
|
||||
</$list>
|
||||
</span>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
title: $:/core/ui/KeyboardShortcuts/refresh
|
||||
tags: $:/tags/KeyboardShortcut
|
||||
key: ((refresh))
|
||||
|
||||
<$action-sendmessage $message="tm-browser-refresh"/>
|
|
@ -1,17 +1,14 @@
|
|||
title: $:/core/ui/PageTemplate/pagecontrols
|
||||
|
||||
\whitespace trim
|
||||
\define config-title()
|
||||
$:/config/PageControlButtons/Visibility/$(listItem)$
|
||||
\end
|
||||
\function config-title() [[$:/config/PageControlButtons/Visibility/$(listItem)$]substitute[]]
|
||||
|
||||
<div class="tc-page-controls">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]]" variable="listItem">
|
||||
<$set name="hidden" value=<<config-title>>>
|
||||
<$list filter="[<hidden>!text[hide]]" storyview="pop" variable="ignore">
|
||||
<$set name="tv-config-toolbar-class" filter="[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]">
|
||||
<$transclude tiddler=<<listItem>> mode="inline"/>
|
||||
</$set>
|
||||
</$list>
|
||||
</$set>
|
||||
</$list>
|
||||
</div>
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]]" variable="listItem">
|
||||
<$list filter="[<config-title>!text[hide]]" storyview="pop" variable="ignore">
|
||||
<$let tv-config-toolbar-class={{{ [enlist<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]] +[join[ ]] }}}>
|
||||
<$transclude $tiddler=<<listItem>> $mode="inline"/>
|
||||
</$let>
|
||||
</$list>
|
||||
</$list>
|
||||
</div>
|
|
@ -4,48 +4,41 @@ caption: {{$:/core/images/down-arrow}} {{$:/language/Buttons/More/Caption}}
|
|||
description: {{$:/language/Buttons/More/Hint}}
|
||||
|
||||
\whitespace trim
|
||||
\define config-title()
|
||||
$:/config/PageControlButtons/Visibility/$(listItem)$
|
||||
\end
|
||||
<$button popup=<<qualify "$:/state/popup/more">> tooltip={{$:/language/Buttons/More/Hint}} aria-label={{$:/language/Buttons/More/Caption}} class=<<tv-config-toolbar-class>> selectedClass="tc-selected">
|
||||
<$list filter="[<tv-config-toolbar-icons>match[yes]]">
|
||||
{{$:/core/images/down-arrow}}
|
||||
</$list>
|
||||
<$list filter="[<tv-config-toolbar-text>match[yes]]">
|
||||
<span class="tc-btn-text">
|
||||
<$text text={{$:/language/Buttons/More/Caption}}/>
|
||||
</span>
|
||||
</$list>
|
||||
</$button><$reveal state=<<qualify "$:/state/popup/more">> type="popup" position="below" animate="yes">
|
||||
|
||||
<div class="tc-drop-down">
|
||||
|
||||
<$set name="tv-config-toolbar-icons" value="yes">
|
||||
|
||||
<$set name="tv-config-toolbar-text" value="yes">
|
||||
|
||||
<$set name="tv-config-toolbar-class" value="tc-btn-invisible">
|
||||
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]] -[[$:/core/ui/Buttons/more-page-actions]]" variable="listItem">
|
||||
|
||||
<$reveal type="match" state=<<config-title>> text="hide">
|
||||
|
||||
<$set name="tv-config-toolbar-class" filter="[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]">
|
||||
|
||||
<$transclude tiddler=<<listItem>> mode="inline"/>
|
||||
|
||||
</$set>
|
||||
|
||||
</$reveal>
|
||||
|
||||
</$list>
|
||||
|
||||
</$set>
|
||||
|
||||
</$set>
|
||||
|
||||
</$set>
|
||||
|
||||
</div>
|
||||
\define config-title() $:/config/PageControlButtons/Visibility/$(listItem)$
|
||||
|
||||
<$button popup=<<qualify "$:/state/popup/more">>
|
||||
tooltip={{$:/language/Buttons/More/Hint}}
|
||||
aria-label={{$:/language/Buttons/More/Caption}}
|
||||
class=<<tv-config-toolbar-class>>
|
||||
selectedClass="tc-selected"
|
||||
>
|
||||
<$list filter="[<tv-config-toolbar-icons>match[yes]]">
|
||||
{{$:/core/images/down-arrow}}
|
||||
</$list>
|
||||
<$list filter="[<tv-config-toolbar-text>match[yes]]">
|
||||
<span class="tc-btn-text">
|
||||
<$text text={{$:/language/Buttons/More/Caption}}/>
|
||||
</span>
|
||||
</$list>
|
||||
</$button>
|
||||
<$reveal state=<<qualify "$:/state/popup/more">> type="popup" position="below" animate="yes">
|
||||
<div class="tc-drop-down">
|
||||
<$set name="tv-config-toolbar-icons" value="yes">
|
||||
<$set name="tv-config-toolbar-text" value="yes">
|
||||
<$set name="tv-config-toolbar-class" value="tc-btn-invisible">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]] -[[$:/core/ui/Buttons/more-page-actions]]"
|
||||
variable="listItem"
|
||||
>
|
||||
<$reveal type="match" state=<<config-title>> text="hide">
|
||||
<$set name="tv-config-toolbar-class"
|
||||
filter="[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]"
|
||||
>
|
||||
<$transclude tiddler=<<listItem>> mode="inline"/>
|
||||
</$set>
|
||||
</$reveal>
|
||||
</$list>
|
||||
</$set>
|
||||
</$set>
|
||||
</$set>
|
||||
</div>
|
||||
</$reveal>
|
|
@ -2,31 +2,38 @@ title: $:/core/ui/ViewTemplate/title
|
|||
tags: $:/tags/ViewTemplate
|
||||
|
||||
\whitespace trim
|
||||
\define title-styles()
|
||||
fill:$(foregroundColor)$;
|
||||
\end
|
||||
\define title-styles() fill:$(foregroundColor)$;
|
||||
|
||||
<div class="tc-tiddler-title">
|
||||
<div class="tc-titlebar">
|
||||
<span class="tc-tiddler-controls">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]] :filter[lookup[$:/config/ViewToolbarButtons/Visibility/]!match[hide]]" storyview="pop" variable="listItem"><$set name="tv-config-toolbar-class" filter="[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]"><$transclude tiddler=<<listItem>>/></$set></$list>
|
||||
</span>
|
||||
<$set name="tv-wikilinks" value={{$:/config/Tiddlers/TitleLinks}}>
|
||||
<$link>
|
||||
<$list filter="[<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] +[!is[blank]]" variable="ignore">
|
||||
<$let foregroundColor={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}>
|
||||
<span class="tc-tiddler-title-icon" style=<<title-styles>>>
|
||||
{{||$:/core/ui/TiddlerIcon}}
|
||||
</span>
|
||||
</$let>
|
||||
</$list>
|
||||
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/ViewTemplateTitleFilter]!is[draft]get[text]] :and[!is[blank]else[$:/core/ui/ViewTemplate/title/default]] }}} />
|
||||
</$link>
|
||||
</$set>
|
||||
</div>
|
||||
|
||||
<$reveal type="nomatch" text="" default="" state=<<tiddlerInfoState>> class="tc-tiddler-info tc-popup-handle" animate="yes" retain="yes">
|
||||
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TiddlerInfoSegment]!has[draft.of]] [[$:/core/ui/TiddlerInfo]]" variable="listItem"><$transclude tiddler=<<listItem>> mode="block"/></$list>
|
||||
|
||||
</$reveal>
|
||||
<div class="tc-titlebar">
|
||||
<span class="tc-tiddler-controls">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]] :filter[lookup[$:/config/ViewToolbarButtons/Visibility/]!match[hide]]"
|
||||
storyview="pop"
|
||||
variable="listItem"
|
||||
>
|
||||
<$set name="tv-config-toolbar-class" filter="[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]">
|
||||
<$transclude tiddler=<<listItem>>/>
|
||||
</$set>
|
||||
</$list>
|
||||
</span>
|
||||
<$set name="tv-wikilinks" value={{$:/config/Tiddlers/TitleLinks}}>
|
||||
<$link>
|
||||
<$list filter="[<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] +[!is[blank]]"
|
||||
variable="ignore"
|
||||
>
|
||||
<$let foregroundColor={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}>
|
||||
<span class="tc-tiddler-title-icon" style=<<title-styles>>>
|
||||
{{||$:/core/ui/TiddlerIcon}}
|
||||
</span>
|
||||
</$let>
|
||||
</$list>
|
||||
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/ViewTemplateTitleFilter]!is[draft]get[text]] :and[!is[blank]else[$:/core/ui/ViewTemplate/title/default]] }}} />
|
||||
</$link>
|
||||
</$set>
|
||||
</div>
|
||||
<$reveal tag="div" type="nomatch" text="" default="" state=<<tiddlerInfoState>> class="tc-tiddler-info tc-popup-handle" animate="yes" retain="yes">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TiddlerInfoSegment]!has[draft.of]] [[$:/core/ui/TiddlerInfo]]" variable="listItem">
|
||||
<$transclude tiddler=<<listItem>> mode="block"/>
|
||||
</$list>
|
||||
</$reveal>
|
||||
</div>
|
||||
|
|
|
@ -4,49 +4,41 @@ caption: {{$:/core/images/down-arrow}} {{$:/language/Buttons/More/Caption}}
|
|||
description: {{$:/language/Buttons/More/Hint}}
|
||||
|
||||
\whitespace trim
|
||||
\define config-title()
|
||||
$:/config/ViewToolbarButtons/Visibility/$(listItem)$
|
||||
\end
|
||||
<$button popup=<<qualify "$:/state/popup/more">> tooltip={{$:/language/Buttons/More/Hint}} aria-label={{$:/language/Buttons/More/Caption}} class=<<tv-config-toolbar-class>> selectedClass="tc-selected">
|
||||
<$list filter="[<tv-config-toolbar-icons>match[yes]]">
|
||||
{{$:/core/images/down-arrow}}
|
||||
</$list>
|
||||
<$list filter="[<tv-config-toolbar-text>match[yes]]">
|
||||
<span class="tc-btn-text">
|
||||
<$text text={{$:/language/Buttons/More/Caption}}/>
|
||||
</span>
|
||||
</$list>
|
||||
\define config-title() $:/config/ViewToolbarButtons/Visibility/$(listItem)$
|
||||
|
||||
<$button popup=<<qualify "$:/state/popup/more">>
|
||||
tooltip={{$:/language/Buttons/More/Hint}}
|
||||
aria-label={{$:/language/Buttons/More/Caption}}
|
||||
class=<<tv-config-toolbar-class>>
|
||||
selectedClass="tc-selected"
|
||||
>
|
||||
<$list filter="[<tv-config-toolbar-icons>match[yes]]">
|
||||
{{$:/core/images/down-arrow}}
|
||||
</$list>
|
||||
<$list filter="[<tv-config-toolbar-text>match[yes]]">
|
||||
<span class="tc-btn-text">
|
||||
<$text text={{$:/language/Buttons/More/Caption}}/>
|
||||
</span>
|
||||
</$list>
|
||||
</$button>
|
||||
<$reveal state=<<qualify "$:/state/popup/more">> type="popup" position="belowleft" animate="yes">
|
||||
|
||||
<div class="tc-drop-down">
|
||||
|
||||
<$set name="tv-config-toolbar-icons" value="yes">
|
||||
|
||||
<$set name="tv-config-toolbar-text" value="yes">
|
||||
|
||||
<$set name="tv-config-toolbar-class" value="tc-btn-invisible">
|
||||
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]] -[[$:/core/ui/Buttons/more-tiddler-actions]]" variable="listItem">
|
||||
|
||||
<$reveal type="match" state=<<config-title>> text="hide">
|
||||
|
||||
<$set name="tv-config-toolbar-class" filter="[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]">
|
||||
|
||||
<$transclude tiddler=<<listItem>> mode="inline"/>
|
||||
|
||||
</$set>
|
||||
|
||||
</$reveal>
|
||||
|
||||
</$list>
|
||||
|
||||
</$set>
|
||||
|
||||
</$set>
|
||||
|
||||
</$set>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tc-drop-down">
|
||||
<$set name="tv-config-toolbar-icons" value="yes">
|
||||
<$set name="tv-config-toolbar-text" value="yes">
|
||||
<$set name="tv-config-toolbar-class" value="tc-btn-invisible">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]] -[[$:/core/ui/Buttons/more-tiddler-actions]]"
|
||||
variable="listItem"
|
||||
>
|
||||
<$reveal type="match" state=<<config-title>> text="hide">
|
||||
<$set name="tv-config-toolbar-class"
|
||||
filter="[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]"
|
||||
>
|
||||
<$transclude tiddler=<<listItem>> mode="inline"/>
|
||||
</$set>
|
||||
</$reveal>
|
||||
</$list>
|
||||
</$set>
|
||||
</$set>
|
||||
</$set>
|
||||
</div>
|
||||
</$reveal>
|
|
@ -35,6 +35,7 @@ new-tiddler: {{$:/language/Buttons/NewTiddler/Hint}}
|
|||
picture: {{$:/language/Buttons/Picture/Hint}}
|
||||
preview: {{$:/language/Buttons/Preview/Hint}}
|
||||
quote: {{$:/language/Buttons/Quote/Hint}}
|
||||
refresh: {{$:/language/Buttons/Refresh/Hint}}
|
||||
save-tiddler: {{$:/language/Buttons/Save/Hint}}
|
||||
save-wiki: {{$:/language/Buttons/SaveWiki/Hint}}
|
||||
sidebar-search: {{$:/language/Buttons/SidebarSearch/Hint}}
|
||||
|
|
|
@ -6,4 +6,5 @@ underline: meta-U
|
|||
new-image: ctrl-I
|
||||
new-journal: ctrl-J
|
||||
new-tiddler: ctrl-N
|
||||
refresh: meta-R
|
||||
save-wiki: meta-S
|
||||
|
|
|
@ -6,3 +6,4 @@ underline: ctrl-U
|
|||
new-image: alt-I
|
||||
new-journal: alt-J
|
||||
new-tiddler: alt-N
|
||||
refresh: ctrl-R
|
||||
|
|
|
@ -1,167 +1,182 @@
|
|||
title: $:/core/macros/tag-picker
|
||||
tags: $:/tags/Macro $:/tags/Global
|
||||
first-search-filter: [tags[]!is[system]search:title<userInput>sort[]]
|
||||
second-search-filter: [tags[]is[system]search:title<userInput>sort[]]
|
||||
tags: tags: $:/tags/Macro $:/tags/Global
|
||||
first-search-filter: [subfilter<tagListFilter>!is[system]search:title<userInput>sort[]]
|
||||
second-search-filter: [subfilter<tagListFilter>is[system]search:title<userInput>sort[]]
|
||||
|
||||
\procedure get-tagpicker-focus-selector()
|
||||
\function currentTiddlerCSSEscaped() [<saveTiddler>escapecss[]]
|
||||
[data-tiddler-title=`$(currentTiddlerCSSEscaped)$`] .tc-add-tag-name input
|
||||
<!-- first-search-filter and second-search-filter fields are not used here in the code, but they are defined as parameters for keyboard-driven-input macro -->
|
||||
|
||||
\whitespace trim
|
||||
|
||||
<!-- tf.tagpicker-dropdown-id is needed if several tap-pickers are shown in one tiddler -->
|
||||
\function tf.tagpicker-dropdown-id()
|
||||
[<qualify $:/state/popup/tags-auto-complete>]
|
||||
[[$(saveTiddler)$-[$(tagField)$-$(tagListFilter)$]substitute[]sha256[]] +[join[/]]
|
||||
\end
|
||||
|
||||
\procedure delete-tag-state-tiddlers() <$action-deletetiddler $filter="[<newTagNameTiddler>] [<storeTitle>] [<tagSelectionState>]"/>
|
||||
\function tf.tagpicker-dropdown-class() [<tf.tagpicker-dropdown-id>sha256[]addprefix[tc-]]
|
||||
\function tf.get-tagpicker-focus-selector() [<tf.tagpicker-dropdown-class>addprefix[.]] .tc-popup-handle +[join[ ]]
|
||||
|
||||
<!-- clean up temporary tiddlers, so the next "pick" starts with a clean input -->
|
||||
<!-- This could probably be optimized / removed if we would use different temp-tiddlers
|
||||
(future improvement because keeping track is comlex for humans)
|
||||
-->
|
||||
\procedure delete-tag-state-tiddlers()
|
||||
<$action-deletetiddler $filter="[<newTagNameTiddler>] [<storeTitle>] [<tagSelectionState>]"/>
|
||||
\end
|
||||
|
||||
<!-- trigger __toggle tag__ by keyboard -->
|
||||
\procedure add-tag-actions()
|
||||
\whitespace trim
|
||||
<$let tag=<<tag>>>
|
||||
<$action-listops $tiddler=<<saveTiddler>> $field=<<tagField>> $subfilter='+[toggle<tag>trim[]]'/>
|
||||
<$list
|
||||
filter="[<tag>] :intersection[<saveTiddler>get<tagField>enlist-input[]]"
|
||||
variable="ignore"
|
||||
emptyMessage="<<actions>>"
|
||||
/>
|
||||
</$let>
|
||||
<<delete-tag-state-tiddlers>>
|
||||
<$action-setfield $tiddler=<<refreshTitle>> text="yes"/>
|
||||
\end
|
||||
|
||||
\procedure clear-tags-actions-inner()
|
||||
\whitespace trim
|
||||
<$list
|
||||
filter="[<storeTitle>has[text]] ~[<newTagNameTiddler>has[text]]"
|
||||
variable="ignore"
|
||||
emptyMessage="<<cancel-delete-tiddler-actions 'cancel'>>"
|
||||
>
|
||||
<$let tag=<<_tf.getTag>> >
|
||||
<$action-listops $tiddler=<<saveTiddler>> $field=<<tagField>> $subfilter='+[toggle<tag>trim[]]'/>
|
||||
<% if [<tag>] :intersection[<saveTiddler>get<tagField>enlist-input[]] %>
|
||||
<!-- tag has been removed - do nothing -->
|
||||
<% else %>
|
||||
<<actions>>
|
||||
<% endif %>
|
||||
<<delete-tag-state-tiddlers>>
|
||||
</$list>
|
||||
<$action-setfield $tiddler=<<refreshTitle>> text="yes"/>
|
||||
</$let>
|
||||
\end
|
||||
<!-- <$action-log /> -->
|
||||
|
||||
<!-- ESC key removes the text from the input
|
||||
The second ESC tries to close the "draft tiddler"
|
||||
-->
|
||||
\procedure clear-tags-actions-inner()
|
||||
<% if [<storeTitle>has[text]] ~[<newTagNameTiddler>has[text]] %>
|
||||
<<delete-tag-state-tiddlers>>
|
||||
<% else %>
|
||||
<<cancel-delete-tiddler-actions "cancel">>
|
||||
<% endif %>
|
||||
\end
|
||||
|
||||
<!-- triggered by keyboard only -->
|
||||
\procedure clear-tags-actions()
|
||||
\whitespace trim
|
||||
<$let userInput=<<userInput>>>
|
||||
<$list
|
||||
filter="[<newTagNameTiddler>get[text]!match<userInput>]"
|
||||
emptyMessage="<<clear-tags-actions-inner>>"
|
||||
>
|
||||
<$let userInput=<<_tf.getUserInput>> >
|
||||
<!-- this list __cannot__ be transformed to conditional IF. The list variable is used! -->
|
||||
<$list filter="[<newTagNameTiddler>get[text]!match<userInput>]" >
|
||||
<$list-empty>
|
||||
<<clear-tags-actions-inner>>
|
||||
</$list-empty>
|
||||
<$action-setfield $tiddler=<<newTagNameTiddler>> text=<<userInput>>/>
|
||||
<$action-setfield $tiddler=<<refreshTitle>> text="yes"/>
|
||||
</$list>
|
||||
</$let>
|
||||
\end
|
||||
|
||||
<!-- similar to add-tag-actions __but__ add-only -->
|
||||
\procedure add-button-actions()
|
||||
<$action-listops $tiddler=<<saveTiddler>> $field=<<tagField>> $subfilter="[<tag>trim[]]"/>
|
||||
<<actions>>
|
||||
<<delete-tag-state-tiddlers>>
|
||||
<$action-sendmessage $message="tm-focus-selector" $param=<<get-tagpicker-focus-selector>>/>
|
||||
<$action-sendmessage $message="tm-focus-selector" $param=<<tf.get-tagpicker-focus-selector>>/>
|
||||
\end
|
||||
<!-- <$action-log /> -->
|
||||
|
||||
\procedure list-tags(filter, suffix)
|
||||
\whitespace trim
|
||||
<$list
|
||||
filter="[<userInput>minlength{$:/config/Tags/MinLength}limit[1]]"
|
||||
emptyMessage="<div class='tc-search-results'>{{$:/language/Search/Search/TooShort}}</div>" variable="listItem"
|
||||
>
|
||||
<$list filter=<<filter>> variable="tag">
|
||||
<$let
|
||||
button-classes=`tc-btn-invisible ${ [<tag>addsuffix<suffix>] -[<tagSelectionState>get[text]] :then[[]] ~tc-tag-button-selected }$`
|
||||
currentTiddler=<<tag>>
|
||||
>
|
||||
{{||$:/core/ui/TagPickerTagTemplate}}
|
||||
</$let>
|
||||
<!-- create dropdown list -->
|
||||
\procedure tag-picker-listTags(filter, suffix)
|
||||
<$let userInput=<<_tf.getUserInput>> >
|
||||
<$list filter="[<userInput>minlength{$:/config/Tags/MinLength}limit[1]]"
|
||||
emptyMessage="<div class='tc-search-results'>{{$:/language/Search/Search/TooShort}}</div>" variable="listItem"
|
||||
>
|
||||
<$list filter=<<filter>> variable="tag">
|
||||
<!-- The buttonClasses filter is used to define tc-tag-button-selected state -->
|
||||
<!-- tf.get-tagpicker-focus-selector has to be resolved for $:/core/ui/TagPickerTagTemplate,
|
||||
othwerwise qualify in tf.tagpicker-dropdown-id causes problems -->
|
||||
<$let currentTiddler=<<tag>>
|
||||
button-classes=`tc-btn-invisible ${[<tag>addsuffix<suffix>] -[<tagSelectionState>get[text]] :then[[]] ~tc-tag-button-selected }$`
|
||||
get-tagpicker-focus-selector=`${[<tf.get-tagpicker-focus-selector>]}$`
|
||||
>
|
||||
{{||$:/core/ui/TagPickerTagTemplate}}
|
||||
</$let>
|
||||
</$list>
|
||||
</$list>
|
||||
</$list>
|
||||
</$let>
|
||||
\end
|
||||
|
||||
<!-- tag-picker-inner is the main function -->
|
||||
\procedure tag-picker-inner()
|
||||
\whitespace trim
|
||||
<div class={{{ [[tc-edit-add-tag]] [<tf.tagpicker-dropdown-class>] +[join[ ]] }}}>
|
||||
<div class="tc-edit-add-tag-ui">
|
||||
<span class="tc-add-tag-name tc-small-gap-right">
|
||||
<$macrocall $name="keyboard-driven-input"
|
||||
tiddler=<<newTagNameTiddler>>
|
||||
storeTitle=<<storeTitle>>
|
||||
refreshTitle=<<refreshTitle>>
|
||||
selectionStateTitle=<<tagSelectionState>>
|
||||
inputAcceptActions=<<add-tag-actions>>
|
||||
inputCancelActions=<<clear-tags-actions>>
|
||||
tag="input"
|
||||
placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}}
|
||||
focusPopup=<<tf.tagpicker-dropdown-id>>
|
||||
class="tc-edit-texteditor tc-popup-handle"
|
||||
tabindex=<<tabIndex>>
|
||||
focus={{{ [{$:/config/AutoFocus}match[tags]then[true]] ~[[false]] }}}
|
||||
filterMinLength={{$:/config/Tags/MinLength}}
|
||||
cancelPopups=<<cancelPopups>>
|
||||
configTiddlerFilter="[[$:/core/macros/tag-picker]]"
|
||||
/>
|
||||
</span>
|
||||
<$button popup=<<tf.tagpicker-dropdown-id>> class="tc-btn-invisible tc-btn-dropdown"
|
||||
tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}}
|
||||
>
|
||||
{{$:/core/images/down-arrow}}
|
||||
</$button>
|
||||
<% if [<storeTitle>has[text]] %>
|
||||
<$button actions=<<delete-tag-state-tiddlers>> class="tc-btn-invisible tc-small-gap tc-btn-dropdown"
|
||||
tooltip={{$:/language/EditTemplate/Tags/ClearInput/Hint}} aria-label={{$:/language/EditTemplate/Tags/ClearInput/Caption}}
|
||||
>
|
||||
{{$:/core/images/close-button}}
|
||||
</$button>
|
||||
<% endif %>
|
||||
<span class="tc-add-tag-button tc-small-gap-left">
|
||||
<$let tag=<<_tf.getTag>>>
|
||||
<$button set=<<newTagNameTiddler>> actions=<<add-button-actions>> >
|
||||
{{$:/language/EditTemplate/Tags/Add/Button}}
|
||||
</$button>
|
||||
</$let>
|
||||
</span>
|
||||
</div>
|
||||
<div class="tc-block-dropdown-wrapper">
|
||||
<% if [<tf.tagpicker-dropdown-id>has[text]] %>
|
||||
<div class="tc-block-dropdown tc-block-tags-dropdown">
|
||||
<$macrocall $name="tag-picker-listTags" filter=<<nonSystemTagsFilter>> suffix="-primaryList" />
|
||||
<hr>
|
||||
<$macrocall $name="tag-picker-listTags" filter=<<systemTagsFilter>> suffix="-secondaryList" />
|
||||
</div>
|
||||
<% endif %>
|
||||
</div>
|
||||
</div>
|
||||
\end
|
||||
|
||||
<!-- prepare all variables for tag-picker keyboard handling -->
|
||||
\procedure tag-picker(actions, tagField:"tags", tiddler, tagListFilter:"[tags[]]")
|
||||
|
||||
\function _tf.getUserInput() [<storeTitle>get[text]]
|
||||
\function _tf.getTag() [<newTagNameTiddler>get[text]]
|
||||
|
||||
<!-- keep those variables because they may "blead" into macros using old syntax -->
|
||||
<$let
|
||||
newTagNameInputTiddlerQualified=<<qualify "$:/temp/NewTagName/input">>
|
||||
newTagNameSelectionTiddlerQualified=<<qualify "$:/temp/NewTagName/selected-item">>
|
||||
fallbackTarget={{{ [<palette>getindex[tag-background]] }}}
|
||||
palette={{$:/palette}}
|
||||
colourA={{{ [<palette>getindex[foreground]] }}}
|
||||
colourB={{{ [<palette>getindex[background]] }}}
|
||||
fallbackTarget={{{ [<palette>getindex[tag-background]] }}}
|
||||
|
||||
storeTitle={{{ [<newTagNameInputTiddler>!match[]] ~[<newTagNameInputTiddlerQualified>] }}}
|
||||
saveTiddler={{{ [<tiddler>is[blank]then<currentTiddler>else<tiddler>] }}}
|
||||
|
||||
newTagNameTiddler={{{ [[$:/temp/NewTagName]] [<tagField>!match[tags]] +[join[/]] [<qualify>] +[join[]] }}}
|
||||
storeTitle={{{ [[$:/temp/NewTagName/input]] [<tagField>!match[tags]] +[join[/]] [<qualify>] +[join[]] }}}
|
||||
|
||||
newTagNameSelectionTiddlerQualified=<<qualify "$:/temp/NewTagName/selected-item">>
|
||||
tagSelectionState={{{ [<newTagNameSelectionTiddler>!match[]] ~[<newTagNameSelectionTiddlerQualified>] }}}
|
||||
tagAutoComplete=<<qualify "$:/state/popup/tags-auto-complete">>
|
||||
|
||||
refreshTitle=<<qualify "$:/temp/NewTagName/refresh">>
|
||||
nonSystemTagsFilter="[tags[]!is[system]search:title<userInput>sort[]]"
|
||||
systemTagsFilter="[tags[]is[system]search:title<userInput>sort[]]"
|
||||
>
|
||||
<div class="tc-edit-add-tag">
|
||||
<div>
|
||||
<span class="tc-add-tag-name tc-small-gap-right">
|
||||
<$transclude
|
||||
$variable="keyboard-driven-input"
|
||||
tiddler=<<newTagNameTiddler>>
|
||||
storeTitle=<<storeTitle>>
|
||||
refreshTitle=<<refreshTitle>>
|
||||
selectionStateTitle=<<tagSelectionState>>
|
||||
inputAcceptActions=<<add-tag-actions>>
|
||||
inputCancelActions=<<clear-tags-actions>>
|
||||
tag="input"
|
||||
placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}}
|
||||
focusPopup=<<tagAutoComplete>>
|
||||
class="tc-edit-texteditor tc-popup-handle"
|
||||
tabindex=<<tabIndex>>
|
||||
focus={{{ [{$:/config/AutoFocus}match[tags]then[true]] ~[[false]] }}}
|
||||
filterMinLength={{$:/config/Tags/MinLength}}
|
||||
cancelPopups=<<cancelPopups>>
|
||||
configTiddlerFilter="[[$:/core/macros/tag-picker]]"
|
||||
/>
|
||||
</span>
|
||||
<$button popup=<<tagAutoComplete>>
|
||||
class="tc-btn-invisible tc-btn-dropdown"
|
||||
tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}}
|
||||
aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}}
|
||||
>
|
||||
{{$:/core/images/down-arrow}}
|
||||
</$button>
|
||||
<$reveal state=<<storeTitle>> type="nomatch" text="">
|
||||
<$button actions=<<delete-tag-state-tiddlers>>
|
||||
class="tc-btn-invisible tc-small-gap tc-btn-dropdown"
|
||||
tooltip={{$:/language/EditTemplate/Tags/ClearInput/Hint}}
|
||||
aria-label={{$:/language/EditTemplate/Tags/ClearInput/Caption}}
|
||||
>
|
||||
{{$:/core/images/close-button}}
|
||||
</$button>
|
||||
</$reveal>
|
||||
<span class="tc-add-tag-button tc-small-gap-left">
|
||||
<$let tag=<<tag>>>
|
||||
<$button set=<<newTagNameTiddler>> setTo=""
|
||||
actions=<<add-button-actions>>
|
||||
>
|
||||
{{$:/language/EditTemplate/Tags/Add/Button}}
|
||||
</$button>
|
||||
</$let>
|
||||
</span>
|
||||
</div>
|
||||
<div class="tc-block-dropdown-wrapper">
|
||||
<$reveal state=<<tagAutoComplete>> type="nomatch" text="">
|
||||
<div class="tc-block-dropdown tc-block-tags-dropdown">
|
||||
<$let userInput=<<userInput>>>
|
||||
<$transclude $variable="list-tags" filter=<<nonSystemTagsFilter>> suffix="-primaryList" />
|
||||
<hr>
|
||||
<$transclude $variable="list-tags" filter=<<systemTagsFilter>> suffix="-secondaryList" />
|
||||
</$let>
|
||||
</div>
|
||||
</$reveal>
|
||||
</div>
|
||||
</div>
|
||||
</$let>
|
||||
\end
|
||||
refreshTitle=<<qualify "$:/temp/NewTagName/refresh">>
|
||||
|
||||
\procedure tag-picker(actions, tagField:"tags")
|
||||
\function userInput() [<storeTitle>get[text]]
|
||||
\function tag() [<newTagNameTiddler>get[text]]
|
||||
\whitespace trim
|
||||
<$let
|
||||
saveTiddler=<<currentTiddler>>
|
||||
palette={{$:/palette}}
|
||||
qualified=<<qualify "$:/temp/NewTagName">>
|
||||
newTagNameTiddler={{{ [<newTagNameTiddler>!match[]] ~[<qualified>] }}}
|
||||
nonSystemTagsFilter="[subfilter<tagListFilter>!is[system]search:title<userInput>sort[]]"
|
||||
systemTagsFilter="[subfilter<tagListFilter>is[system]search:title<userInput>sort[]]"
|
||||
|
||||
cancelPopups="yes"
|
||||
>
|
||||
<$transclude $variable="tag-picker-inner" />
|
||||
<$macrocall $name="tag-picker-inner"/>
|
||||
</$let>
|
||||
\end
|
||||
\end
|
|
@ -21,7 +21,9 @@ color:$(foregroundColor)$;
|
|||
>
|
||||
<<__actions__>>
|
||||
<$transclude tiddler=<<__icon__>>/>
|
||||
<$view tiddler=<<__tag__>> field="title" format="text" />
|
||||
<span class={{{ [<__tag__>is[missing]then[tc-tag-missing]else[tc-tag-exists]] }}}>
|
||||
<$view tiddler=<<__tag__>> field="title" format="text" />
|
||||
</span>
|
||||
</$element-tag$>
|
||||
</$let>
|
||||
\end
|
||||
|
|
|
@ -16,6 +16,7 @@ Welcome to the developer documentation for TiddlyWiki (https://tiddlywiki.com/).
|
|||
** [[Adding Babel Polyfill to TiddlyWiki]]
|
||||
** [[TiddlyWiki Drag and Drop Interoperability]]
|
||||
** [[Javascript Widget Tutorial]]
|
||||
** [[Using TiddlyWiki as a library in another Node.js application]]
|
||||
* The original developer documentation from https://tiddlywiki.com:
|
||||
** [[TiddlyWiki for Developers]]
|
||||
** [[TiddlyWiki Coding Style Guidelines]]
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
title: Using TiddlyWiki as a library in another Node.js application
|
||||
|
||||
Node.js applications can include TiddlyWiki as a library so that they can use wikitext rendering.
|
||||
|
||||
See the demo at https://github.com/Jermolene/TiddlyWiki5DemoApp
|
|
@ -0,0 +1,6 @@
|
|||
created: 20240311150859344
|
||||
modified: 20240311150859344
|
||||
title: $:/themes/tiddlywiki/vanilla/options/sidebarlayout
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
fluid-fixed
|
|
@ -0,0 +1,27 @@
|
|||
title: Macros/unusedtitle/basic-draft-exists
|
||||
description: test <<unusedtitle>> with basic macro parameters but they are empty
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Draft of 'test'
|
||||
draft.of: test
|
||||
draft.title: test
|
||||
|
||||
+
|
||||
title: Draft of 'asdf 0'
|
||||
draft.of: asdf 0
|
||||
draft.title: asdf 0
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
<!-- hanled in wiki.js -->
|
||||
<<unusedtitle baseName:"test">>
|
||||
|
||||
<!-- handled in unusedtitle.js -->
|
||||
<<unusedtitle baseName:"asdf" separator:" " template:"$basename$$separator$$count:1$">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>test 1</p><p>asdf 1</p>
|
|
@ -0,0 +1,23 @@
|
|||
title: Macros/unusedtitle/basic-params-empty-tiddler-exists
|
||||
description: test <<unusedtitle>> with basic macro parameters but they are empty
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: New Tiddler
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
<!-- hanled in wiki.js -->
|
||||
<<unusedtitle separator:"">>
|
||||
|
||||
<!-- handled in unusedtitle.js -->
|
||||
<<unusedtitle baseName:"">>
|
||||
|
||||
<!-- handled in wiki.js -->
|
||||
<<unusedtitle template:"">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler 1</p><p>New Tiddler 1</p><p>New Tiddler 1</p>
|
|
@ -0,0 +1,20 @@
|
|||
title: Macros/unusedtitle/basic-params-empty
|
||||
description: test <<unusedtitle>> with basic macro parameters but they are empty
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
<!-- hanled in wiki.js -->
|
||||
<<unusedtitle separator:"">>
|
||||
|
||||
<!-- handled in unusedtitle.js -->
|
||||
<<unusedtitle baseName:"">>
|
||||
|
||||
<!-- handled in wiki.js -->
|
||||
<<unusedtitle template:"">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler</p><p>New Tiddler</p><p>New Tiddler</p>
|
|
@ -0,0 +1,28 @@
|
|||
title: Macros/unusedtitle/basic-params-tiddlers-exist
|
||||
description: test <<unusedtitle>> with basic macro parameters, where new-name tiddlers already exist
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: New Tiddler
|
||||
|
||||
+
|
||||
title: anotherBase
|
||||
|
||||
+
|
||||
title: About
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
<<unusedtitle>>
|
||||
|
||||
<<unusedtitle separator:"-">>
|
||||
|
||||
<<unusedtitle baseName:"anotherBase">>
|
||||
|
||||
<<unusedtitle baseName:"About" separator:"-">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler 1</p><p>New Tiddler-1</p><p>anotherBase 1</p><p>About-1</p>
|
|
@ -0,0 +1,20 @@
|
|||
title: Macros/unusedtitle/basic-params
|
||||
description: test <<unusedtitle>> with basic macro parameters
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
<<unusedtitle>>
|
||||
|
||||
<!-- EDGECASE: separator is ignored if tiddler title does not exist -->
|
||||
<<unusedtitle separator:"-">>
|
||||
|
||||
<<unusedtitle baseName:"anotherBase">>
|
||||
|
||||
<<unusedtitle baseName:"About" separator:"-">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler</p><p>New Tiddler</p><p>anotherBase</p><p>About</p>
|
|
@ -0,0 +1,50 @@
|
|||
title: Macros/unusedtitle/template-empty-params-tiddler-exist
|
||||
description: test <<unusedtitle>> with templates where parameters are empty
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: New Tiddler
|
||||
|
||||
+
|
||||
title: xxx
|
||||
|
||||
+
|
||||
title: 00-New Tiddler
|
||||
|
||||
+
|
||||
title: 0000 asdf
|
||||
|
||||
+
|
||||
title: 0001 asdf
|
||||
|
||||
+
|
||||
title: 0000 abc
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
<!-- empty template - no template handling at all -->
|
||||
<<unusedtitle template:"">>
|
||||
|
||||
<!--
|
||||
uses basename AND separator if tiddler exists
|
||||
because it uses default naming build rules - no template handling
|
||||
-->
|
||||
<<unusedtitle template:"" separator:"-y-" baseName:"xxx">>
|
||||
|
||||
<<unusedtitle baseName:"" template:"$count:2$-$basename$">>
|
||||
|
||||
<!--
|
||||
EDGECASE: if separator is empty it will be initialized with a single space " "
|
||||
to have the same rules for templates and default title creation
|
||||
-->
|
||||
<<unusedtitle baseName:"asdf" separator:"" template:"$count:4$$separator$$basename$">>
|
||||
|
||||
<!-- separator = " " -->
|
||||
<<unusedtitle baseName:"abc" separator:" " template:"$count:4$$separator$$basename$">>
|
||||
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler 1</p><p>xxx-y-1</p><p>01-New Tiddler</p><p>0002 asdf</p><p>0001 abc</p>
|
|
@ -0,0 +1,24 @@
|
|||
title: Macros/unusedtitle/template-empty-params
|
||||
description: test <<unusedtitle>> with templates where parameters are empty
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
<!-- empty template -->
|
||||
<<unusedtitle template:"">>
|
||||
|
||||
<!--
|
||||
uses basename but ignores separator,
|
||||
because it uses default naming build rules -- no template handling is active
|
||||
-->
|
||||
<<unusedtitle template:"" separator:"-x-" baseName:"xxx">>
|
||||
|
||||
<<unusedtitle baseName:"" template:"$count:2$-$basename$">>
|
||||
|
||||
<<unusedtitle baseName:"asdf" separator:"" template:"$count:4$$separator$$basename$">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler</p><p>xxx</p><p>00-New Tiddler</p><p>0000 asdf</p>
|
|
@ -0,0 +1,28 @@
|
|||
title: Macros/unusedtitle/template
|
||||
description: test <<unusedtitle>> with templates
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
<!-- empty template - standard rules are used -->
|
||||
<<unusedtitle template:"">>
|
||||
|
||||
<<unusedtitle template:"count-missing">>
|
||||
|
||||
<<unusedtitle template:"$count:2$-new">>
|
||||
|
||||
<!-- template is handled using $tw.utils.formatTitleString -->
|
||||
<<unusedtitle baseName:"base" template:"$count:2$-$basename$">>
|
||||
|
||||
<<unusedtitle baseName:"" template:"$count:2$-$basename$">>
|
||||
|
||||
<!-- UPPERCASES are intentional in template strings. They should be case-insensistive -->
|
||||
<<unusedtitle baseName:"asdf" separator:"-" template:"$coUNT:2$$sepaRATor$$baseName$">>
|
||||
|
||||
<<unusedtitle baseName:"asdf" separator:"" template:"$count:2$$separator$$basename$">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>New Tiddler</p><p>count-missing</p><p>00-new</p><p>00-base</p><p>00-New Tiddler</p><p>00-asdf</p><p>00 asdf</p>
|
|
@ -0,0 +1,176 @@
|
|||
/*\
|
||||
title: test-action-deletefield.js
|
||||
type: application/javascript
|
||||
tags: [[$:/tags/test-spec]]
|
||||
|
||||
Tests <$action-deletefield />.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/* jslint node: true, browser: true */
|
||||
/* eslint-env node, browser, jasmine */
|
||||
/* eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
|
||||
/* global $tw, require */
|
||||
"use strict";
|
||||
|
||||
describe("<$action-deletefield /> tests", function() {
|
||||
|
||||
const TEST_TIDDLER_TITLE = "TargetTiddler";
|
||||
const TEST_TIDDLER_MODIFIED = "20240313114828368";
|
||||
|
||||
function setupWiki(condition, targetField, wikiOptions) {
|
||||
// Create a wiki
|
||||
var wiki = new $tw.Wiki({});
|
||||
var tiddlers = [{
|
||||
title: "Root",
|
||||
text: "Some dummy content"
|
||||
}];
|
||||
var tiddler;
|
||||
if(condition.targetTiddlerExists) {
|
||||
var fields = {
|
||||
title: TEST_TIDDLER_TITLE,
|
||||
};
|
||||
if(condition.modifiedFieldExists) {
|
||||
fields.modified = TEST_TIDDLER_MODIFIED;
|
||||
}
|
||||
if(condition.targetFieldExists) {
|
||||
fields[targetField] = "some text";
|
||||
}
|
||||
var tiddler = new $tw.Tiddler(fields);
|
||||
tiddlers.push(tiddler);
|
||||
}
|
||||
wiki.addTiddlers(tiddlers);
|
||||
wiki.addIndexersToWiki();
|
||||
var widgetNode = wiki.makeTranscludeWidget("Root",{document: $tw.fakeDocument, parseAsInline: true});
|
||||
var container = $tw.fakeDocument.createElement("div");
|
||||
widgetNode.render(container,null);
|
||||
return {
|
||||
wiki: wiki,
|
||||
widgetNode: widgetNode,
|
||||
contaienr: container,
|
||||
tiddler: tiddler,
|
||||
};
|
||||
}
|
||||
|
||||
function generateTestConditions() {
|
||||
var conditions = [];
|
||||
|
||||
$tw.utils.each([true, false], function(tiddlerArgumentIsPresent) {
|
||||
$tw.utils.each([true, false], function(targetTiddlerExists) {
|
||||
$tw.utils.each([true, false], function(targetFieldExists) {
|
||||
$tw.utils.each([true, false], function(fieldArgumentIsUsed) {
|
||||
$tw.utils.each([true, false], function(modifiedFieldExists) {
|
||||
$tw.utils.each(["", "yes", "no"], function(timestampArgument) {
|
||||
conditions.push({
|
||||
tiddlerArgumentIsPresent: tiddlerArgumentIsPresent,
|
||||
targetTiddlerExists: targetTiddlerExists,
|
||||
targetFieldExists: targetFieldExists,
|
||||
fieldArgumentIsUsed: fieldArgumentIsUsed,
|
||||
modifiedFieldExists: modifiedFieldExists,
|
||||
timestampArgument: timestampArgument,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return conditions;
|
||||
}
|
||||
|
||||
function generateActionWikitext(condition, targetField) {
|
||||
var actionPieces = [
|
||||
"<$action-deletefield",
|
||||
(condition.tiddlerArgumentIsPresent ? "$tiddler='" + TEST_TIDDLER_TITLE + "'" : ""),
|
||||
(condition.fieldArgumentIsUsed ? "$field='" + targetField + "'" : targetField),
|
||||
(condition.timestampArgument !== "" ? "$timestamp='" + condition.timestampArgument + "'" : ""),
|
||||
"/>",
|
||||
];
|
||||
|
||||
return actionPieces.join(" ");
|
||||
}
|
||||
|
||||
function generateTestContext(action, tiddler) {
|
||||
var expectationContext = "action: " + action + "\ntiddler:\n\n";
|
||||
if(tiddler) {
|
||||
expectationContext += tiddler.getFieldStringBlock({exclude: ["text"]});
|
||||
if(tiddler.text) {
|
||||
expectationContext += "\n\n" + tiddler.text;
|
||||
}
|
||||
expectationContext += "\n\n";
|
||||
} else {
|
||||
expectationContext += "null";
|
||||
}
|
||||
|
||||
return expectationContext;
|
||||
}
|
||||
|
||||
it("should correctly delete fields", function() {
|
||||
var fields = ['caption', 'description', 'text'];
|
||||
|
||||
var conditions = generateTestConditions();
|
||||
|
||||
$tw.utils.each(conditions, function(condition) {
|
||||
$tw.utils.each(fields, function(field) {
|
||||
var info = setupWiki(condition, field);
|
||||
var originalTiddler = info.tiddler;
|
||||
|
||||
var invokeActions = function(actions) {
|
||||
info.widgetNode.invokeActionString(actions,info.widgetNode,null,{
|
||||
currentTiddler: TEST_TIDDLER_TITLE,
|
||||
});
|
||||
};
|
||||
|
||||
var action = generateActionWikitext(condition,field);
|
||||
|
||||
invokeActions(action);
|
||||
|
||||
var testContext = generateTestContext(action,originalTiddler);
|
||||
|
||||
var tiddler = info.wiki.getTiddler(TEST_TIDDLER_TITLE);
|
||||
if(originalTiddler) {
|
||||
// assert that the tiddler doesn't have the target field anymore
|
||||
expect(tiddler.hasField(field)).withContext(testContext).toBeFalsy();
|
||||
|
||||
var targetFieldWasPresent = originalTiddler.hasField(field);
|
||||
var updateTimestamps = condition.timestampArgument !== "no";
|
||||
|
||||
// "created" should exist if it did beforehand, or if the tiddler changed and we asked the widget to update timestamps
|
||||
var createdFieldShouldExist = originalTiddler.hasField("created") || (targetFieldWasPresent && updateTimestamps);
|
||||
|
||||
// "created" should change only if it didn't exist beforehand and the tiddler changed and we asked the widget to update timestamps
|
||||
var createdFieldShouldChange = !originalTiddler.hasField("created") && (targetFieldWasPresent && updateTimestamps);
|
||||
|
||||
// "modified" should exist if it did beforehand, or if the tiddler changed and we asked the widget to update timestamps
|
||||
var modifiedFieldShouldExist = originalTiddler.hasField("modified") || (targetFieldWasPresent && updateTimestamps);
|
||||
|
||||
// "modified" should change if the tiddler changed and we asked the widget to update timestamps
|
||||
var modifiedFieldShouldChange = targetFieldWasPresent && updateTimestamps;
|
||||
|
||||
expect(tiddler.hasField("created")).withContext(testContext).toBe(createdFieldShouldExist);
|
||||
expect(tiddler.hasField("modified")).withContext(testContext).toBe(modifiedFieldShouldExist);
|
||||
|
||||
if(createdFieldShouldChange) {
|
||||
expect(tiddler.fields.created).withContext(testContext).not.toEqual(originalTiddler.fields.created);
|
||||
} else {
|
||||
expect(tiddler.fields.created).withContext(testContext).toEqual(originalTiddler.fields.created);
|
||||
}
|
||||
|
||||
if(modifiedFieldShouldChange) {
|
||||
expect(tiddler.fields.modified).withContext(testContext).not.toEqual(originalTiddler.fields.modified);
|
||||
} else {
|
||||
expect(tiddler.fields.modified).withContext(testContext).toEqual(originalTiddler.fields.modified);
|
||||
}
|
||||
} else {
|
||||
// assert that the tiddler didn't get created if it didn't exist already
|
||||
expect(tiddler).withContext(testContext).toBeUndefined();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})();
|
|
@ -26,88 +26,87 @@ describe("WikiText parser tests", function() {
|
|||
it("should parse tags", function() {
|
||||
expect(parse("<br>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 4, children : [ { type : 'element', tag : 'br', start : 0, end : 4, isBlock : false, attributes : { }, orderedAttributes: [ ] } ] } ]
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 4, rule: null, 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', start : 0, end : 5, children : [ { type : 'text', text : '</br>', start : 0, end : 5 } ] } ]
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 5, rule: null, children : [ { type : 'text', text : '</br>', start : 0, end : 5, rule: null } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 5, children : [ { type : 'element', tag : 'div', start : 0, end : 5, isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ ] } ] } ]
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 5, rule: null, 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', start : 0, end : 6, children : [ { type : 'element', tag : 'div', isSelfClosing : true, isBlock : false, attributes : { }, orderedAttributes: [ ], start : 0, end : 6 } ] } ]
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 6, rule: null, 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', start : 0, end : 11, children : [ { type : 'element', tag : 'div', isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ ], start : 0, end : 5 } ] } ]
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 11, rule: null, 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', start : 0, end : 20, children : [ { type : 'element', tag : 'div', start : 0, end : 20, isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ { type : 'text', text : 'some text', start : 5, end : 14 } ], start : 0, end : 5 } ] } ]
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 20, rule: null, 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, rule: null } ], start : 0, end : 20 } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div attribute>some text</div>")).toEqual(
|
||||
|
||||
[ { 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 : 15 } ] } ]
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 30, rule: null, 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, rule: null } ], 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', start : 0, end : 38, children : [ { type : 'element', tag : 'div', start: 0, end: 38, 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 : 23 } ] } ]
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 38, rule: null, 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, rule: null } ], start : 0, end : 38 } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div attribute={{TiddlerTitle}}>some text</div>")).toEqual(
|
||||
|
||||
[ { 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 : 32 } ] } ]
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 47, rule: null, 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, rule: null } ], 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', start: 0, end: 55, children : [ { type : 'reveal', tag: '$reveal', start : 0, 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 } ], end : 55, isBlock : false, children : [ ] } ] } ]
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 55, rule: null, 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', start: 0, end: 54, children : [ { type : 'element', tag : 'div', 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 : 39 } ] } ]
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 54, rule: null, 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, rule: null } ], 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', start: 0, end: 55, children : [ { type : 'element', tag : 'div', 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 : 40 } ] } ]
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 55, rule: null, 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, rule: null } ], 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', end : 39, isBlock : true, children : [ { type : 'element', tag : 'p', 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', rule: null, start : 41, end : 50, children : [ { type : 'text', text : 'some text', start : 41, end : 50, rule: null } ] } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div><div attribute={{TiddlerTitle!!field}}>\n\nsome text</div></div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 67, children : [ { type : 'element', start : 0, attributes : { }, orderedAttributes: [ ], tag : 'div', end : 5, 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 : 44, isBlock : true, children : [ { type : 'element', tag : 'p', start : 46, end : 55, children : [ { type : 'text', text : 'some text', start : 46, end : 55 } ] } ] } ] } ] } ]
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 67, rule: null, 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, rule: null, children : [ { type : 'text', text : 'some text', start : 46, end : 55, rule: null } ] } ] } ] } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div><div attribute={{TiddlerTitle!!field}}>\n\n!some heading</div></div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 71, children : [ { type : 'element', start : 0, attributes : { }, orderedAttributes: [ ], tag : 'div', end : 5, 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 : 44, isBlock : true, children : [ { type : 'element', tag : 'h1', attributes : { class : { type : 'string', value : '' } }, children : [ { type : 'text', text : 'some heading</div></div>', start : 47, end : 71 } ] } ] } ] } ] } ]
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 71, rule: null, 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, rule: null } ] } ] } ] } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div><div attribute={{TiddlerTitle!!field}}>\n!some heading</div></div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 70, children : [ { type : 'element', start : 0, attributes : { }, orderedAttributes: [ ], tag : 'div', end : 5, 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 : 44, isBlock : false, children : [ { type : 'text', text : '\n!some heading', start : 44, end : 58 } ] } ] } ] } ]
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 70, rule: null, 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, rule: null } ] } ] } ] } ]
|
||||
|
||||
);
|
||||
// Regression test for issue (#3306)
|
||||
expect(parse("<div><span><span>\n\nSome text</span></span></div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 48, children : [ { type : 'element', start : 0, attributes : { }, orderedAttributes: [ ], tag : 'div', end : 5, isBlock : false, children : [ { type : 'element', start : 5, attributes : { }, orderedAttributes: [ ], tag : 'span', end : 11, isBlock : false, children : [ { type : 'element', start : 11, attributes : { }, orderedAttributes: [ ], tag : 'span', end : 17, isBlock : true, children : [ { type : 'element', tag : 'p', start : 19, end : 28, children : [ { type : 'text', text : 'Some text', start : 19, end : 28 } ] } ] } ] } ] } ] } ]
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 48, rule: null, 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, rule: null, children : [ { type : 'text', text : 'Some text', start : 19, end : 28, rule: null } ] } ] } ] } ] } ] } ]
|
||||
|
||||
);
|
||||
});
|
||||
|
@ -115,7 +114,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,"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}]}]
|
||||
[{"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"}]
|
||||
|
||||
);
|
||||
});
|
||||
|
@ -123,7 +122,7 @@ describe("WikiText parser tests", function() {
|
|||
it("should parse procedure definitions with no parameters", function() {
|
||||
expect(parse("\\procedure 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":[],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isProcedureDefinition":true}]
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isProcedureDefinition":true,"start":0,"end":33,"rule":"fnprocdef"}]
|
||||
|
||||
);
|
||||
});
|
||||
|
@ -131,7 +130,7 @@ describe("WikiText parser tests", function() {
|
|||
it("should parse single line procedure definitions with no parameters", function() {
|
||||
expect(parse("\\procedure myMacro() nothing\n")).toEqual(
|
||||
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isProcedureDefinition":true}]
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isProcedureDefinition":true,"start":0,"end":28,"rule":"fnprocdef"}]
|
||||
|
||||
);
|
||||
});
|
||||
|
@ -139,7 +138,7 @@ describe("WikiText parser tests", function() {
|
|||
it("should parse procedure definitions with parameters", function() {
|
||||
expect(parse("\\procedure myMacro(one,two,three,four:elephant)\nnothing\n\\end\n")).toEqual(
|
||||
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[{"name":"one"},{"name":"two"},{"name":"three"},{"name":"four","default":"elephant"}],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isProcedureDefinition":true}]
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[{"name":"one"},{"name":"two"},{"name":"three"},{"name":"four","default":"elephant"}],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isProcedureDefinition":true,"start":0,"end":60,"rule":"fnprocdef"}]
|
||||
|
||||
);
|
||||
});
|
||||
|
@ -147,14 +146,14 @@ describe("WikiText parser tests", function() {
|
|||
it("should parse procedure definitions", function() {
|
||||
expect(parse("\\procedure myMacro(one:'Jaguar')\n<$text text=<<one>>/>\n\\end\n\n")).toEqual(
|
||||
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"<$text text=<<one>>/>"}},"children":[],"params":[{"name":"one","default":"Jaguar"}],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"<$text text=<<one>>/>"}],"isProcedureDefinition":true}]
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"<$text text=<<one>>/>"}},"children":[],"params":[{"name":"one","default":"Jaguar"}],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"<$text text=<<one>>/>"}],"isProcedureDefinition":true,"start":0,"end":59,"rule":"fnprocdef"}]
|
||||
|
||||
);
|
||||
|
||||
}); it("should parse function definitions with no parameters", function() {
|
||||
expect(parse("\\function 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":[],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isFunctionDefinition":true}]
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isFunctionDefinition":true,"start":0,"end":32,"rule":"fnprocdef"}]
|
||||
|
||||
);
|
||||
});
|
||||
|
@ -162,7 +161,7 @@ describe("WikiText parser tests", function() {
|
|||
it("should parse single line function definitions with no parameters", function() {
|
||||
expect(parse("\\function myMacro() nothing\n")).toEqual(
|
||||
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isFunctionDefinition":true}]
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isFunctionDefinition":true,"start":0,"end":27,"rule":"fnprocdef"}]
|
||||
|
||||
);
|
||||
});
|
||||
|
@ -170,7 +169,7 @@ describe("WikiText parser tests", function() {
|
|||
it("should parse function definitions with parameters", function() {
|
||||
expect(parse("\\function myMacro(one,two,three,four:elephant)\nnothing\n\\end\n")).toEqual(
|
||||
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[{"name":"one"},{"name":"two"},{"name":"three"},{"name":"four","default":"elephant"}],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isFunctionDefinition":true}]
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[{"name":"one"},{"name":"two"},{"name":"three"},{"name":"four","default":"elephant"}],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isFunctionDefinition":true,"start":0,"end":59,"rule":"fnprocdef"}]
|
||||
|
||||
);
|
||||
});
|
||||
|
@ -178,7 +177,7 @@ describe("WikiText parser tests", function() {
|
|||
it("should parse function definitions", function() {
|
||||
expect(parse("\\function myMacro(one:'Jaguar')\n<$text text=<<one>>/>\n\\end\n\n")).toEqual(
|
||||
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"<$text text=<<one>>/>"}},"children":[],"params":[{"name":"one","default":"Jaguar"}],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"<$text text=<<one>>/>"}],"isFunctionDefinition":true}]
|
||||
[{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"<$text text=<<one>>/>"}},"children":[],"params":[{"name":"one","default":"Jaguar"}],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"<$text text=<<one>>/>"}],"isFunctionDefinition":true,"start":0,"end":58,"rule":"fnprocdef"}]
|
||||
|
||||
);
|
||||
});
|
||||
|
@ -186,7 +185,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":"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"}]}]
|
||||
[{"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"}]
|
||||
|
||||
);
|
||||
});
|
||||
|
@ -194,12 +193,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 ' } }, isBlock: true } ]
|
||||
[ { 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 ' } }, isBlock: true } ]
|
||||
[ { type: 'list', attributes: { filter: { type: 'string', value: ' fil\nter ', start: 3, end: 12 } }, isBlock: true, start: 0, end: 15, rule: "filteredtranscludeblock" } ]
|
||||
|
||||
);
|
||||
});
|
||||
|
@ -207,38 +206,38 @@ describe("WikiText parser tests", function() {
|
|||
it("should parse inline macro calls", function() {
|
||||
expect(parse("<<john>><<paul>><<george>><<ringo>>")).toEqual(
|
||||
|
||||
[{"type":"element","tag":"p","children":[{"type":"transclude","start":0,"end":8,"attributes":{"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"}]},{"type":"transclude","start":8,"end":16,"attributes":{"$variable":{"name":"$variable","type":"string","value":"paul"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"paul"}]},{"type":"transclude","start":16,"end":26,"attributes":{"$variable":{"name":"$variable","type":"string","value":"george"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"george"}]},{"type":"transclude","start":26,"end":35,"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,"rule":null}]
|
||||
|
||||
);
|
||||
expect(parse("text <<john one:val1 two: 'val \"2\"' three: \"val '3'\" four: \"\"\"val 4\"5'\"\"\" five: [[val 5]] >>")).toEqual(
|
||||
|
||||
[{"type":"element","tag":"p","children":[{"type":"text","text":"text ","start":0,"end":5},{"type":"transclude","start":5,"end":92,"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,"rule":null},{"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,"rule":null}]
|
||||
|
||||
);
|
||||
expect(parse("ignored << carrots <<john>>")).toEqual(
|
||||
|
||||
[{"type":"element","tag":"p","children":[{"type":"text","text":"ignored << carrots ","start":0,"end":19},{"type":"transclude","start":19,"end":27,"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,"rule":null},{"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,"rule":null}]
|
||||
|
||||
);
|
||||
expect(parse("text <<<john>>")).toEqual(
|
||||
|
||||
[{"type":"element","tag":"p","children":[{"type":"text","text":"text ","start":0,"end":5},{"type":"transclude","start":5,"end":14,"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,"rule":null},{"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,"rule":null}]
|
||||
|
||||
);
|
||||
expect(parse("before\n<<john>>")).toEqual(
|
||||
|
||||
[{"type":"element","tag":"p","children":[{"type":"text","text":"before\n","start":0,"end":7},{"type":"transclude","start":7,"end":15,"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,"rule":null},{"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,"rule":null}]
|
||||
|
||||
);
|
||||
// A single space will cause it to be inline
|
||||
expect(parse("<<john>> ")).toEqual(
|
||||
|
||||
[{"type":"element","tag":"p","children":[{"type":"transclude","start":0,"end":8,"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,"rule":null}],"start":0,"end":9,"rule":null}]
|
||||
|
||||
);
|
||||
expect(parse("text <<outie one:'my <<innie>>' >>")).toEqual(
|
||||
|
||||
[{"type":"element","tag":"p","children":[{"type":"text","text":"text ","start":0,"end":5},{"type":"transclude","start":5,"end":34,"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,"rule":null},{"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,"rule":null}]
|
||||
|
||||
);
|
||||
|
||||
|
@ -247,37 +246,37 @@ 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, attributes: { $variable: { name: "$variable", type: "string", value: "john" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "john" }], end: 8, isBlock: true }, { type: 'transclude', start: 9, attributes: { $variable: { name: "$variable", type: "string", value: "paul" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "paul" }], end: 17, isBlock: true }, { type: 'transclude', start: 19, attributes: { $variable: { name: "$variable", type: "string", value: "george" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "george" }], end: 29, isBlock: true }, { type: 'transclude', start: 30, 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(
|
||||
|
||||
[{"type":"transclude","start":0,"end":87,"attributes":{"$variable":{"name":"$variable","type":"string","value":"john"},"one":{"name":"one","type":"string","value":"val1","start":6,"end":15},"two":{"name":"two","type":"string","value":"val \"2\"","start":15,"end":30},"three":{"name":"three","type":"string","value":"val '3'","start":30,"end":47},"four":{"name":"four","type":"string","value":"val 4\"5'","start":47,"end":68},"five":{"name":"five","type":"string","value":"val 5","start":68,"end":84}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"},{"name":"one","type":"string","value":"val1","start":6,"end":15},{"name":"two","type":"string","value":"val \"2\"","start":15,"end":30},{"name":"three","type":"string","value":"val '3'","start":30,"end":47},{"name":"four","type":"string","value":"val 4\"5'","start":47,"end":68},{"name":"five","type":"string","value":"val 5","start":68,"end":84}],"isBlock":true}]
|
||||
[{"type":"transclude","start":0,"end":87,"rule":"macrocallblock","attributes":{"$variable":{"name":"$variable","type":"string","value":"john"},"one":{"name":"one","type":"string","value":"val1","start":6,"end":15},"two":{"name":"two","type":"string","value":"val \"2\"","start":15,"end":30},"three":{"name":"three","type":"string","value":"val '3'","start":30,"end":47},"four":{"name":"four","type":"string","value":"val 4\"5'","start":47,"end":68},"five":{"name":"five","type":"string","value":"val 5","start":68,"end":84}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"},{"name":"one","type":"string","value":"val1","start":6,"end":15},{"name":"two","type":"string","value":"val \"2\"","start":15,"end":30},{"name":"three","type":"string","value":"val '3'","start":30,"end":47},{"name":"four","type":"string","value":"val 4\"5'","start":47,"end":68},{"name":"five","type":"string","value":"val 5","start":68,"end":84}],"isBlock":true}]
|
||||
|
||||
);
|
||||
expect(parse("<< carrots\n\n<<john>>")).toEqual(
|
||||
|
||||
[ { type: 'element', tag: 'p', start : 0, end : 10, children: [ { type: 'text', text: '<< carrots', start : 0, end : 10 } ] }, { type: 'transclude', start: 12, 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, rule: null, children: [ { type: 'text', text: '<< carrots', start : 0, end : 10, rule: null } ] }, { 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', start : 0, end : 6, children: [ { type: 'text', text: 'before', start : 0, end : 6 } ] }, { type: 'transclude', start: 8, 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, rule: null, children: [ { type: 'text', text: 'before', start : 0, end : 6, rule: null } ] }, { 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, 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 } ] } ]
|
||||
[ { 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, rule: null, children: [ { type: 'text', text: 'after', start: 9, end: 14, rule: null } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<<multiline arg:\"\"\"\n\nwikitext\n\"\"\" >>")).toEqual(
|
||||
|
||||
[{"type":"transclude","start":0,"end":36,"attributes":{"$variable":{"name":"$variable","type":"string","value":"multiline"},"arg":{"name":"arg","type":"string","value":"\n\nwikitext\n","start":11,"end":33}},"orderedAttributes":[{"name":"$variable","type":"string","value":"multiline"},{"name":"arg","type":"string","value":"\n\nwikitext\n","start":11,"end":33}],"isBlock":true}]
|
||||
[{"type":"transclude","start":0,"end":36,"rule":"macrocallblock","attributes":{"$variable":{"name":"$variable","type":"string","value":"multiline"},"arg":{"name":"arg","type":"string","value":"\n\nwikitext\n","start":11,"end":33}},"orderedAttributes":[{"name":"$variable","type":"string","value":"multiline"},{"name":"arg","type":"string","value":"\n\nwikitext\n","start":11,"end":33}],"isBlock":true}]
|
||||
|
||||
);
|
||||
expect(parse("<<outie one:'my <<innie>>' >>")).toEqual(
|
||||
|
||||
[ { type: 'transclude', start: 0, 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 } ]
|
||||
|
||||
);
|
||||
});
|
||||
|
@ -285,23 +284,23 @@ describe("WikiText parser tests", function() {
|
|||
it("should parse tricky macrocall parameters", function() {
|
||||
expect(parse("<<john pa>am>>")).toEqual(
|
||||
|
||||
[{"type":"transclude","start":0,"end":14,"attributes":{"0":{"name":"0","type":"string","value":"pa>am","start":6,"end":12},"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"},{"name":"0","type":"string","value":"pa>am","start":6,"end":12}],"isBlock":true}]
|
||||
[{"type":"transclude","start":0,"end":14,"attributes":{"0":{"name":"0","type":"string","value":"pa>am","start":6,"end":12},"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"},{"name":"0","type":"string","value":"pa>am","start":6,"end":12}],"isBlock":true,"rule":"macrocallblock"}]
|
||||
|
||||
);
|
||||
expect(parse("<<john param> >>")).toEqual(
|
||||
|
||||
[{"type":"transclude","start":0,"end":16,"attributes":{"0":{"name":"0","type":"string","value":"param>","start":6,"end":13},"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"},{"name":"0","type":"string","value":"param>","start":6,"end":13}],"isBlock":true}]
|
||||
[{"type":"transclude","start":0,"end":16,"attributes":{"0":{"name":"0","type":"string","value":"param>","start":6,"end":13},"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"},{"name":"0","type":"string","value":"param>","start":6,"end":13}],"isBlock":true,"rule":"macrocallblock"}]
|
||||
|
||||
);
|
||||
expect(parse("<<john param>>>")).toEqual(
|
||||
|
||||
[{"type":"element","tag":"p","children":[{"type":"transclude","start":0,"end":14,"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,"rule":null}],"start":0,"end":15,"rule":null}]
|
||||
|
||||
);
|
||||
// equals signs should be allowed
|
||||
expect(parse("<<john var>=4 >>")).toEqual(
|
||||
|
||||
[{"type":"transclude","start":0,"end":16,"attributes":{"0":{"name":"0","type":"string","value":"var>=4","start":6,"end":13},"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"},{"name":"0","type":"string","value":"var>=4","start":6,"end":13}],"isBlock":true}]
|
||||
[{"type":"transclude","start":0,"end":16,"attributes":{"0":{"name":"0","type":"string","value":"var>=4","start":6,"end":13},"$variable":{"name":"$variable","type":"string","value":"john"}},"orderedAttributes":[{"name":"$variable","type":"string","value":"john"},{"name":"0","type":"string","value":"var>=4","start":6,"end":13}],"isBlock":true,"rule":"macrocallblock"}]
|
||||
|
||||
);
|
||||
|
||||
|
@ -310,7 +309,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', start : 0, end : 13, children : [ { type : 'entity', entity : '—' }, { type : 'text', text : 'Not a rule', start : 3, end : 13 } ] }, { type : 'element', tag : 'hr' }, { type : 'element', tag : 'p', start : 21, end : 28, children : [ { type : 'text', text : 'Between', start : 21, end : 28 } ] }, { type : 'element', tag : 'hr' } ]
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 13, rule: null, children : [ { type : 'entity', entity : '—', start: 0, end: 3, rule: 'dash' }, { type : 'text', text : 'Not a rule', start : 3, end : 13, rule: null } ] }, { type : 'element', tag : 'hr', start: 15, end: 20, rule: 'horizrule' }, { type : 'element', tag : 'p', start : 21, end : 28, rule: null, children : [ { type : 'text', text : 'Between', start : 21, end : 28, rule: null } ] }, { type : 'element', tag : 'hr', start: 30, end: 33, rule: 'horizrule' } ]
|
||||
|
||||
);
|
||||
|
||||
|
@ -319,7 +318,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', children : [ { type : 'text', text : 'Something', start : 3, end : 12 }, { type : 'element', tag : 'br' }, { type : 'text', text : 'in the', start : 13, end : 19 }, { type : 'element', tag : 'br' }, { type : 'text', text : 'way she moves', start : 20, end : 33 }, { type : 'element', tag : 'br' } ], 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, rule: null } ]
|
||||
|
||||
);
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
created: 20240313100515958
|
||||
modified: 20240313103959789
|
||||
tags: Editions
|
||||
title: TiddlyWiki Docs PR Maker
|
||||
|
||||
''~TiddlyWiki Docs PR Maker'' is a special edition of tiddlywiki.com designed to help you contribute to and improve the documentation made by [[@saqimtiaz|https://github.com/saqimtiaz/]].
|
||||
|
||||
https://saqimtiaz.github.io/tw5-docs-pr-maker/
|
||||
|
||||
All changes made to the documentation can be very easily submitted to GitHub -- the pull request will be automatically made, hence the "PR Maker" name of the edition.
|
||||
|
||||
You will need to create a free ~GitHub account and sign the [[Contributor License Agreement]] before using the Docs PR Maker. You can find more details about contributing to the documentation [[here|Improving TiddlyWiki Documentation]].
|
|
@ -1,5 +1,5 @@
|
|||
created: 20140820151051019
|
||||
modified: 20190115165616599
|
||||
modified: 20240313114828368
|
||||
tags: Community
|
||||
title: Improving TiddlyWiki Documentation
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -8,9 +8,29 @@ Anyone can submit improvements to the TiddlyWiki documentation that appears on h
|
|||
|
||||
<<.warning """If you already know GitHub, note that documentation updates must be directed to the `tiddlywiki-com` branch""">>
|
||||
|
||||
! Before you start editing
|
||||
|
||||
# Read and observe the [[Documentation Style Guide]]
|
||||
# Create an account on https://github.com if you don't already have one
|
||||
# If you haven't done so already, sign the [[Contributor License Agreement]] as described in [[Signing the Contributor License Agreement]]
|
||||
|
||||
! Editing and submitting your edits
|
||||
|
||||
You can choose to edit the documentation using the [[TiddlyWiki Docs PR Maker]] or directly in ~GitHub. The first method is especially recommended for users not familiar with ~GitHub.
|
||||
|
||||
!! Using [[Docs PR Maker|TiddlyWiki Docs PR Maker]] edition
|
||||
|
||||
# Go to https://saqimtiaz.github.io/tw5-docs-pr-maker/ or click the link displayed in the ribbon underneath the title when editing a tiddler on tiddlywiki.com
|
||||
# Go through the quick introduction where you will need to provide your ~GitHub username and a ~GitHub access token (you will be guided in creating one)
|
||||
# Edit or create tiddlers to update the documentation, the wiki will keep track of all changes
|
||||
# Click the "Submit updates" button and check if all the tiddlers that you edited are included in the submission; if not, drag them into the box
|
||||
# Provide a concise title and description of your changes (see the rules about titling pull requests in [[contribution guidelines|Contributing]])
|
||||
# Submit your changes:
|
||||
** "Save as draft" will create a //draft// pull request, this is useful if you don't want the changes to be merged //yet//, because you want to work on it later or discuss it first
|
||||
** "Submit documentation update" will create a pull request, which will be immediately available for review and merging
|
||||
|
||||
!! Using ~GitHub
|
||||
|
||||
# On https://tiddlywiki.com, click "edit" on the tiddler you want to improve
|
||||
# You should see a pink banner with the text: //Can you help us improve this documentation? Find out how to edit this tiddler on ~GitHub//
|
||||
# Click on the external link ...''this tiddler on ~GitHub''
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
created: 20210618133745003
|
||||
from-version: 5.2.0
|
||||
modified: 20230710073315595
|
||||
modified: 20240312202834547
|
||||
rp-input: the filter output of all previous runs so far
|
||||
rp-output: the input titles as modified by the result of this filter run
|
||||
rp-purpose: modify input titles by the result of evaluating this filter run for each item
|
||||
|
@ -12,7 +12,7 @@ type: text/vnd.tiddlywiki
|
|||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
( ":map" | - )
|
||||
( ":map" (: ":flat" | - ) | - )
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
created: 20210428083929749
|
||||
from-version: 5.2.0
|
||||
modified: 20230322140722470
|
||||
modified: 20240312203002082
|
||||
rp-input: the filter output of all previous runs so far
|
||||
rp-output: output titles replace the output of previous filter runs
|
||||
rp-purpose: sort the input titles by the result of evaluating this filter run for each item
|
||||
|
@ -12,9 +12,9 @@ type: text/vnd.tiddlywiki
|
|||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
( ":sort" )
|
||||
( ( ":sort" )
|
||||
( : ":string" | ":alphanumeric" | ":number" | ":integer" | ":version" | ":date" )
|
||||
( : ":casesensitive" /"required for string and alphanumeric"/ | ":caseinsensitive" /"required for string and alphanumeric"/ | ":reverse" /"optional"/ | - )
|
||||
( : ":casesensitive" /"required for string and alphanumeric"/ | ":caseinsensitive" /"required for string and alphanumeric"/ | ":reverse" /"optional"/ | - ) | - )
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
caption: tag
|
||||
created: 20141206130540337
|
||||
modified: 20230725201240201
|
||||
modified: 20240228131301798
|
||||
tags: Macros [[Core Macros]]
|
||||
title: tag Macro
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -11,7 +11,35 @@ The <<.def tag>> [[macro|Macros]] generates a tag pill for a specified tag. Clic
|
|||
|
||||
!! Parameters
|
||||
|
||||
;tag
|
||||
; tag
|
||||
: The title of the tag, defaulting to the [[current tiddler|Current Tiddler]]
|
||||
|
||||
!! CSS classes
|
||||
|
||||
<<.from-version "v5.3.4">>
|
||||
|
||||
; `tc-tag-missing`
|
||||
: This class is defined if a tag does ''not exist'' as a tiddler.
|
||||
|
||||
; `tc-tag-exists`
|
||||
: This class is defined if a tag does exist as a tiddler
|
||||
|
||||
!!! Defining the class
|
||||
|
||||
To define the `tc-tag-missing` class a stylesheet tiddler needs to be created. The default font-style for missing tiddler links is //italic//, so it's used for the example code below. Eg:
|
||||
|
||||
''title:'' `myTagsStylesheet`<br>
|
||||
''tag:'' `$:/tags/Stylesheet`
|
||||
|
||||
<<copy-to-clipboard-above-right src:"""
|
||||
.tc-tag-missing {
|
||||
font-style: italic;
|
||||
}
|
||||
""">>
|
||||
```
|
||||
.tc-tag-missing {
|
||||
font-style: italic;
|
||||
}
|
||||
```
|
||||
|
||||
<<.macro-examples "tag">>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
created: 20150221211317000
|
||||
modified: 20230725203751870
|
||||
modified: 20240228131331605
|
||||
tags: [[tag Macro]] [[Macro Examples]]
|
||||
title: tag Macro (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -7,22 +7,26 @@ type: text/vnd.tiddlywiki
|
|||
<$macrocall $name=".example" n="1" eg="""<<tag>>"""/>
|
||||
<$macrocall $name=".example" n="2" eg="""<<tag Concepts>>"""/>
|
||||
|
||||
The Following tag can be shown with a font-style: //italic// if the corresponding stylesheet exists. See: [[tag Macro]]
|
||||
|
||||
<$macrocall $name=".example" n="3" eg="""<<tag "Does not exist">>"""/>
|
||||
|
||||
If a [[list widget|ListWidget]] generates multiple tag macros for the same tag, clicking any of them opens dropdowns on all of them, as in the example below. This is usually unwanted.
|
||||
<$macrocall $name=".example" n="3" eg="""<$list filter="[tag[HelloThere]]">
|
||||
<$macrocall $name=".example" n="4" eg="""<$list filter="[tag[HelloThere]]">
|
||||
|
||||
* <$link/> is tagged with: <$list filter="[<currentTiddler>tags[]]"> <<tag>> </$list>
|
||||
|
||||
</$list>"""/>
|
||||
|
||||
Adding the `counter="transclusion"` attribute to the list widget that generates multiple identical tag macros causes each of them to be identified as a unique one. Clicking on any of them opens only a single dropdown.
|
||||
<$macrocall $name=".example" n="4" eg="""<$list filter="[tag[HelloThere]]" counter="transclusion">
|
||||
<$macrocall $name=".example" n="5" eg="""<$list filter="[tag[HelloThere]]" counter="transclusion">
|
||||
|
||||
* <$link/> is tagged with: <$list filter="[<currentTiddler>tags[]]"> <<tag>> </$list>
|
||||
|
||||
</$list>"""/>
|
||||
|
||||
A slightly more performant option is to use the `variable="transclusion"` attribute in the list widget. In this case, the variable `<<transclusion>>` has to be used inside the list widget instead of the `<<currentTiddler>>` .
|
||||
<$macrocall $name=".example" n="5" eg="""<$list filter="[tag[HelloThere]]" variable="transclusion">
|
||||
<$macrocall $name=".example" n="6" eg="""<$list filter="[tag[HelloThere]]" variable="transclusion">
|
||||
|
||||
* <$link to=<<transclusion>>/> is tagged with: <$list filter="[<transclusion>tags[]]"> <<tag>> </$list>
|
||||
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
created: 20150221105732000
|
||||
modified: 20150221222352000
|
||||
tags: [[Macro Syntax]]
|
||||
tags: [[Macro Syntax]] $:/deprecated
|
||||
title: Macro Call Syntax
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.deprecated-since "5.3.0" "Procedure Call Syntax">>
|
||||
|
||||
----------
|
||||
|
||||
<<.preamble """What follows is a formal presentation of the syntax of the WikiText syntax for macro calls, using [[railroad diagrams|Railroad Diagrams]]. A [[simpler overview|Macro Calls in WikiText]] is also available.""">>
|
||||
|
||||
<$railroad text="""
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
created: 20150220200255000
|
||||
modified: 20150221222349000
|
||||
tags: [[Macro Syntax]]
|
||||
tags: [[Macro Syntax]] $:/deprecated
|
||||
title: Macro Definition Syntax
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.deprecated-since "5.3.0" "Procedure Definition Syntax">>
|
||||
|
||||
----------
|
||||
|
||||
<<.preamble """What follows is a formal presentation of the syntax of the `\define` pragma, using [[railroad diagrams|Railroad Diagrams]]. A [[simpler overview|Macro Definitions in WikiText]] is also available.""">>
|
||||
|
||||
<$railroad text="""
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
created: 20240310165023000
|
||||
modified: 20240310172648116
|
||||
tags: [[Procedure Syntax]]
|
||||
title: Procedure Call Syntax
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.preamble """What follows is a formal presentation of the syntax of the WikiText syntax for procedure calls, using [[railroad diagrams|Railroad Diagrams]].""">>
|
||||
|
||||
!! procedure-name
|
||||
|
||||
<$railroad text="""
|
||||
"<<" [[ procedure-name |Procedures]] [: [[whitespace|"Filter Whitespace"]] [:{param-value}] ]">>"
|
||||
"""/>
|
||||
|
||||
* The [[procedure's|Procedures]] <<.place procedure-name>> is a sequence of non-whitespace characters other than `(` or `>`.
|
||||
|
||||
* <<.place whitespace>> denotes a sequence of [[whitespace characters|Filter Whitespace]].
|
||||
|
||||
!!! param-value
|
||||
|
||||
Each ''individual'' <<.place param-value>> has the following syntax:
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
[: param-name [:[[whitespace|"Filter Whitespace"]]] ":" [:[[whitespace|"Filter Whitespace"]]] ] value [: [[whitespace|"Filter Whitespace"]] ]
|
||||
"""/>
|
||||
|
||||
* The <<.place param-name>> is a sequence of letters (`A`--`Z`, `a`--`z`), digits (`0`--`9`), hyphens (`-`) and underscores (`_`).
|
||||
|
||||
* The <<.place value>> is specified as follows:
|
||||
|
||||
<$railroad text={{$:/editions/tw5.com/railroad/macro-parameter-value}}/>
|
|
@ -0,0 +1,93 @@
|
|||
created: 20240310165023000
|
||||
modified: 20240310175033730
|
||||
tags: [[Procedure Syntax]]
|
||||
title: Procedure Definition Syntax
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.preamble """What follows is a formal presentation of the syntax of the [[Pragma: \procedure]], using [[railroad diagrams|Railroad Diagrams]]. """>>
|
||||
|
||||
! \procedure
|
||||
|
||||
There are 2 types of procedure definitions
|
||||
|
||||
* Single line definitions
|
||||
* Multi line definitions
|
||||
|
||||
!! Single Line
|
||||
|
||||
Single line definitions should only be used for very short bodies, where the procedure name, params and the body fit into 1 line terminated with a line-feed.
|
||||
|
||||
<$railroad text="""
|
||||
"\procedure"
|
||||
[[<"space">|"Filter Whitespace"]]
|
||||
"procedure-name"
|
||||
<"(params)">
|
||||
[:[[<"space">|"Filter Whitespace"]]]
|
||||
"body"
|
||||
"lf"
|
||||
"""/>
|
||||
|
||||
!! Multi Line
|
||||
|
||||
The majority of procedure definitions will have a body, that spans over several lines of wikitext. Those procedure definitions are terminated using the "\end" pragma
|
||||
|
||||
<$railroad text="""
|
||||
"\procedure"
|
||||
[[<"space">|"Filter Whitespace"]]
|
||||
"procedure-name"
|
||||
<"(params)">
|
||||
[:[[<"space">|"Filter Whitespace"]]]
|
||||
body
|
||||
"\end"
|
||||
"""/>
|
||||
|
||||
The [[procedure-name|Procedures]] is a sequence of non-whitespace characters other than `(` or `>`.
|
||||
|
||||
|
||||
* <<.place procedure-name>> is a sequence of letters (`A`--`Z`, `a`--`z`), digits (`0`--`9`), hyphens (`-`) and underscores (`_`)
|
||||
* <<.place body>> is wikitext including [[nested procedures|Pragma: \procedure]]
|
||||
* <<.place space>> denotes a sequence of [[whitespace characters|Filter Whitespace]]
|
||||
|
||||
!! params
|
||||
|
||||
The parameter declaration list <<.place (params)>> has the following syntax:
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
"(" [:"sep"] [:{ parameter "sep" }] ")"
|
||||
"""/>
|
||||
|
||||
* <<.place sep>> is any sequence of characters that does not match a <<.place param-name>>. <br>Among other things, this includes commas, spaces and linefeeds.
|
||||
|
||||
|
||||
Each ''individual'' <<.place parameter>> has the following syntax:
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
"param-name" [: [:[[<"space">|"Filter Whitespace"]]] ":" [:[[<"space">|"Filter Whitespace"]]] default ]
|
||||
"""/>
|
||||
|
||||
* <<.place param-name>> is a sequence of letters (`A`--`Z`, `a`--`z`), digits (`0`--`9`), hyphens (`-`) and underscores (`_`).
|
||||
|
||||
* <<.place default>> is an optional value of a parameter is specified as follows:
|
||||
|
||||
<$railroad text={{$:/editions/tw5.com/railroad/macro-parameter-value}}/>
|
||||
|
||||
!! body
|
||||
|
||||
The <<.place body>> of the definition has the following syntax:
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
{[[<"wikitext">|WikiText]] "lf"}
|
||||
"""/>
|
||||
|
||||
* <<.place wikitext>> is any sequence of characters that doesn't terminate the macro definition.
|
||||
** If [[nested procedures|Pragma: \procedure]] are used they need to be at the start of the wikitext. There are the same rules as if the wikitext would be in a tiddler.
|
||||
** Pragmas need to be before standard wikitext.
|
||||
|
||||
* <<.place lf>> denotes a linefeed.
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
created: 20240310165023000
|
||||
modified: 20240310173318213
|
||||
tags: Procedures
|
||||
title: Procedure Syntax
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
Plain text description can be found at [[Procedures]]
|
||||
|
||||
<<list-links filter:"[tag[Procedure Syntax]]">>
|
||||
|
||||
<<.tip "The railroad boxes in the linked tiddlers can be used to navigate.">>
|
|
@ -1,6 +1,6 @@
|
|||
caption: tag-picker
|
||||
created: 20161128191316701
|
||||
modified: 20161128191435641
|
||||
modified: 20230616114543787
|
||||
tags: Macros [[Core Macros]]
|
||||
title: tag-picker Macro
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -9,9 +9,17 @@ The <<.def tag-picker>> [[macro|Macros]] generates a combination of a text box a
|
|||
|
||||
!! Parameters
|
||||
|
||||
;actions
|
||||
: Action widgets to be triggered when the pill is clicked. Within the text, the variable ''tag'' contains the title of the selected tag.
|
||||
;tagField
|
||||
: <<.from-version 5.1.23>> The ''field'' that gets updated with the selected tag. Defaults to ''tags''.
|
||||
; actions
|
||||
: Action widgets to be triggered when the pill is clicked. Within the text, the variable <<.var tag>> contains the title of the selected tag.
|
||||
|
||||
; tagField
|
||||
: <<.from-version 5.1.23>> The specified ''field'' that gets updated with the selected tag. Defaults to `tags`.
|
||||
|
||||
; tiddler
|
||||
: <<.from-version 5.3.4>> Defines the target tiddler, which should be manipulated. Defaults to: <<.var currentTiddler>>.
|
||||
|
||||
; tagListFilter
|
||||
: <<.from-version 5.3.4>> This parameter defaults to: `[tags[]]` which creates a list of all existing tags. If the tag list should come from a different source the filter should look similar to eg: `[<listSource>get[field-name]enlist-input[]]`.
|
||||
|
||||
|
||||
<<.macro-examples "tag-picker">>
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
title: WidgetMessage: tm-http-request Example - Basic Authentication
|
||||
tags: $:/tags/Global
|
||||
|
||||
|
||||
!! HTTP Basic Authentication
|
||||
|
||||
[[HTTP Basic Authentication|https://en.wikipedia.org/wiki/Basic_access_authentication]] is a simple scheme for HTTP clients pass a username and password to an HTTP server.
|
||||
|
||||
The credentials are passed via the "Authorization" header as the string "Basic " (note the space) followed by the base64-encoded username and password joined with a colon.
|
||||
|
||||
Here is a simple, illustrative example:
|
||||
|
||||
```
|
||||
\procedure get-tiddler-list-from-tiddlywiki-server(url,username,password)
|
||||
\procedure completion-get-json()
|
||||
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
||||
<$action-log msg="In completion-get-json"/>
|
||||
<$action-log/>
|
||||
\end completion-get-json
|
||||
<$action-sendmessage
|
||||
$message="tm-http-request"
|
||||
url=<<url>>
|
||||
method="GET"
|
||||
header-Authorization={{{ [<username>addsuffix[:]addsuffix<password>encodebase64[]addprefix[Basic ]] }}}
|
||||
oncompletion=<<completion-get-json>>
|
||||
/>
|
||||
\end get-tiddler-list-from-tiddlywiki-server
|
||||
|
||||
<$button>
|
||||
<<get-tiddler-list-from-tiddlywiki-server url:"http://127.0.0.1:8080" username:"Joe" password:"Bloggs">>
|
||||
Download
|
||||
</$button>
|
||||
```
|
||||
|
|
@ -51,3 +51,4 @@ Note that the state tiddler $:/state/http-requests contains a number representin
|
|||
|
||||
* [[Zotero's|https://www.zotero.org/]] API for retrieving reference items: [[WidgetMessage: tm-http-request Example - Zotero]]
|
||||
* [[Random Dog's|https://random.dog/]] API for retrieving random pictures of dogs showing how to retrieve binary data: [[WidgetMessage: tm-http-request Example - Random Dog]]
|
||||
* Example of using HTTP Basic Authentication: [[WidgetMessage: tm-http-request Example - Basic Authentication]]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
created: 20221007124007426
|
||||
modified: 20230419103154329
|
||||
modified: 20240310173130052
|
||||
tags: Concepts Reference
|
||||
title: Procedures
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -18,11 +18,13 @@ The name wrapped in double angled [[brackets|Brackets]] is used a shorthand way
|
|||
|
||||
```
|
||||
<<my-procedure>>
|
||||
<<my-procedure "The parameter">>
|
||||
<<my-procedure parameter:"The parameter">>
|
||||
```
|
||||
|
||||
The parameters that are specified in the procedure call are made available as variables.
|
||||
|
||||
<<.tip """If a procedure has more than 1 parameter, it is highly encouraged to use "named parameters", as shown in the second example above. Even if it is more to type, it will pay off in the long run.""">>
|
||||
|
||||
!! How Procedures Work
|
||||
|
||||
Procedures are implemented as a special kind of [[variable|Variables]]. The only thing that distinguishes them from ordinary variables is the way that the parameters are handled.
|
||||
|
@ -32,4 +34,4 @@ Procedures are implemented as a special kind of [[variable|Variables]]. The only
|
|||
* [[Procedure Definitions]] describes how to create procedures
|
||||
* [[Procedure Calls]] describes how to use procedures
|
||||
* [[Procedure Parameter Handling]] describes how procedure parameters work
|
||||
|
||||
* [[Procedure Syntax]] is a formal syntax description using railroad diagrams
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
title: $:/ContributionBanner
|
||||
tags: $:/tags/EditTemplate
|
||||
created: 20240313115309914
|
||||
list-after: $:/core/ui/EditTemplate/title
|
||||
modified: 20240313115810689
|
||||
tags: $:/tags/EditTemplate
|
||||
title: $:/ContributionBanner
|
||||
|
||||
\define base-github()
|
||||
https://github.com/Jermolene/TiddlyWiki5/edit/tiddlywiki-com/editions/tw5.com/tiddlers/
|
||||
|
@ -10,7 +12,9 @@ https://github.com/Jermolene/TiddlyWiki5/edit/tiddlywiki-com/editions/tw5.com/ti
|
|||
<$list filter="[[$:/config/OriginalTiddlerPaths]getindex<draft-of>]" variable="target" >
|
||||
<div class="tc-improvement-banner">
|
||||
{{$:/core/images/star-filled}} Can you help us improve this documentation? [[Find out how|Improving TiddlyWiki Documentation]] to
|
||||
<a href={{{ [<target>addprefix<base-github>] }}} class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">edit this tiddler on ~GitHub</a>
|
||||
<a href={{{ [<draft-of>encodeuricomponent[]addprefix[https://saqimtiaz.github.io/tw5-docs-pr-maker/#]] }}} class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">edit this tiddler in Docs PR Maker</a>
|
||||
or
|
||||
<a href={{{ [<target>addprefix<base-github>] }}} class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">edit it directly on ~GitHub</a>
|
||||
</div>
|
||||
</$list>
|
||||
</$set>
|
||||
|
|
|
@ -7,6 +7,6 @@ Deprecated features of TiddlyWiki are those that have been superseded by newer,
|
|||
|
||||
Deprecated features will still work, but are not recommended for new content.
|
||||
|
||||
Tiddlers tagged $:/deprecated:
|
||||
''Tiddlers tagged'' $:/deprecated:
|
||||
|
||||
<<list-links filter:"[tag[$:/deprecated]]">>
|
|
@ -7,6 +7,3 @@ type: text/vnd.tiddlywiki
|
|||
|
||||
Deprecated features are marked with a special warning button. See: [[How to apply custom styles by tag]] for an example.
|
||||
|
||||
''Tiddlers tagged `$:/deprecated`''
|
||||
|
||||
><<list-links "[tag[$:/deprecated]]">>
|
|
@ -1,7 +1,9 @@
|
|||
title: $:/editions/tw5.com/TiddlerInfo/Sources
|
||||
tags: $:/tags/TiddlerInfo
|
||||
caption: Sources
|
||||
code-body: yes
|
||||
created: 20240313090915565
|
||||
modified: 20240313115026563
|
||||
tags: $:/tags/TiddlerInfo
|
||||
title: $:/editions/tw5.com/TiddlerInfo/Sources
|
||||
|
||||
\function static-link-base() [[https://tiddlywiki.com/static/$(title)$.html]substitute[]]
|
||||
|
||||
|
@ -29,19 +31,28 @@ code-body: yes
|
|||
class="tc-tiddlylink-external"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>Direct link to <$text text=<<currentTiddler>>/> on github.com</a>
|
||||
>Link to "<$text text=<<currentTiddler>>/>" on github.com</a>
|
||||
</$set>
|
||||
</$set>
|
||||
\end
|
||||
|
||||
\procedure make-pr-maker-link()
|
||||
<a href={{{ [<currentTiddler>encodeuricomponent[]addprefix[https://saqimtiaz.github.io/tw5-docs-pr-maker/#]] }}}
|
||||
class="tc-tiddlylink-external"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>Link to "<$text text=<<currentTiddler>>/>" in Docs PR Maker edition</a>
|
||||
\end
|
||||
|
||||
<$list filter="[all[current]!is[system]!is[shadow]]">
|
||||
|
||||
A static HTML representation of this tiddler is available at the URL:
|
||||
|
||||
* <<make-static-link>>
|
||||
|
||||
Help us to improve the documentation by suggesting changes to this tiddler using the [[TiddlyWiki Docs PR Maker|https://saqimtiaz.github.io/tw5-docs-pr-maker/]]
|
||||
Help us to [[improve the documentation|Improving TiddlyWiki Documentation]] by suggesting changes to this tiddler using the [[TiddlyWiki Docs PR Maker]] or directly on ~GitHub.
|
||||
|
||||
* <<make-pr-maker-link>>
|
||||
* <<make-github-link>>
|
||||
|
||||
</$list>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
code-body: yes
|
||||
created: 20150117152607000
|
||||
modified: 20240229155550000
|
||||
modified: 20240317091700545
|
||||
tags: $:/tags/Macro
|
||||
title: $:/editions/tw5.com/doc-macros
|
||||
code-body: yes
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\whitespace trim
|
||||
|
@ -165,7 +165,7 @@ This is an example tiddler. See [[Table-of-Contents Macros (Examples)]].
|
|||
<dd><$button set=<<.state>> setTo="">Hide</$button></dd>
|
||||
</dl>
|
||||
<blockquote class="doc-example-result">
|
||||
<<eg>>
|
||||
<$transclude $variable="eg" $mode="block"/>
|
||||
</blockquote>
|
||||
</$reveal>
|
||||
</$list>
|
||||
|
|
|
@ -1,104 +1,96 @@
|
|||
code-body: yes
|
||||
created: 20150117184156000
|
||||
modified: 20220617122915793
|
||||
modified: 20240315144208842
|
||||
tags: $:/tags/Macro
|
||||
title: $:/editions/tw5.com/wikitext-macros
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define activatePluginTab()
|
||||
\whitespace trim
|
||||
|
||||
\procedure activatePluginTab()
|
||||
<$action-setfield $tiddler="$:/state/tab-1749438307" text="$:/core/ui/ControlPanel/Plugins"/>
|
||||
<$action-navigate $to="$:/ControlPanel"/>
|
||||
\end
|
||||
|
||||
\define activateTiddlerWindow()
|
||||
<$action-sendmessage $message="tm-open-window"
|
||||
$param=<<currentTiddler>> windowTitle="Side by Side View"
|
||||
width="800" height="600" />
|
||||
\procedure activateTiddlerWindow()
|
||||
<$action-sendmessage $message="tm-open-window" $param=<<currentTiddler>> windowTitle="Side by Side View" width="800" height="600" />
|
||||
\end
|
||||
|
||||
\define controlPanel-plugin-link()
|
||||
\procedure controlPanel-plugin-link()
|
||||
<$button actions=<<activatePluginTab>> class="tc-btn-invisible tc-tiddlylink">
|
||||
{{$:/core/images/options-button}} ~ControlPanel
|
||||
{{$:/core/images/options-button}} ~ControlPanel
|
||||
</$button>
|
||||
\end
|
||||
|
||||
\define open-tiddler-in-window()
|
||||
\procedure open-tiddler-in-window()
|
||||
\whitespace notrim
|
||||
<$button actions=<<activateTiddlerWindow>> class="tc-btn-invisible tc-tiddlylink">
|
||||
open ''this'' tiddler in a new window
|
||||
open ''this'' tiddler in a new window
|
||||
</$button>
|
||||
\end
|
||||
|
||||
\define activateEditionWindow(url)
|
||||
<$action-sendmessage $message="tm-open-external-window"
|
||||
$param="""$url$""" windowName="_edition"
|
||||
windowFeatures="width=800 height=600" />
|
||||
\procedure activateEditionWindow(url)
|
||||
<$action-sendmessage $message="tm-open-external-window" $param=<<url>> windowName="_edition" windowFeatures="width=800 height=600" />
|
||||
\end
|
||||
|
||||
\define open-external-window(url)
|
||||
<$button actions=<<activateEditionWindow """$url$""">> class="tc-btn-invisible tc-tiddlylink">
|
||||
open the ''example edition'' in a new window
|
||||
\procedure open-external-window(url)
|
||||
\whitespace notrim
|
||||
<$button actions=<<activateEditionWindow <<url>> class="tc-btn-invisible tc-tiddlylink">
|
||||
open the ''example edition'' in a new window
|
||||
</$button>
|
||||
\end
|
||||
|
||||
|
||||
\define wikitext-example(src)
|
||||
\procedure wikitext-example(src)
|
||||
<div class="doc-example">
|
||||
|
||||
<$macrocall $name="copy-to-clipboard-above-right" src=<<__src__>>/>
|
||||
|
||||
<$codeblock code=<<__src__>>/>
|
||||
|
||||
That renders as:
|
||||
|
||||
<$macrocall $name="__src__"/>
|
||||
|
||||
... and the underlying HTML is:
|
||||
|
||||
<$wikify name="html" text=<<__src__>> output="html">
|
||||
<$codeblock code=<<html>>/>
|
||||
</$wikify>
|
||||
<$macrocall $name="copy-to-clipboard-above-right" src=<<src>>/>
|
||||
<$codeblock code=<<src>>/>
|
||||
<p>
|
||||
That renders as:
|
||||
</p>
|
||||
<$transclude $variable="src" $mode="block"/>
|
||||
<p>
|
||||
... and the underlying HTML is:
|
||||
</p>
|
||||
<$wikify name="html" text=<<src>> output="html">
|
||||
<$codeblock code=<<html>>/>
|
||||
</$wikify>
|
||||
</div>
|
||||
\end
|
||||
|
||||
\define wikitext-example-without-html(src)
|
||||
\procedure wikitext-example-without-html(src)
|
||||
<div class="doc-example">
|
||||
|
||||
<$macrocall $name="copy-to-clipboard-above-right" src=<<__src__>>/>
|
||||
|
||||
<$codeblock code=<<__src__>>/>
|
||||
|
||||
That renders as:
|
||||
|
||||
<$macrocall $name="__src__"/>
|
||||
|
||||
<$macrocall $name="copy-to-clipboard-above-right" src=<<src>>/>
|
||||
<$codeblock code=<<src>>/>
|
||||
<p>
|
||||
That renders as:
|
||||
</p>
|
||||
<$transclude $variable="src" $mode="block"/>
|
||||
</div>
|
||||
\end
|
||||
|
||||
\define wikitext-example-table-header() <thead><tr><th/><th>wiki text</th><th>renders as</th></tr></thead>
|
||||
\procedure wikitext-example-table-header() <thead><tr><th/><th>wiki text</th><th>renders as</th></tr></thead>
|
||||
|
||||
\define wikitext-example-table-row(id, code)
|
||||
<tr>
|
||||
<th><<__id__>></th><td><$codeblock code=<<__code__>>/></td><td>
|
||||
|
||||
<<__code__>>
|
||||
</td>
|
||||
\procedure wikitext-example-table-row(id, code)
|
||||
<tr>
|
||||
<th><<id>></th>
|
||||
<td><$codeblock code=<<code>>/></td>
|
||||
<td><<code>></td>
|
||||
</tr>
|
||||
\end
|
||||
|
||||
\define tw-code(tiddler)
|
||||
\procedure tw-code(tiddler)
|
||||
<$codeblock language={{$tiddler$!!type}} code={{$tiddler$}}/>
|
||||
\end
|
||||
|
||||
\define tw-code-link(tiddler)
|
||||
\procedure tw-code-link(tiddler)
|
||||
[[$tiddler$]]:
|
||||
|
||||
<<tw-code $tiddler$>>
|
||||
\end
|
||||
|
||||
\define flex-card(class,bordercolor:"",backgroundcolor:"",textcolor:"",imageField:"image",captionField:"caption",subtitle:"",descriptionField:"description",linkField:"link")
|
||||
\whitespace trim
|
||||
<$link class={{{ [<__class__>addprefix[tc-card ]] }}} to={{{ [<currentTiddler>get<__linkField__>else<currentTiddler>] }}}>
|
||||
<div class="tc-card-accent" style.borderTop={{{ [<__bordercolor__>!is[blank]addprefix[5px solid ]] }}} style.background={{!!background}} style.backgroundColor=<<__backgroundcolor__>> style.color=<<__textcolor__>> style.fill=<<__textcolor__>>>
|
||||
\procedure flex-card(class,bordercolor:"",backgroundcolor:"",textcolor:"",imageField:"image",captionField:"caption",subtitle:"",descriptionField:"description",linkField:"link")
|
||||
<$link class={{{ [<class>addprefix[tc-card ]] }}} to={{{ [<currentTiddler>get<linkField>else<currentTiddler>] }}}>
|
||||
<div class="tc-card-accent" style.borderTop={{{ [<bordercolor>!is[blank]addprefix[5px solid ]] }}} style.background={{!!background}} style.backgroundColor=<<backgroundcolor>> style.color=<<textcolor>> style.fill=<<textcolor>>>
|
||||
<$list filter="[<currentTiddler>has[ribbon-text]]" variable="ignore">
|
||||
<div class="tc-card-ribbon-wrapper">
|
||||
<div class="tc-card-ribbon" style.backgroundColor={{{ [<currentTiddler>get[ribbon-color]else[red]] }}}>
|
||||
|
@ -108,21 +100,21 @@ That renders as:
|
|||
</div>
|
||||
</div>
|
||||
</$list>
|
||||
<$list filter="[<currentTiddler>has<__imageField__>]" variable="ignore">
|
||||
<$list filter="[<currentTiddler>has<imageField>]" variable="ignore">
|
||||
<div class="tc-card-image">
|
||||
<$image source={{{ [<currentTiddler>get<__imageField__>] }}}/>
|
||||
<$image source={{{ [<currentTiddler>get<imageField>] }}}/>
|
||||
</div>
|
||||
</$list>
|
||||
<div class="tc-card-title"><$transclude field=<<__captionField__>>><$view field="title"/></$transclude></div>
|
||||
<$list filter="[<__subtitle__>!is[blank]]" variable="ignore">
|
||||
<div class="tc-card-title"><$transclude field=<<captionField>>><$view field="title"/></$transclude></div>
|
||||
<$list filter="[<subtitle>!is[blank]]" variable="ignore">
|
||||
<div class="tc-card-subtitle">
|
||||
<$text text=<<__subtitle__>>/>
|
||||
<$text text=<<subtitle>>/>
|
||||
</div>
|
||||
</$list>
|
||||
<div class="tc-card-icon"><$transclude tiddler={{!!icon}}/></div>
|
||||
<div class="tc-card-body-wrapper">
|
||||
<div class="tc-card-body">
|
||||
<$transclude field=<<__descriptionField__>> mode="block"/>
|
||||
<$transclude field=<<descriptionField>> mode="block"/>
|
||||
</div>
|
||||
<div class="tc-card-body-clear">
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
created: 20230616104546608
|
||||
modified: 20240214174032498
|
||||
tags: [[tag-picker Macro]] [[Macro Examples]]
|
||||
title: tag-picker Macro (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.warning """The first example will set the tag of the <<.tid currentTiddler>> so you should copy / paste it to a new tiddler for testing. Otherwise you'll change "this tiddler" """>>
|
||||
|
||||
<$macrocall $name=".example" n="1"
|
||||
eg="""Use all existing tags and set the ''tags'' field here: <<tag-picker>>
|
||||
"""/>
|
||||
|
||||
----
|
||||
|
||||
<$let transclusion=test>
|
||||
|
||||
<<.tip """The following examples use a temporary tiddler: $:/temp/test/tag-picker. So this tiddler will not be changed """>>
|
||||
|
||||
|
||||
<$macrocall $name=".example" n="2"
|
||||
eg="""$:/temp/test/tag-picker ''tags'': <$text text={{{ [[$:/temp/test/tag-picker]get[tags]enlist-input[]join[, ]else[n/a]] }}}/>
|
||||
|
||||
Use all existing tags and set the $:/temp/test/tag-picker ''tags'' field: <<tag-picker tiddler:"$:/temp/test/tag-picker">>
|
||||
"""/>
|
||||
|
||||
----
|
||||
|
||||
<<.tip """Use the following example to populate the $:/temp/test/tag-picker ''foo''-field, which are needed by some examples below """>>
|
||||
|
||||
<$macrocall $name=".example" n="3"
|
||||
eg="""$:/temp/test/tag-picker ''foo'': <$text text={{{ [[$:/temp/test/tag-picker]get[foo]enlist-input[]join[, ]else[n/a]] }}}/>
|
||||
|
||||
Use all existing tags and set the $:/temp/test/tag-picker ''foo'' field: <<tag-picker tagField:"foo" tiddler:"$:/temp/test/tag-picker">>
|
||||
"""/>
|
||||
|
||||
----
|
||||
|
||||
<<.tip """The following example expects some values in the "foo" field of the tiddler $:/temp/test/tag-picker, which can be created by the example above.""">>
|
||||
|
||||
<$macrocall $name=".example" n="4" eg="""\procedure listSource() $:/temp/test/tag-picker
|
||||
|
||||
$:/temp/test/tag-picker foo: <$text text={{{ [[$:/temp/test/tag-picker]get[foo]enlist-input[]join[, ]else[n/a]] }}}/><br>
|
||||
$:/temp/test/tag-picker bar: <$text text={{{ [[$:/temp/test/tag-picker]get[bar]enlist-input[]join[, ]else[n/a]] }}}/>
|
||||
|
||||
Use $:/temp/test/tag-picker ''foo'' field as source and set ''bar'': <<tag-picker tagField:"bar" tagListFilter:"[<listSource>get[foo]enlist-input[]]" tiddler:"$:/temp/test/tag-picker">>
|
||||
"""/>
|
||||
|
||||
----
|
||||
|
||||
<<.tip """The following example expects some values in the "foo" field of the tiddler $:/temp/test/tag-picker, which can be created by the example above.<br>
|
||||
It will also add completely new tags to the bar-field and the source tiddlers foo-field. New tags can be entered by typing into the tag-name input
|
||||
""">>
|
||||
|
||||
<$macrocall $name=".example" n="5" eg="""
|
||||
\procedure listSource() $:/temp/test/tag-picker
|
||||
\procedure listSourceField() foo
|
||||
|
||||
\procedure addNewTagToSource()
|
||||
<$action-listops $tiddler=<<listSource>> $field=<<listSourceField>> $subfilter='[<listSource>get<listSourceField>enlist-input[]] [<tag>trim[]]'/>
|
||||
\end
|
||||
|
||||
$:/temp/test/tag-picker foo: <$text text={{{ [[$:/temp/test/tag-picker]get[foo]enlist-input[]join[, ]else[n/a]] }}}/><br>
|
||||
$:/temp/test/tag-picker ''bar'': <$text text={{{ [[$:/temp/test/tag-picker]get[bar]enlist-input[]join[, ]else[n/a]] }}}/>
|
||||
|
||||
Use $:/temp/test/tag-picker ''foo'' field as source and set ''bar'': <$macrocall $name="tag-picker" tagField="bar" tagListFilter="[<listSource>get<listSourceField>enlist-input[]]" tiddler="$:/temp/test/tag-picker" actions=<<addNewTagToSource>>/>
|
||||
|
||||
"""/>
|
||||
|
||||
</$let>
|
|
@ -16,6 +16,7 @@ The ''action-deletefield'' widget is invisible. Any content within it is ignored
|
|||
|!Attribute |!Description |
|
||||
|$tiddler |The title of the tiddler whose fields are to be modified (if not provided defaults to the [[current tiddler|Current Tiddler]]) |
|
||||
|$field |Optional name of a field to delete |
|
||||
|$timestamp |<<.from-version "5.3.4">> Specifies whether the timestamp(s) of the target tiddler will be updated (''modified'' and ''modifier'', plus ''created'' and ''creator'' for newly created tiddlers). Can be "yes" (the default) or "no" |
|
||||
|//{any attributes not starting with $}// |Each attribute name specifies a field to be deleted. The attribute value is ignored and need not be specified |
|
||||
|
||||
! Examples
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
created: 20140908130500000
|
||||
modified: 20150219182745000
|
||||
modified: 20240326164134356
|
||||
tags: Concepts Reference
|
||||
title: Widgets
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
~TiddlyWiki's display is driven by an underlying collection of <<.def widgets>>. These are organised into a tree structure: each widget has a parent widget and zero or more child widgets.
|
||||
|
||||
~TiddlyWiki generates this <<.def "widget tree">> by parsing the WikiText of tiddlers. Each component of the WikiText syntax, including even the trivial case of ordinary text, generates a corresponding widget. The widget tree is an intermediate representation that is subsequently rendered into the actual display.
|
||||
~TiddlyWiki generates this <<.def "widget tree">> by parsing the ~WikiText of tiddlers. Each component of the ~WikiText syntax, including even the trivial case of ordinary text, generates a corresponding widget. The widget tree is an intermediate representation that is subsequently rendered into the actual display.
|
||||
|
||||
Widgets are analogous to elements in an HTML document. Indeed, HTML tags in WikiText generate dedicated <<.def "element widgets">>.
|
||||
Widgets are analogous to elements in an HTML document. Indeed, HTML tags in ~WikiText generate dedicated <<.def "element widgets">>.
|
||||
|
||||
Each class of widget contributes a specific ability to the overall functionality, such as the ability to <<.wlink2 "display an image" ImageWidget>> or <<.wlink2 "a button" ButtonWidget>>, to <<.wlink2 "call a macro" MacroCallWidget>> or <<.wlink2 "transclude text from elsewhere" TranscludeWidget>>, or to [[mark a piece of text as a heading|HTML in WikiText]].
|
||||
|
||||
|
@ -16,4 +16,4 @@ The more specialised widgets use a general-purpose [[widget syntax|Widgets in Wi
|
|||
|
||||
The following classes of widget are built into the core:
|
||||
|
||||
<<list-links "[tag[Widgets]]">>
|
||||
<<list-links "[tag[Widgets]]" class:"multi-columns">>
|
||||
|
|
|
@ -561,3 +561,7 @@ Wang Ke, @Gk0Wk, 2023/10/17
|
|||
John Long, @drevarr, 2023/12/12
|
||||
|
||||
Ed Holsinger, @eschlon, 2024/02/08
|
||||
|
||||
Kim I. McKinley, @PotOfCoffee2Go, 2024/03/16
|
||||
|
||||
@Jinix6, 2024/03/31
|
|
@ -4,8 +4,6 @@ This plugin provides a diagonal ribbon across the corner of the window. It resem
|
|||
|
||||
The ribbon can be positioned over any corner, and can incorporate user defined text, colours and a link.
|
||||
|
||||
The CSS stylesheet is adapted from work by Simon Whitaker:
|
||||
The CSS stylesheet is adapted from work by [[Simon Whitaker|https://github.com/simonwhitaker/github-fork-ribbon-css/]]
|
||||
|
||||
https://github.com/simonwhitaker/github-fork-ribbon-css/
|
||||
|
||||
[[Source code|https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/github-fork-ribbon]]
|
||||
[[Plugin source code|https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/github-fork-ribbon]]
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
title: $:/plugins/tiddlywiki/github-fork-ribbon/styles
|
||||
tags: [[$:/tags/Stylesheet]]
|
||||
|
||||
/* Left will inherit from right (so we don't need to duplicate code */
|
||||
.github-fork-ribbon {
|
||||
|
@ -10,7 +9,7 @@ tags: [[$:/tags/Stylesheet]]
|
|||
padding: 2px 0;
|
||||
|
||||
/* Set the base colour */
|
||||
background-color: #a00;
|
||||
background-color: <<color>>;
|
||||
|
||||
/* Set a gradient: transparent black at the top to almost-transparent black at the bottom */
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.00)), to(rgba(0, 0, 0, 0.15)));
|
||||
|
@ -25,7 +24,7 @@ tags: [[$:/tags/Stylesheet]]
|
|||
-webkit-box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.5);
|
||||
box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.5);
|
||||
|
||||
z-index: 999;
|
||||
z-index: 700;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
|
@ -61,8 +60,8 @@ tags: [[$:/tags/Stylesheet]]
|
|||
height: 150px;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
top: 0;
|
||||
z-index: 999;
|
||||
top: <<top>>;
|
||||
z-index: 700;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
@ -71,25 +70,25 @@ tags: [[$:/tags/Stylesheet]]
|
|||
}
|
||||
|
||||
.github-fork-ribbon-wrapper.left {
|
||||
left: 0;
|
||||
left: <<left>>;
|
||||
}
|
||||
|
||||
.github-fork-ribbon-wrapper.right {
|
||||
right: 0;
|
||||
right: <<right>>;
|
||||
}
|
||||
|
||||
.github-fork-ribbon-wrapper.left-bottom {
|
||||
position: fixed;
|
||||
top: inherit;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
bottom: <<bottom>>;
|
||||
left: <<left>>;
|
||||
}
|
||||
|
||||
.github-fork-ribbon-wrapper.right-bottom {
|
||||
position: fixed;
|
||||
top: inherit;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
bottom: <<bottom>>;
|
||||
right: <<right>>;
|
||||
}
|
||||
|
||||
.github-fork-ribbon-wrapper.right .github-fork-ribbon {
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
title: $:/plugins/tiddlywiki/github-fork-ribbon/template
|
||||
|
||||
<!-- Parameters:
|
||||
position: "right", "left", "right-bottom" and "left-bottom"
|
||||
url: link target
|
||||
text: ribbon text
|
||||
color: defaults to "#aa0000" - dark red
|
||||
top: offset from the top in px - eg: "30px"
|
||||
bottom: offset from the bottom in px - No ;
|
||||
left: offset from left in px - No ;
|
||||
right: offset from right in px - No ;
|
||||
fixed: "fixed" .. If ribbon is at the top, it can be "fixed". Bottom is always fixed
|
||||
-->
|
||||
\parameters (position:"right", url:"https://github.com/Jermolene/TiddlyWiki5", text:"Fork me on ~GitHub" color:"#aa0000" top:"0" bottom:"0" left:"0" right:"0" fixed:"")
|
||||
|
||||
<style>
|
||||
{{$:/plugins/tiddlywiki/github-fork-ribbon/styles}}
|
||||
</style>
|
||||
|
||||
<div class={{{ github-fork-ribbon-wrapper [<position>] [<fixed>] +[join[ ]] }}}>
|
||||
<div class="github-fork-ribbon">
|
||||
<a href=<<url>>>
|
||||
<<text>>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
|
@ -1,26 +1,81 @@
|
|||
title: $:/plugins/tiddlywiki/github-fork-ribbon/usage
|
||||
|
||||
Copy appropriate chunks on a new tiddler and tag it `$:/tags/PageControls`. Name of the new tiddler does not matter. Only the tag matters.
|
||||
\procedure ribbonCode()
|
||||
\whitespace trim
|
||||
<$transclude $tiddler="$:/plugins/tiddlywiki/github-fork-ribbon/template" top="30px" fixed=fixed color="green"/>
|
||||
\end
|
||||
|
||||
```
|
||||
<!-- TOP RIGHT RIBBON: START COPYING HERE -->
|
||||
<div class="github-fork-ribbon-wrapper right"><div class="github-fork-ribbon"><a href="https://github.com/simonwhitaker/github-fork-ribbon-css">Fork me on ~GitHub</a></div>
|
||||
</div>
|
||||
<!-- TOP RIGHT RIBBON: END COPYING HERE -->
|
||||
\procedure ribbonCreateActions()
|
||||
<% if [[$:/github-ribbon]!is[tiddler]] %>
|
||||
<$action-setfield $tiddler="$:/github-ribbon" $field="text" $value=<<ribbonCode>>
|
||||
tags="$:/tags/PageTemplate"
|
||||
code-body="yes" />
|
||||
<% endif %>
|
||||
<$action-navigate $to="$:/github-ribbon" />
|
||||
\end
|
||||
|
||||
<!-- TOP LEFT RIBBON: START COPYING HERE -->
|
||||
<div class="github-fork-ribbon-wrapper left"><div class="github-fork-ribbon"><a href="https://github.com/simonwhitaker/github-fork-ribbon-css">Fork me on ~GitHub</a></div>
|
||||
</div>
|
||||
<!-- TOP LEFT RIBBON: END COPYING HERE -->
|
||||
\procedure createRibbon()
|
||||
<$button actions=<<ribbonCreateActions>> >
|
||||
<%if [[$:/github-ribbon]!is[tiddler]] %>
|
||||
Create
|
||||
<% else %>
|
||||
Show
|
||||
<% endif %> ~$:/github-ribbon
|
||||
</$button>
|
||||
\end
|
||||
|
||||
\procedure ribbonToggleTagActions()
|
||||
<$action-listops $tiddler="$:/github-ribbon" $field="tags" $subfilter="+[toggle[$:/tags/PageTemplate]]" />
|
||||
\end
|
||||
|
||||
\procedure ribbonToggleTag() <$button actions=<<ribbonToggleTagActions>> >Toggle Tag</$button>
|
||||
|
||||
|
||||
<!-- BOTTOM RIGHT RIBBON: START COPYING HERE -->
|
||||
<div class="github-fork-ribbon-wrapper right-bottom"><div class="github-fork-ribbon"><a href="https://github.com/simonwhitaker/github-fork-ribbon-css">Fork me on ~GitHub</a></div>
|
||||
</div>
|
||||
<!-- BOTTOM RIGHT RIBBON: END COPYING HERE -->
|
||||
`$:/plugins/tiddlywiki/github-fork-ribbon/template` is a template tiddler, that can be used with a transclusion and parameters.
|
||||
|
||||
<!-- BOTTOM LEFT RIBBON: START COPYING HERE -->
|
||||
<div class="github-fork-ribbon-wrapper left-bottom"><div class="github-fork-ribbon"><a href="https://github.com/simonwhitaker/github-fork-ribbon-css">Fork me on ~GitHub</a></div>
|
||||
</div>
|
||||
<!-- BOTTOM LEFT RIBBON: END COPYING HERE -->
|
||||
```
|
||||
!! Usage
|
||||
|
||||
* Create a new tiddler eg: $:/github-ribbon
|
||||
* Tag it `$:/tags/PageTemplate`
|
||||
* Copy the code below
|
||||
|
||||
<pre><$text text=<<ribbonCode>>/></pre>
|
||||
|
||||
<<createRibbon>> <<ribbonToggleTag>>
|
||||
|
||||
!! Parameters
|
||||
|
||||
; position
|
||||
: "right" (default), "left", "right-bottom" and "left-bottom"
|
||||
|
||||
; url
|
||||
: Target URL, default: https://github.com/Jermolene/TiddlyWiki5
|
||||
|
||||
; text
|
||||
: Ribbon text. default: `Fork me on ~GitHub`
|
||||
|
||||
; color
|
||||
: Ribbon background color: default: `#aa0000`
|
||||
|
||||
; top
|
||||
: Offset from the top if postion is top. default: `0` eg: `30px`, if the menu-toolbar plugin is installed
|
||||
|
||||
; bottom
|
||||
: Offset from the bottom in px
|
||||
|
||||
; left
|
||||
: Offset from the left in px
|
||||
|
||||
; right
|
||||
: Offset from the right in px
|
||||
|
||||
; fixed
|
||||
: If position is ''top'', the ribbon will scroll out of the viewport by default
|
||||
: If the parameter `fixed="fixed"` it will be fixed
|
||||
|
||||
!! Remove the Ribbon
|
||||
|
||||
* Disable the plugin
|
||||
* ''Remove the tag'' from $:/github-ribbon tiddler
|
||||
* Delete the $:/github-ribbon tiddler
|
||||
* <<ribbonToggleTag>>
|
|
@ -5,15 +5,14 @@ caption: Page controls
|
|||
custom-menu-content: <$transclude tiddler="$:/plugins/tiddlywiki/menubar/items/pagecontrols" mode="inline"/>
|
||||
|
||||
\whitespace trim
|
||||
\define config-title()
|
||||
$:/config/PageControlButtons/Visibility/$(listItem)$
|
||||
\end
|
||||
\define config-title() $:/config/PageControlButtons/Visibility/$(listItem)$
|
||||
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]]" variable="listItem">
|
||||
<$set name="hidden" value=<<config-title>>>
|
||||
<$list filter="[<hidden>!text[hide]]" storyview="pop" variable="ignore">
|
||||
<$set name="tv-config-toolbar-class" filter="[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]">
|
||||
<$transclude tiddler=<<listItem>> mode="inline"/>
|
||||
</$set>
|
||||
</$list>
|
||||
</$set>
|
||||
<$set name="hidden" value=<<config-title>>>
|
||||
<$list filter="[<hidden>!text[hide]]" storyview="pop" variable="ignore">
|
||||
<$set name="tv-config-toolbar-class" filter="[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]">
|
||||
<$transclude tiddler=<<listItem>> mode="inline"/>
|
||||
</$set>
|
||||
</$list>
|
||||
</$set>
|
||||
</$list>
|
||||
|
|
|
@ -931,6 +931,7 @@ button.tc-btn-invisible.tc-remove-tag-button {
|
|||
|
||||
.tc-page-controls {
|
||||
margin-top: 14px;
|
||||
margin-bottom: 14px;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
|
@ -1335,6 +1336,7 @@ canvas.tc-edit-bitmapeditor {
|
|||
clear: both;
|
||||
}
|
||||
|
||||
.tc-single-tiddler-window .tc-tiddler-body,
|
||||
.tc-tiddler-frame .tc-tiddler-body {
|
||||
font-size: {{$:/themes/tiddlywiki/vanilla/metrics/bodyfontsize}};
|
||||
line-height: {{$:/themes/tiddlywiki/vanilla/metrics/bodylineheight}};
|
||||
|
@ -1344,6 +1346,11 @@ canvas.tc-edit-bitmapeditor {
|
|||
overflow: hidden; /* https://github.com/Jermolene/TiddlyWiki5/issues/282 */
|
||||
}
|
||||
|
||||
/*
|
||||
* Tiddler in a new window.
|
||||
* Also see: .tc-single-tiddler-window .tc-tiddler-body, above
|
||||
*/
|
||||
|
||||
html body.tc-body.tc-single-tiddler-window {
|
||||
margin: 1em;
|
||||
background: <<colour tiddler-background>>;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
title: $:/themes/tiddlywiki/vanilla/reset
|
||||
type: text/css
|
||||
|
||||
/*! modern-normalize v1.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
|
||||
/*! modern-normalize v2.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
|
||||
|
||||
/*
|
||||
Document
|
||||
|
@ -13,28 +13,26 @@ Use a better box model (opinionated).
|
|||
*/
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
::before,
|
||||
::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/**
|
||||
Use a more readable tab size (opinionated).
|
||||
*/
|
||||
|
||||
:root {
|
||||
-moz-tab-size: 4;
|
||||
tab-size: 4;
|
||||
}
|
||||
|
||||
/**
|
||||
1. Correct the line height in all browsers.
|
||||
2. Prevent adjustments of font size after orientation changes in iOS.
|
||||
*/
|
||||
|
||||
html {
|
||||
line-height: 1.15; /* 1 */
|
||||
-webkit-text-size-adjust: 100%; /* 2 */
|
||||
/* Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) */
|
||||
font-family:
|
||||
system-ui,
|
||||
'Segoe UI',
|
||||
Roboto,
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif,
|
||||
'Apple Color Emoji',
|
||||
'Segoe UI Emoji';
|
||||
line-height: 1.15; /* 1. Correct the line height in all browsers. */
|
||||
-webkit-text-size-adjust: 100%; /* 2. Prevent adjustments of font size after orientation changes in iOS. */
|
||||
-moz-tab-size: 4; /* 3. Use a more readable tab size (opinionated). */
|
||||
tab-size: 4; /* 3 */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -42,29 +40,8 @@ Sections
|
|||
========
|
||||
*/
|
||||
|
||||
/**
|
||||
Remove the margin in all browsers.
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
|
||||
*/
|
||||
|
||||
body {
|
||||
font-family:
|
||||
system-ui,
|
||||
-apple-system, /* Firefox supports this but not yet `system-ui` */
|
||||
'Segoe UI',
|
||||
Roboto,
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif,
|
||||
'Apple Color Emoji',
|
||||
'Segoe UI Emoji';
|
||||
margin: 0; /* Remove the margin in all browsers. */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -78,8 +55,8 @@ Grouping content
|
|||
*/
|
||||
|
||||
hr {
|
||||
height: 0; /* 1 */
|
||||
color: inherit; /* 2 */
|
||||
height: 0; /* 1 */
|
||||
color: inherit; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -92,7 +69,7 @@ Add the correct text decoration in Chrome, Edge, and Safari.
|
|||
*/
|
||||
|
||||
abbr[title] {
|
||||
text-decoration: underline dotted;
|
||||
text-decoration: underline dotted;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,7 +78,7 @@ Add the correct font weight in Edge and Safari.
|
|||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,14 +90,14 @@ code,
|
|||
kbd,
|
||||
samp,
|
||||
pre {
|
||||
font-family:
|
||||
ui-monospace,
|
||||
SFMono-Regular,
|
||||
Consolas,
|
||||
'Liberation Mono',
|
||||
Menlo,
|
||||
monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
font-family:
|
||||
ui-monospace,
|
||||
SFMono-Regular,
|
||||
Consolas,
|
||||
'Liberation Mono',
|
||||
Menlo,
|
||||
monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,7 +105,7 @@ Add the correct font size in all browsers.
|
|||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -137,18 +114,18 @@ Prevent 'sub' and 'sup' elements from affecting the line height in all browsers.
|
|||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -158,12 +135,12 @@ Tabular data
|
|||
|
||||
/**
|
||||
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
|
||||
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
|
||||
2. Correct table border color inheritance in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
|
||||
*/
|
||||
|
||||
table {
|
||||
text-indent: 0; /* 1 */
|
||||
border-color: inherit; /* 2 */
|
||||
text-indent: 0; /* 1 */
|
||||
border-color: inherit; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -181,20 +158,19 @@ input,
|
|||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit; /* 1 */
|
||||
font-size: 100%; /* 1 */
|
||||
line-height: 1.15; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
font-family: inherit; /* 1 */
|
||||
font-size: 100%; /* 1 */
|
||||
line-height: 1.15; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
Remove the inheritance of text transform in Edge and Firefox.
|
||||
1. Remove the inheritance of text transform in Firefox.
|
||||
*/
|
||||
|
||||
button,
|
||||
select { /* 1 */
|
||||
text-transform: none;
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -205,7 +181,7 @@ button,
|
|||
[type='button'],
|
||||
[type='reset'],
|
||||
[type='submit'] {
|
||||
-webkit-appearance: button;
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -213,8 +189,8 @@ Remove the inner border and padding in Firefox.
|
|||
*/
|
||||
|
||||
::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0;
|
||||
border-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -222,7 +198,7 @@ Restore the focus styles unset by the previous rule.
|
|||
*/
|
||||
|
||||
:-moz-focusring {
|
||||
outline: 1px dotted ButtonText;
|
||||
outline: 1px dotted ButtonText;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -231,7 +207,7 @@ See: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d4
|
|||
*/
|
||||
|
||||
:-moz-ui-invalid {
|
||||
box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -239,7 +215,7 @@ Remove the padding so developers are not caught out when they zero out 'fieldset
|
|||
*/
|
||||
|
||||
legend {
|
||||
padding: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,7 +223,7 @@ Add the correct vertical alignment in Chrome and Firefox.
|
|||
*/
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -256,7 +232,7 @@ Correct the cursor style of increment and decrement buttons in Safari.
|
|||
|
||||
::-webkit-inner-spin-button,
|
||||
::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -265,8 +241,8 @@ Correct the cursor style of increment and decrement buttons in Safari.
|
|||
*/
|
||||
|
||||
[type='search'] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
outline-offset: -2px; /* 2 */
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
outline-offset: -2px; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -274,7 +250,7 @@ Remove the inner padding in Chrome and Safari on macOS.
|
|||
*/
|
||||
|
||||
::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -283,8 +259,8 @@ Remove the inner padding in Chrome and Safari on macOS.
|
|||
*/
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button; /* 1 */
|
||||
font: inherit; /* 2 */
|
||||
-webkit-appearance: button; /* 1 */
|
||||
font: inherit; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -297,5 +273,5 @@ Add the correct display in Chrome and Safari.
|
|||
*/
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
display: list-item;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue