mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-21 06:26:52 +00:00
feat: add void: true, in ast node to prevent render
This commit is contained in:
parent
c39297698f
commit
b22ca2b3df
@ -55,8 +55,8 @@ exports.parse = function() {
|
|||||||
var commentEnd = this.endMatch.index + this.endMatch[0].length;
|
var commentEnd = this.endMatch.index + this.endMatch[0].length;
|
||||||
var commentText = this.parser.source.slice(commentStart, commentEnd);
|
var commentText = this.parser.source.slice(commentStart, commentEnd);
|
||||||
return [{
|
return [{
|
||||||
type: "element",
|
type: "comment",
|
||||||
tag: "data",
|
void: true,
|
||||||
text: commentText,
|
text: commentText,
|
||||||
start: commentStart,
|
start: commentStart,
|
||||||
end: commentEnd
|
end: commentEnd
|
||||||
@ -64,7 +64,7 @@ exports.parse = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.serialize = function(tree, serialize) {
|
exports.serialize = function(tree, serialize) {
|
||||||
return tree.text + "\n\n";
|
return tree.text + "\n\n" + serialize(tree.children);
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -48,8 +48,8 @@ exports.parse = function() {
|
|||||||
var commentEnd = this.endMatch.index + this.endMatch[0].length;
|
var commentEnd = this.endMatch.index + this.endMatch[0].length;
|
||||||
var commentText = this.parser.source.slice(commentStart, commentEnd);
|
var commentText = this.parser.source.slice(commentStart, commentEnd);
|
||||||
return [{
|
return [{
|
||||||
type: "element",
|
type: "comment",
|
||||||
tag: "data",
|
void: true,
|
||||||
text: commentText,
|
text: commentText,
|
||||||
start: commentStart,
|
start: commentStart,
|
||||||
end: commentEnd
|
end: commentEnd
|
||||||
|
@ -63,8 +63,8 @@ exports.parse = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [{
|
return [{
|
||||||
type: "element",
|
type: "parsermode",
|
||||||
tag: "data",
|
void: true,
|
||||||
parseAsInline: this.parser.parseAsInline,
|
parseAsInline: this.parser.parseAsInline,
|
||||||
start: start,
|
start: start,
|
||||||
end: this.parser.pos
|
end: this.parser.pos
|
||||||
|
@ -553,7 +553,8 @@ Widget.prototype.makeChildWidget = function(parseTreeNode,options) {
|
|||||||
var WidgetClass = this.widgetClasses[parseTreeNode.type];
|
var WidgetClass = this.widgetClasses[parseTreeNode.type];
|
||||||
if(!WidgetClass) {
|
if(!WidgetClass) {
|
||||||
WidgetClass = this.widgetClasses.text;
|
WidgetClass = this.widgetClasses.text;
|
||||||
parseTreeNode = {type: "text", text: "Undefined widget '" + parseTreeNode.type + "'"};
|
// Skip void node that is not intended for render. Show error for missing widgets.
|
||||||
|
parseTreeNode = {type: "text", text: parseTreeNode.void ? "" : "Undefined widget '" + parseTreeNode.type + "'"};
|
||||||
}
|
}
|
||||||
// Create set variable widgets for each variable
|
// Create set variable widgets for each variable
|
||||||
$tw.utils.each(options.variables,function(value,name) {
|
$tw.utils.each(options.variables,function(value,name) {
|
||||||
|
@ -12,8 +12,7 @@ The main module of the Jasmine test plugin for TiddlyWiki5
|
|||||||
/*global $tw: true */
|
/*global $tw: true */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// DEBUG: only run my tests for development, remove before PR merge
|
var TEST_TIDDLER_FILTER = "[all[tiddlers+shadows]type[application/javascript]tag[$:/tags/test-spec]]";
|
||||||
var TEST_TIDDLER_FILTER = "[[test-wikitext-serialize.js]]";
|
|
||||||
var TESTS_DONE = false;
|
var TESTS_DONE = false;
|
||||||
|
|
||||||
exports.testsWereRun = function() {
|
exports.testsWereRun = function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user