diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-11-09 20:29:43 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-11-09 20:29:43 -0800 |
commit | 4a4b050a54382f15b9e62c2deb1111bd9d20b663 (patch) | |
tree | 89e5ed9149af42fc70aa336d2fc75909aae951ce /js/lib | |
parent | 9a9a15312c443e4a4744023c196d57fbe40f8a05 (diff) |
Changed parseEmphasis to just put things on stack.
Diffstat (limited to 'js/lib')
-rw-r--r-- | js/lib/inlines.js | 39 |
1 files changed, 21 insertions, 18 deletions
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. |