mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-15 22:34:51 +00:00
Revert previous implementation
This commit is contained in:
parent
2a2fd1caa8
commit
09cc3b0b73
@ -32,7 +32,6 @@ options: see below:
|
||||
parseAsInline: true to parse text as inline instead of block
|
||||
wiki: reference to wiki to use
|
||||
_canonical_uri: optional URI of content if text is missing or empty
|
||||
title: optional tiddler title to be available within this parse tree via the variable "thisTiddler"
|
||||
*/
|
||||
var WikiParser = function(type,text,options) {
|
||||
this.wiki = options.wiki;
|
||||
@ -52,9 +51,8 @@ var WikiParser = function(type,text,options) {
|
||||
this.parseAsInline = options.parseAsInline;
|
||||
// Set current parse position
|
||||
this.pos = 0;
|
||||
// Start with empty output and initialise insertion point
|
||||
// Start with empty output
|
||||
this.tree = [];
|
||||
var topBranch = this.tree;
|
||||
// Assemble the rule classes we're going to use
|
||||
var pragmaRuleClasses, blockRuleClasses, inlineRuleClasses;
|
||||
if(options.rules) {
|
||||
@ -84,22 +82,8 @@ var WikiParser = function(type,text,options) {
|
||||
// Instantiate the parser block and inline rules
|
||||
this.blockRules = this.instantiateRules(blockRuleClasses,"block",0);
|
||||
this.inlineRules = this.instantiateRules(inlineRuleClasses,"inline",0);
|
||||
// Set the "thisTiddler" variable
|
||||
if(options.title) {
|
||||
var thisTiddlerAssignment = {
|
||||
type: "set",
|
||||
attributes: {
|
||||
name: {type: "string", value: "thisTiddler"},
|
||||
value: {type: "string", value: options.title}
|
||||
},
|
||||
children: [],
|
||||
doNotImport: true
|
||||
};
|
||||
topBranch.push(thisTiddlerAssignment);
|
||||
topBranch = thisTiddlerAssignment.children;
|
||||
}
|
||||
// Parse any pragmas
|
||||
topBranch = this.parsePragmas(topBranch);
|
||||
var topBranch = this.parsePragmas();
|
||||
// Parse the text into inline runs or blocks
|
||||
if(this.parseAsInline) {
|
||||
topBranch.push.apply(topBranch,this.parseInlineRun());
|
||||
@ -206,8 +190,8 @@ WikiParser.prototype.findNextMatch = function(rules,startPos) {
|
||||
/*
|
||||
Parse any pragmas at the beginning of a block of parse text
|
||||
*/
|
||||
WikiParser.prototype.parsePragmas = function(targetParseTreeNodes) {
|
||||
var currentTreeBranch = targetParseTreeNodes || this.tree;
|
||||
WikiParser.prototype.parsePragmas = function() {
|
||||
var currentTreeBranch = this.tree;
|
||||
while(true) {
|
||||
// Skip whitespace
|
||||
this.skipWhitespace();
|
||||
|
@ -74,7 +74,7 @@ ImportVariablesWidget.prototype.execute = function(tiddlerList) {
|
||||
$tw.utils.each(Object.keys(widget.variables), function(key) {
|
||||
widgetPointer.variables[key] = widget.variables[key];
|
||||
});
|
||||
} else if(!parseTreeNode.doNotImport) {
|
||||
} else {
|
||||
widgetPointer.children = [widgetPointer.makeChildWidget(node)];
|
||||
// No more regenerating children for
|
||||
// this widget. If it needs to refresh,
|
||||
|
@ -969,7 +969,6 @@ Parse a block of text of a specified MIME type
|
||||
Options include:
|
||||
parseAsInline: if true, the text of the tiddler will be parsed as an inline run
|
||||
_canonical_uri: optional string of the canonical URI of this content
|
||||
title: optional tiddler title to be available within this parse tree via the variable "thisTiddler"
|
||||
*/
|
||||
exports.parseText = function(type,text,options) {
|
||||
text = text || "";
|
||||
@ -989,8 +988,7 @@ exports.parseText = function(type,text,options) {
|
||||
return new Parser(type,text,{
|
||||
parseAsInline: options.parseAsInline,
|
||||
wiki: this,
|
||||
_canonical_uri: options._canonical_uri,
|
||||
title: options.title
|
||||
_canonical_uri: options._canonical_uri
|
||||
});
|
||||
};
|
||||
|
||||
@ -998,9 +996,7 @@ exports.parseText = function(type,text,options) {
|
||||
Parse a tiddler according to its MIME type
|
||||
*/
|
||||
exports.parseTiddler = function(title,options) {
|
||||
options = $tw.utils.extend({
|
||||
title: title
|
||||
},options);
|
||||
options = $tw.utils.extend({},options);
|
||||
var cacheType = options.parseAsInline ? "inlineParseTree" : "blockParseTree",
|
||||
tiddler = this.getTiddler(title),
|
||||
self = this;
|
||||
@ -1013,9 +1009,6 @@ exports.parseTiddler = function(title,options) {
|
||||
};
|
||||
|
||||
exports.parseTextReference = function(title,field,index,options) {
|
||||
options = $tw.utils.extend({
|
||||
title: title
|
||||
},options);
|
||||
var tiddler,
|
||||
text,
|
||||
parserInfo;
|
||||
@ -1117,7 +1110,6 @@ options.recursionMarker : optional flag to set a recursion marker, defaults to "
|
||||
options.children: optional array of children for the transclude widget
|
||||
options.importVariables: optional importvariables filter string for macros to be included
|
||||
options.importPageMacros: optional boolean; if true, equivalent to passing "[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]" to options.importVariables
|
||||
options.title: optional tiddler title to be available within this parse tree via the variable "thisTiddler"
|
||||
*/
|
||||
exports.makeTranscludeWidget = function(title,options) {
|
||||
options = options || {};
|
||||
@ -1182,7 +1174,6 @@ Parse text in a specified format and render it into another format
|
||||
Options include:
|
||||
variables: hashmap of variables to set
|
||||
parentWidget: optional parent widget for the root node
|
||||
title: optional tiddler title to be available within this parse tree via the variable "thisTiddler"
|
||||
*/
|
||||
exports.renderText = function(outputType,textType,text,options) {
|
||||
options = options || {};
|
||||
|
Loading…
Reference in New Issue
Block a user