diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-09-26 10:45:51 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-09-26 10:45:51 -0700 |
commit | de2a35a4dcb3b051df328ec2c204f08c77a5ad3d (patch) | |
tree | abbb1016a8fbe11f5bf7041e096ef5a69e502127 /js | |
parent | 7f4b2f7f3949f807d5dafe2219280a0f1419b0e2 (diff) |
Simple fallback if we don't match emphasis.
The other approach led to wrong results on:
*hi _there*
Diffstat (limited to 'js')
-rwxr-xr-x | js/stmd.js | 31 |
1 files changed, 6 insertions, 25 deletions
@@ -302,6 +302,9 @@ this.pos += numdelims; + var fallbackpos = this.pos; + var fallback = Str(this.subject.slice(startpos, fallbackpos)); + var next_inline; var first = []; var second = []; @@ -453,31 +456,9 @@ } - switch (state) { - case 1: // ***a - return [Str(c+c+c)].concat(first); - case 2: // **a - return [Str(c+c)].concat(first); - case 3: // *a - return [Str(c)].concat(first); - case 4: // ***a**b - case 6: // ***a** b - return [Str(c+c+c)] - .concat(first, [Str(c+c)], second); - case 5: // ***a*b - case 7: // ***a* b - return [Str(c+c+c)] - .concat(first, [Str(c)], second); - case 8: // **a *b - return [Str(c+c)] - .concat(first, [Str(c)], second); - case 9: // *a **b - return [Str(c)] - .concat(first, [Str(c+c)], second); - default: - console.log("Unknown state, parseEmphasis"); - // shouldn't happen - } + // we didn't match emphasis: fallback + this.pos = fallbackpos; + return [fallback]; }; |