From 4a4b050a54382f15b9e62c2deb1111bd9d20b663 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 9 Nov 2014 20:29:43 -0800 Subject: Changed parseEmphasis to just put things on stack. --- js/lib/inlines.js | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'js') diff --git a/js/lib/inlines.js b/js/lib/inlines.js index 4f1f16a..76f3936 100644 --- a/js/lib/inlines.js +++ b/js/lib/inlines.js @@ -261,17 +261,35 @@ var Str = function(s) { // Attempt to parse emphasis or strong emphasis. var parseEmphasis = function(cc,inlines) { - var startpos = this.pos; var res = this.scanDelims(cc); var numdelims = res.numdelims; - var usedelims; + var startpos = this.pos; if (numdelims === 0) { this.pos = startpos; return false; } + this.pos += numdelims; + inlines.push(Str(this.subject.slice(startpos, this.pos))); + + // Add entry to stack for this opener + this.emphasis_openers = { cc: cc, + numdelims: numdelims, + pos: inlines.length - 1, + previous: this.emphasis_openers, + next: null, + can_open: res.can_open, + can_close: res.can_close}; + + return true; + +}; + +/* TODO + var numdelims = res.numdelims; + var usedelims; if (res.can_close) { // Walk the stack and find a matching opener, if possible @@ -318,22 +336,7 @@ var parseEmphasis = function(cc,inlines) { } // If we're here, we didn't match a closer. - - this.pos += numdelims; - inlines.push(Str(this.subject.slice(startpos, startpos + numdelims))); - - if (res.can_open) { - - // Add entry to stack for this opener - this.emphasis_openers = { cc: cc, - numdelims: numdelims, - pos: inlines.length - 1, - previous: this.emphasis_openers }; - } - - return true; - -}; +*/ // Attempt to parse link title (sans quotes), returning the string // or null if no match. -- cgit v1.2.3