aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-09-08 08:21:59 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-09-11 11:17:40 -0700
commit56f6b364c40563102779a84d1a1595226e1f1ccc (patch)
tree61bcb4ad35a53b995c7185a4fa27b765f7fae14f
parent0e9674cbe56810b4c15386b1fc091777e9c7026b (diff)
Finished parseEmphasis.
This seems to work properly. We now get proper results for `***hi**`.
-rwxr-xr-xjs/stmd.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/js/stmd.js b/js/stmd.js
index 753eff8..d04fd04 100755
--- a/js/stmd.js
+++ b/js/stmd.js
@@ -324,21 +324,24 @@ var parseEmphasis = function() {
break;
case 3: // We started with *** or ___
+ var first_delim = 0;
while (true) {
res = this.scanDelims(c);
var numdelims = res.numdelims;
var can_close = res.can_close;
- var first_delim === 0;
+ this.pos += numdelims;
if (can_close && numdelims === 3 && first_delim === 0) {
- // TODO - return Strong Emph with inlines
+ return {t: 'Strong', c: [{t: 'Emph', c: inlines}]};
} else if (can_close && numdelims === 2 && first_delim === 0) {
- // TODO - set first_delim, make inlines a Strong
+ first_delim = 2;
+ inlines = [{t: 'Strong', c: inlines}];
} else if (can_close && numdelims === 1 && first_delim === 0) {
- // TODO - set first_delim, make inlines an Emph
+ first_delim = 1;
+ inlines = [{t: 'Emph', c: inlines}];
} else if (can_close && numdelims === 2 && first_delim === 1) {
- // TODO - return Strong inlines
+ return {t: 'Strong', c: inlines};
} else if (can_close && numdelims === 1 && first_delim === 2) {
- // TODO - return Emph inlines
+ return {t: 'Emph', c: inlines};
} else if (next_inline = this.parseInline(inlines)) {
inlines.push(next_inline);
} else {