From c3c5334795a41763ab80d3e141f7b47d4d9cd214 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sun, 15 Jan 2012 11:41:54 +0000 Subject: [PATCH] Fixed minor problem with backtick formatting It's confusing if it behaves differently that the existing tripe-curly-brace format --- js/WikiTextRules.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/js/WikiTextRules.js b/js/WikiTextRules.js index 621ad7be47..5f770e7653 100755 --- a/js/WikiTextRules.js +++ b/js/WikiTextRules.js @@ -624,9 +624,15 @@ var rules = [ w.subWikifyTerm(e.children,/(--)/mg); break; case "`": - e = {type: "code", children: []}; - w.output.push(e); - w.subWikifyTerm(e.children,/(`)/mg); + var lookaheadRegExp = /`((?:.|\n)*?)`/mg; + lookaheadRegExp.lastIndex = w.matchStart; + var lookaheadMatch = lookaheadRegExp.exec(w.source); + if(lookaheadMatch && lookaheadMatch.index == w.matchStart) { + w.output.push({type: "code", children: [ + {type: "text", value: lookaheadMatch[1]} + ]}); + w.nextMatch = lookaheadRegExp.lastIndex; + } break; case "{{{": var lookaheadRegExp = /\{\{\{((?:.|\n)*?)\}\}\}/mg;