summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-09-08 09:08:19 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-09-11 11:17:40 -0700
commitf9b9ed96c5e34a1a7224c6df825f52ef2ce2e368 (patch)
tree5918de73ed6f4350f533a6dd379941634e27c517
parent0a345c93475fab82d7cd49ed84450a882bab4b14 (diff)
Did parseEntity.
-rwxr-xr-xjs/stmd.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/js/stmd.js b/js/stmd.js
index 524e99f..394ad06 100755
--- a/js/stmd.js
+++ b/js/stmd.js
@@ -517,14 +517,13 @@ var parseLink = function(inlines) {
return 0;
};
-// Attempt to parse an entity, adding to inlines if successful.
-var parseEntity = function(inlines) {
+// Attempt to parse an entity, return Entity object if successful.
+var parseEntity = function() {
var m;
if ((m = this.match(/^&(?:#x[a-f0-9]{1,8}|#[0-9]{1,8}|[a-z][a-z0-9]{1,31});/i))) {
- inlines.push({ t: 'Entity', c: m });
- return m.length;
+ return { t: 'Entity', c: m };
} else {
- return 0;
+ return null;
}
};
@@ -672,7 +671,7 @@ var parseInline = function() {
this.parseHtmlTag(inlines);
break;
case '&':
- res = this.parseEntity(inlines);
+ res = this.parseEntity();
break;
default:
res = this.parseString();