From be52fbb5d108156d977261a7fe7e2ada6cd25c2e Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 8 Dec 2011 13:04:12 +0000 Subject: [PATCH] Fixed problem with custom CSS classes --- js/WikiTextRules.js | 7 +++---- test/wikitests/SecondTiddler.html | 2 +- test/wikitests/SecondTiddler.tid | 2 +- test/wikitests/SecondTiddler.txt | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/js/WikiTextRules.js b/js/WikiTextRules.js index b9cef02ba..8dc973e0b 100755 --- a/js/WikiTextRules.js +++ b/js/WikiTextRules.js @@ -636,7 +636,7 @@ WikiTextRules.rules = [ w.output.push(e); var styles = WikiTextRules.inlineCssHelper(w); if(styles.length === 0) - e.className = "marked"; + WikiTextRules.setAttr(e,"className","marked"); else WikiTextRules.applyCssHelper(e,styles); w.subWikifyTerm(e.children,/(@@)/mg); @@ -647,9 +647,8 @@ WikiTextRules.rules = [ var lookaheadMatch = lookaheadRegExp.exec(w.source); if(lookaheadMatch) { w.nextMatch = lookaheadRegExp.lastIndex; - e = {type: lookaheadMatch[2] == "\n" ? "div" : "span", children: [ - {type: "text", value: lookaheadMatch[1]} - ]}; + e = {type: lookaheadMatch[2] == "\n" ? "div" : "span", children: []}; + WikiTextRules.setAttr(e,"className",lookaheadMatch[1]); w.output.push(e); w.subWikifyTerm(e.children,/(\}\}\})/mg); } diff --git a/test/wikitests/SecondTiddler.html b/test/wikitests/SecondTiddler.html index 190ecc38c..a8e16cbed 100644 --- a/test/wikitests/SecondTiddler.html +++ b/test/wikitests/SecondTiddler.html @@ -1 +1 @@ -

Heading

This is the second tiddler. It has a list:
And a
\ No newline at end of file +

Heading

This is the second tiddler. It has a list:
And a and a custom class
\ No newline at end of file diff --git a/test/wikitests/SecondTiddler.tid b/test/wikitests/SecondTiddler.tid index eaf111be7..ea4c4e246 100644 --- a/test/wikitests/SecondTiddler.tid +++ b/test/wikitests/SecondTiddler.tid @@ -5,4 +5,4 @@ This is the second tiddler. It has a list: * Item one * Item two * Item three -And a <> +And a <> and a {{myClass{custom class}}} diff --git a/test/wikitests/SecondTiddler.txt b/test/wikitests/SecondTiddler.txt index 5091ce3da..95c66dcdc 100644 --- a/test/wikitests/SecondTiddler.txt +++ b/test/wikitests/SecondTiddler.txt @@ -1 +1 @@ -HeadingThis is the second tiddler. It has a list: Item one Item two Item threeAnd a \ No newline at end of file +HeadingThis is the second tiddler. It has a list: Item one Item two Item threeAnd a and a custom class \ No newline at end of file