From 360e188e4932e62c90a37727b5f1723fdb0f3a57 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 20 Dec 2012 12:18:38 +0000 Subject: [PATCH] Continuing renaming run rules to inline rules --- .../wikiparser/rules/block/classblock.js | 2 +- .../wikiparser/rules/block/codeblock.js | 2 +- .../parsers/wikiparser/rules/block/heading.js | 4 +- .../parsers/wikiparser/rules/block/list.js | 4 +- .../parsers/wikiparser/rules/block/rule.js | 2 +- .../parsers/wikiparser/rules/block/table.js | 6 +-- .../wikiparser/rules/block/transcludeblock.js | 2 +- .../wikiparser/rules/inline/classinline.js | 10 ++-- .../wikiparser/rules/inline/codeinline.js | 8 ++-- .../wikiparser/rules/inline/comment.js | 6 +-- .../parsers/wikiparser/rules/inline/dash.js | 6 +-- .../wikiparser/rules/inline/emphasis.js | 8 ++-- .../parsers/wikiparser/rules/inline/entity.js | 6 +-- .../wikiparser/rules/inline/extlink.js | 6 +-- .../parsers/wikiparser/rules/inline/html.js | 6 +-- .../wikiparser/rules/inline/macrocall.js | 4 +- .../wikiparser/rules/inline/prettylink.js | 6 +-- .../wikiparser/rules/inline/wikilink.js | 6 +-- .../wikiparser/rules/pragma/macrodef.js | 2 +- core/modules/parsers/wikiparser/wikiparser.js | 48 +++++++++---------- core/modules/wikivocabulary.js | 6 +-- 21 files changed, 75 insertions(+), 75 deletions(-) diff --git a/core/modules/parsers/wikiparser/rules/block/classblock.js b/core/modules/parsers/wikiparser/rules/block/classblock.js index 4b0df5c4b..ac6d61c5b 100644 --- a/core/modules/parsers/wikiparser/rules/block/classblock.js +++ b/core/modules/parsers/wikiparser/rules/block/classblock.js @@ -1,7 +1,7 @@ /*\ title: $:/core/modules/parsers/wikiparser/rules/block/classblock.js type: application/javascript -module-type: wikiblockrule +module-type: wiki-block-rule Wiki text block rule for assigning classes to paragraphs and other blocks. For example: diff --git a/core/modules/parsers/wikiparser/rules/block/codeblock.js b/core/modules/parsers/wikiparser/rules/block/codeblock.js index 074884159..e6141d091 100644 --- a/core/modules/parsers/wikiparser/rules/block/codeblock.js +++ b/core/modules/parsers/wikiparser/rules/block/codeblock.js @@ -1,7 +1,7 @@ /*\ title: $:/core/modules/parsers/wikiparser/rules/block/codeblock.js type: application/javascript -module-type: wikiblockrule +module-type: wiki-block-rule Wiki text rule for code blocks. For example: diff --git a/core/modules/parsers/wikiparser/rules/block/heading.js b/core/modules/parsers/wikiparser/rules/block/heading.js index ceeb10b2c..08e31bbaa 100644 --- a/core/modules/parsers/wikiparser/rules/block/heading.js +++ b/core/modules/parsers/wikiparser/rules/block/heading.js @@ -1,7 +1,7 @@ /*\ title: $:/core/modules/parsers/wikiparser/rules/block/heading.js type: application/javascript -module-type: wikiblockrule +module-type: wiki-block-rule Wiki text block rule for headings @@ -31,7 +31,7 @@ exports.parse = function() { // Parse any classes, whitespace and then the heading itself var classes = this.parser.parseClasses(); this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true}); - var tree = this.parser.parseRun(/(\r?\n)/mg); + var tree = this.parser.parseInlineRun(/(\r?\n)/mg); // Return the heading return [{ type: "element", diff --git a/core/modules/parsers/wikiparser/rules/block/list.js b/core/modules/parsers/wikiparser/rules/block/list.js index 4f2d86854..75bfd26ce 100644 --- a/core/modules/parsers/wikiparser/rules/block/list.js +++ b/core/modules/parsers/wikiparser/rules/block/list.js @@ -1,7 +1,7 @@ /*\ title: $:/core/modules/parsers/wikiparser/rules/block/list.js type: application/javascript -module-type: wikiblockrule +module-type: wiki-block-rule Wiki text block rule for lists. For example: @@ -114,7 +114,7 @@ exports.parse = function() { lastListItem = lastListChildren[lastListChildren.length-1], classes = this.parser.parseClasses(); this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true}); - var tree = this.parser.parseRun(/(\r?\n)/mg); + var tree = this.parser.parseInlineRun(/(\r?\n)/mg); lastListItem.children.push.apply(lastListItem.children,tree); if(classes.length > 0) { $tw.utils.addClassToParseTreeNode(lastListItem,classes.join(" ")); diff --git a/core/modules/parsers/wikiparser/rules/block/rule.js b/core/modules/parsers/wikiparser/rules/block/rule.js index 00fe3254e..49a2a07c6 100644 --- a/core/modules/parsers/wikiparser/rules/block/rule.js +++ b/core/modules/parsers/wikiparser/rules/block/rule.js @@ -1,7 +1,7 @@ /*\ title: $:/core/modules/parsers/wikiparser/rules/block/rule.js type: application/javascript -module-type: wikiblockrule +module-type: wiki-block-rule Wiki text block rule for rules. For example: diff --git a/core/modules/parsers/wikiparser/rules/block/table.js b/core/modules/parsers/wikiparser/rules/block/table.js index f96aceda5..f7571f3c6 100644 --- a/core/modules/parsers/wikiparser/rules/block/table.js +++ b/core/modules/parsers/wikiparser/rules/block/table.js @@ -1,7 +1,7 @@ /*\ title: $:/core/modules/parsers/wikiparser/rules/block/table.js type: application/javascript -module-type: wikiblockrule +module-type: wiki-block-rule Wiki text block rule for tables. @@ -86,7 +86,7 @@ var processRow = function(prevColumns) { colSpanCount = 1; } // Parse the cell - cell.children = this.parser.parseRun(cellTermRegExp,{eatTerminator: true}); + cell.children = this.parser.parseInlineRun(cellTermRegExp,{eatTerminator: true}); // Set the alignment for the cell if(cellMatch[1].substr(cellMatch[1].length-1,1) === " ") { // spaceRight $tw.utils.addAttributeToParseTreeNode(cell,"align",spaceLeft ? "center" : "left"); @@ -140,7 +140,7 @@ exports.parse = function() { // Set the alignment - TODO: figure out why TW did this // rowContainer.attributes.align = rowCount === 0 ? "top" : "bottom"; // Parse the caption - rowContainer.children = this.parser.parseRun(rowTermRegExp,{eatTerminator: true}); + rowContainer.children = this.parser.parseInlineRun(rowTermRegExp,{eatTerminator: true}); } else { // Create the row var theRow = {type: "element", tag: "tr", children: []}; diff --git a/core/modules/parsers/wikiparser/rules/block/transcludeblock.js b/core/modules/parsers/wikiparser/rules/block/transcludeblock.js index db1ecc9c7..e7bd0c9da 100644 --- a/core/modules/parsers/wikiparser/rules/block/transcludeblock.js +++ b/core/modules/parsers/wikiparser/rules/block/transcludeblock.js @@ -1,7 +1,7 @@ /*\ title: $:/core/modules/parsers/wikiparser/rules/block/transcludeblock.js type: application/javascript -module-type: wikiblockrule +module-type: wiki-block-rule Wiki text rule for block-level transclusion. For example: diff --git a/core/modules/parsers/wikiparser/rules/inline/classinline.js b/core/modules/parsers/wikiparser/rules/inline/classinline.js index 0151a407f..d0ca2c381 100644 --- a/core/modules/parsers/wikiparser/rules/inline/classinline.js +++ b/core/modules/parsers/wikiparser/rules/inline/classinline.js @@ -1,9 +1,9 @@ /*\ -title: $:/core/modules/parsers/wikiparser/rules/run/classrun.js +title: $:/core/modules/parsers/wikiparser/rules/inline/classinline.js type: application/javascript -module-type: wikirunrule +module-type: wiki-inline-rule -Wiki text run rule for assigning classes to runs of text. For example: +Wiki text inline rule for assigning classes to runs of text. For example: {{{ {{myClass{This text will have the CSS class `myClass`. @@ -21,7 +21,7 @@ List item 2}}} /*global $tw: false */ "use strict"; -exports.name = "classrun"; +exports.name = "classinline"; exports.init = function(parser) { this.parser = parser; @@ -36,7 +36,7 @@ exports.parse = function() { // Move past the match this.parser.pos = this.matchRegExp.lastIndex; // Parse the run up to the terminator - var tree = this.parser.parseRun(reEnd,{eatTerminator: true}); + var tree = this.parser.parseInlineRun(reEnd,{eatTerminator: true}); // Return the classed span return [{ type: "element", diff --git a/core/modules/parsers/wikiparser/rules/inline/codeinline.js b/core/modules/parsers/wikiparser/rules/inline/codeinline.js index 513178ee4..caebae628 100644 --- a/core/modules/parsers/wikiparser/rules/inline/codeinline.js +++ b/core/modules/parsers/wikiparser/rules/inline/codeinline.js @@ -1,9 +1,9 @@ /*\ -title: $:/core/modules/parsers/wikiparser/rules/run/coderun.js +title: $:/core/modules/parsers/wikiparser/rules/inline/codeinline.js type: application/javascript -module-type: wikirunrule +module-type: wiki-inline-rule -Wiki text run rule for code runs. For example: +Wiki text inline rule for code runs. For example: {{{ This is a {{{code run}}} and `so is this`. @@ -16,7 +16,7 @@ Wiki text run rule for code runs. For example: /*global $tw: false */ "use strict"; -exports.name = "coderun"; +exports.name = "codeinline"; exports.init = function(parser) { this.parser = parser; diff --git a/core/modules/parsers/wikiparser/rules/inline/comment.js b/core/modules/parsers/wikiparser/rules/inline/comment.js index 5eae8a3cc..0ff9227a9 100644 --- a/core/modules/parsers/wikiparser/rules/inline/comment.js +++ b/core/modules/parsers/wikiparser/rules/inline/comment.js @@ -1,9 +1,9 @@ /*\ -title: $:/core/modules/parsers/wikiparser/rules/run/comment.js +title: $:/core/modules/parsers/wikiparser/rules/inline/comment.js type: application/javascript -module-type: wikirunrule +module-type: wiki-inline-rule -Wiki text run rule for HTML comments. For example: +Wiki text inline rule for HTML comments. For example: {{{ diff --git a/core/modules/parsers/wikiparser/rules/inline/dash.js b/core/modules/parsers/wikiparser/rules/inline/dash.js index a51af47de..8bdfed420 100644 --- a/core/modules/parsers/wikiparser/rules/inline/dash.js +++ b/core/modules/parsers/wikiparser/rules/inline/dash.js @@ -1,9 +1,9 @@ /*\ -title: $:/core/modules/parsers/wikiparser/rules/run/dash.js +title: $:/core/modules/parsers/wikiparser/rules/inline/dash.js type: application/javascript -module-type: wikirunrule +module-type: wiki-inline-rule -Wiki text run rule for dashes. For example: +Wiki text inline rule for dashes. For example: {{{ This is an en-dash: -- diff --git a/core/modules/parsers/wikiparser/rules/inline/emphasis.js b/core/modules/parsers/wikiparser/rules/inline/emphasis.js index 939473a7f..4cdf1d4ae 100644 --- a/core/modules/parsers/wikiparser/rules/inline/emphasis.js +++ b/core/modules/parsers/wikiparser/rules/inline/emphasis.js @@ -1,9 +1,9 @@ /*\ -title: $:/core/modules/parsers/wikiparser/rules/run/emphasis.js +title: $:/core/modules/parsers/wikiparser/rules/inline/emphasis.js type: application/javascript -module-type: wikirunrule +module-type: wiki-inline-rule -Wiki text run rule for emphasis. For example: +Wiki text inline rule for emphasis. For example: {{{ This is ''bold'' text @@ -66,7 +66,7 @@ exports.parse = function() { break; } // Parse the run including the terminator - var tree = this.parser.parseRun(reEnd,{eatTerminator: true}); + var tree = this.parser.parseInlineRun(reEnd,{eatTerminator: true}); // Return the classed span return [{ type: "element", diff --git a/core/modules/parsers/wikiparser/rules/inline/entity.js b/core/modules/parsers/wikiparser/rules/inline/entity.js index fb2881c53..babe38b6a 100644 --- a/core/modules/parsers/wikiparser/rules/inline/entity.js +++ b/core/modules/parsers/wikiparser/rules/inline/entity.js @@ -1,9 +1,9 @@ /*\ -title: $:/core/modules/parsers/wikiparser/rules/run/entity.js +title: $:/core/modules/parsers/wikiparser/rules/inline/entity.js type: application/javascript -module-type: wikirunrule +module-type: wiki-inline-rule -Wiki text run rule for HTML entities. For example: +Wiki text inline rule for HTML entities. For example: {{{ This is a copyright symbol: © diff --git a/core/modules/parsers/wikiparser/rules/inline/extlink.js b/core/modules/parsers/wikiparser/rules/inline/extlink.js index dea22f79f..4e7c687a2 100644 --- a/core/modules/parsers/wikiparser/rules/inline/extlink.js +++ b/core/modules/parsers/wikiparser/rules/inline/extlink.js @@ -1,9 +1,9 @@ /*\ -title: $:/core/modules/parsers/wikiparser/rules/run/extlink.js +title: $:/core/modules/parsers/wikiparser/rules/inline/extlink.js type: application/javascript -module-type: wikirunrule +module-type: wiki-inline-rule -Wiki text run rule for external links. For example: +Wiki text inline rule for external links. For example: {{{ An external link: http://www.tiddlywiki.com/ diff --git a/core/modules/parsers/wikiparser/rules/inline/html.js b/core/modules/parsers/wikiparser/rules/inline/html.js index 2e794299c..00cbee77d 100644 --- a/core/modules/parsers/wikiparser/rules/inline/html.js +++ b/core/modules/parsers/wikiparser/rules/inline/html.js @@ -1,7 +1,7 @@ /*\ -title: $:/core/modules/parsers/wikiparser/rules/run/html.js +title: $:/core/modules/parsers/wikiparser/rules/inline/html.js type: application/javascript -module-type: wikirunrule +module-type: wiki-inline-rule Wiki rule for HTML elements and widgets. For example: @@ -83,7 +83,7 @@ exports.parse = function() { if(isBlock) { content = this.parser.parseBlocks(reEndString); } else { - content = this.parser.parseRun(reEnd); + content = this.parser.parseInlineRun(reEnd); } reEnd.lastIndex = this.parser.pos; var endMatch = reEnd.exec(this.parser.source); diff --git a/core/modules/parsers/wikiparser/rules/inline/macrocall.js b/core/modules/parsers/wikiparser/rules/inline/macrocall.js index b8fc89142..986153a50 100644 --- a/core/modules/parsers/wikiparser/rules/inline/macrocall.js +++ b/core/modules/parsers/wikiparser/rules/inline/macrocall.js @@ -1,7 +1,7 @@ /*\ -title: $:/core/modules/parsers/wikiparser/rules/run/macrocall.js +title: $:/core/modules/parsers/wikiparser/rules/inline/macrocall.js type: application/javascript -module-type: wikirunrule +module-type: wiki-inline-rule Wiki rule for macro calls diff --git a/core/modules/parsers/wikiparser/rules/inline/prettylink.js b/core/modules/parsers/wikiparser/rules/inline/prettylink.js index 0fae9a5d3..d17d841b2 100644 --- a/core/modules/parsers/wikiparser/rules/inline/prettylink.js +++ b/core/modules/parsers/wikiparser/rules/inline/prettylink.js @@ -1,9 +1,9 @@ /*\ -title: $:/core/modules/parsers/wikiparser/rules/run/prettylink.js +title: $:/core/modules/parsers/wikiparser/rules/inline/prettylink.js type: application/javascript -module-type: wikirunrule +module-type: wiki-inline-rule -Wiki text run rule for pretty links. For example: +Wiki text inline rule for pretty links. For example: {{{ [[Introduction]] diff --git a/core/modules/parsers/wikiparser/rules/inline/wikilink.js b/core/modules/parsers/wikiparser/rules/inline/wikilink.js index 5d5e7aeae..225959fcd 100644 --- a/core/modules/parsers/wikiparser/rules/inline/wikilink.js +++ b/core/modules/parsers/wikiparser/rules/inline/wikilink.js @@ -1,9 +1,9 @@ /*\ -title: $:/core/modules/parsers/wikiparser/rules/run/wikilink.js +title: $:/core/modules/parsers/wikiparser/rules/inline/wikilink.js type: application/javascript -module-type: wikirunrule +module-type: wiki-inline-rule -Wiki text run rule for wiki links. For example: +Wiki text inline rule for wiki links. For example: {{{ AWikiLink diff --git a/core/modules/parsers/wikiparser/rules/pragma/macrodef.js b/core/modules/parsers/wikiparser/rules/pragma/macrodef.js index 769882c3b..b9b35dc77 100644 --- a/core/modules/parsers/wikiparser/rules/pragma/macrodef.js +++ b/core/modules/parsers/wikiparser/rules/pragma/macrodef.js @@ -1,7 +1,7 @@ /*\ title: $:/core/modules/parsers/wikiparser/rules/pragma/macrodef.js type: application/javascript -module-type: wikipragmarule +module-type: wiki-pragma-rule Wiki pragma rule for macro definitions diff --git a/core/modules/parsers/wikiparser/wikiparser.js b/core/modules/parsers/wikiparser/wikiparser.js index 84f879655..412cd5c8c 100644 --- a/core/modules/parsers/wikiparser/wikiparser.js +++ b/core/modules/parsers/wikiparser/wikiparser.js @@ -41,12 +41,12 @@ var WikiParser = function(vocabulary,type,text,options) { this.pragmaRules = this.instantiateRules(this.vocabulary.pragmaRuleClasses,0); // Parse any pragmas this.parsePragmas(); - // Instantiate the parser block and run rules + // Instantiate the parser block and inline rules this.blockRules = this.instantiateRules(this.vocabulary.blockRuleClasses,this.pos); - this.runRules = this.instantiateRules(this.vocabulary.runRuleClasses,this.pos); - // Parse the text into runs or blocks + this.inlineRules = this.instantiateRules(this.vocabulary.inlineRuleClasses,this.pos); + // Parse the text into inline runs or blocks if(this.type === "text/vnd.tiddlywiki-run") { - this.tree = this.parseRun(); + this.tree = this.parseInlineRun(); } else { this.tree = this.parseBlocks(); } @@ -148,7 +148,7 @@ WikiParser.prototype.parseBlock = function(terminatorRegExpString) { return nextMatch.rule.parse(); } // Treat it as a paragraph if we didn't find a block rule - return [{type: "element", tag: "p", children: this.parseRun(terminatorRegExp)}]; + return [{type: "element", tag: "p", children: this.parseInlineRun(terminatorRegExp)}]; }; /* @@ -208,15 +208,15 @@ Parse a run of text at the current position Options available: eatTerminator: move the parse position past any encountered terminator (default false) */ -WikiParser.prototype.parseRun = function(terminatorRegExp,options) { +WikiParser.prototype.parseInlineRun = function(terminatorRegExp,options) { if(terminatorRegExp) { - return this.parseRunTerminated(terminatorRegExp,options); + return this.parseInlineRunTerminated(terminatorRegExp,options); } else { - return this.parseRunUnterminated(options); + return this.parseInlineRunUnterminated(options); } }; -WikiParser.prototype.parseRunUnterminated = function(options) { +WikiParser.prototype.parseInlineRunUnterminated = function(options) { var tree = []; // Find the next occurrence of a runrule var nextMatch = this.findNextMatch(this.runRules,this.pos); @@ -240,19 +240,19 @@ WikiParser.prototype.parseRunUnterminated = function(options) { return tree; }; -WikiParser.prototype.parseRunTerminated = function(terminatorRegExp,options) { +WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,options) { options = options || {}; var tree = []; // Find the next occurrence of the terminator terminatorRegExp.lastIndex = this.pos; var terminatorMatch = terminatorRegExp.exec(this.source); - // Find the next occurrence of a runrule - var runRuleMatch = this.findNextMatch(this.runRules,this.pos); + // Find the next occurrence of a inlinerule + var inlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos); // Loop around until we've reached the end of the text - while(this.pos < this.sourceLength && (terminatorMatch || runRuleMatch)) { - // Return if we've found the terminator, and it precedes any run rule match + while(this.pos < this.sourceLength && (terminatorMatch || inlineRuleMatch)) { + // Return if we've found the terminator, and it precedes any inline rule match if(terminatorMatch) { - if(!runRuleMatch || runRuleMatch.matchIndex >= terminatorMatch.index) { + if(!inlineRuleMatch || inlineRuleMatch.matchIndex >= terminatorMatch.index) { if(terminatorMatch.index > this.pos) { tree.push({type: "text", text: this.source.substring(this.pos,terminatorMatch.index)}); } @@ -263,17 +263,17 @@ WikiParser.prototype.parseRunTerminated = function(terminatorRegExp,options) { return tree; } } - // Process any run rule, along with the text preceding it - if(runRuleMatch) { + // Process any inline rule, along with the text preceding it + if(inlineRuleMatch) { // Preceding text - if(runRuleMatch.matchIndex > this.pos) { - tree.push({type: "text", text: this.source.substring(this.pos,runRuleMatch.matchIndex)}); - this.pos = runRuleMatch.matchIndex; + if(inlineRuleMatch.matchIndex > this.pos) { + tree.push({type: "text", text: this.source.substring(this.pos,inlineRuleMatch.matchIndex)}); + this.pos = inlineRuleMatch.matchIndex; } - // Process the run rule - tree.push.apply(tree,runRuleMatch.rule.parse()); - // Look for the next run rule - runRuleMatch = this.findNextMatch(this.runRules,this.pos); + // Process the inline rule + tree.push.apply(tree,inlineRuleMatch.rule.parse()); + // Look for the next inline rule + inlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos); // Look for the next terminator match terminatorRegExp.lastIndex = this.pos; terminatorMatch = terminatorRegExp.exec(this.source); diff --git a/core/modules/wikivocabulary.js b/core/modules/wikivocabulary.js index db5780ff8..f69f3232d 100644 --- a/core/modules/wikivocabulary.js +++ b/core/modules/wikivocabulary.js @@ -13,9 +13,9 @@ module-type: global var WikiVocabulary = function(options) { this.wiki = options.wiki; // Hashmaps of the various parse rule classes - this.pragmaRuleClasses = $tw.modules.createClassesFromModules("wikipragmarule",$tw.WikiRuleBase); - this.blockRuleClasses = $tw.modules.createClassesFromModules("wikiblockrule",$tw.WikiRuleBase); - this.runRuleClasses = $tw.modules.createClassesFromModules("wikirunrule",$tw.WikiRuleBase); + this.pragmaRuleClasses = $tw.modules.createClassesFromModules("wiki-pragma-rule",$tw.WikiRuleBase); + this.blockRuleClasses = $tw.modules.createClassesFromModules("wiki-block-rule",$tw.WikiRuleBase); + this.inlineRuleClasses = $tw.modules.createClassesFromModules("wiki-inline-rule",$tw.WikiRuleBase); // Hashmap of the various renderer classes this.rendererClasses = $tw.modules.applyMethods("wikirenderer"); // Hashmap of the available widgets