From f9de55ad5f90b2c8ea30c780301af91aa4b29374 Mon Sep 17 00:00:00 2001 From: Stephan Hradek Date: Wed, 25 Dec 2013 23:06:42 +0100 Subject: [PATCH] added fix for issue #94 for horizontal rules, tables and typed block --- core/modules/parsers/wikiparser/rules/horizrule.js | 2 +- core/modules/parsers/wikiparser/rules/table.js | 8 ++++---- core/modules/parsers/wikiparser/rules/typedblock.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/modules/parsers/wikiparser/rules/horizrule.js b/core/modules/parsers/wikiparser/rules/horizrule.js index 9d431b600..bacad06ed 100644 --- a/core/modules/parsers/wikiparser/rules/horizrule.js +++ b/core/modules/parsers/wikiparser/rules/horizrule.js @@ -22,7 +22,7 @@ exports.types = {block: true}; exports.init = function(parser) { this.parser = parser; // Regexp to match - this.matchRegExp = /-{3,}\r?\n/mg; + this.matchRegExp = /-{3,}\r?(?:\n|$)/mg; }; exports.parse = function() { diff --git a/core/modules/parsers/wikiparser/rules/table.js b/core/modules/parsers/wikiparser/rules/table.js index 16f75736c..71e3f6d00 100644 --- a/core/modules/parsers/wikiparser/rules/table.js +++ b/core/modules/parsers/wikiparser/rules/table.js @@ -18,11 +18,11 @@ exports.types = {block: true}; exports.init = function(parser) { this.parser = parser; // Regexp to match - this.matchRegExp = /^\|(?:[^\n]*)\|(?:[fhck]?)\r?\n/mg; + this.matchRegExp = /^\|(?:[^\n]*)\|(?:[fhck]?)\r?(?:\n|$)/mg; }; var processRow = function(prevColumns) { - var cellRegExp = /(?:\|([^\n\|]*)\|)|(\|[fhck]?\r?\n)/mg, + var cellRegExp = /(?:\|([^\n\|]*)\|)|(\|[fhck]?\r?(?:\n|$))/mg, cellTermRegExp = /((?:\x20*)\|)/mg, tree = [], col = 0, @@ -107,8 +107,8 @@ var processRow = function(prevColumns) { exports.parse = function() { var rowContainerTypes = {"c":"caption", "h":"thead", "":"tbody", "f":"tfoot"}, table = {type: "element", tag: "table", children: []}, - rowRegExp = /^\|([^\n]*)\|([fhck]?)\r?\n/mg, - rowTermRegExp = /(\|(?:[fhck]?)\r?\n)/mg, + rowRegExp = /^\|([^\n]*)\|([fhck]?)\r?(?:\n|$)/mg, + rowTermRegExp = /(\|(?:[fhck]?)\r?(?:\n|$))/mg, prevColumns = [], currRowType, rowContainer, diff --git a/core/modules/parsers/wikiparser/rules/typedblock.js b/core/modules/parsers/wikiparser/rules/typedblock.js index 5564d49a9..c332441df 100644 --- a/core/modules/parsers/wikiparser/rules/typedblock.js +++ b/core/modules/parsers/wikiparser/rules/typedblock.js @@ -40,7 +40,7 @@ exports.init = function(parser) { }; exports.parse = function() { - var reEnd = /\r?\n\$\$\$\r?\n/mg; + var reEnd = /\r?\n\$\$\$\r?(?:\n|$)/mg; // Save the type var parseType = this.match[1], renderType = this.match[2];