cmark

My personal build of CMark ✏️

Commit
74f88deac274a3138af13daa76e265cfb93fd509
Parent
732bb492959c4d1008c7f8bf5b26d9c45c3f6a95
Author
John MacFarlane <jgm@berkeley.edu>
Date

Reordered some definitions, so regex is defined before being used.

Diffstat

1 file changed, 29 insertions, 27 deletions

Status File Name N° Changes Insertions Deletions
Modified js/lib/blocks.js 56 29 27
diff --git a/js/lib/blocks.js b/js/lib/blocks.js
@@ -5,8 +5,36 @@ var C_SPACE = 32;
 var C_OPEN_BRACKET = 91;
 
 var InlineParser = require('./inlines');
+
 var unescapeString = new InlineParser().unescapeString;
 
+var BLOCKTAGNAME = '(?:article|header|aside|hgroup|iframe|blockquote|hr|body|li|map|button|object|canvas|ol|caption|output|col|p|colgroup|pre|dd|progress|div|section|dl|table|td|dt|tbody|embed|textarea|fieldset|tfoot|figcaption|th|figure|thead|footer|footer|tr|form|ul|h1|h2|h3|h4|h5|h6|video|script|style)';
+
+var HTMLBLOCKOPEN = "<(?:" + BLOCKTAGNAME + "[\\s/>]" + "|" +
+        "/" + BLOCKTAGNAME + "[\\s>]" + "|" + "[?!])";
+
+var reHtmlBlockOpen = new RegExp('^' + HTMLBLOCKOPEN, 'i');
+
+var reHrule = /^(?:(?:\* *){3,}|(?:_ *){3,}|(?:- *){3,}) *$/;
+
+var reMaybeSpecial = /^[ #`~*+_=<>0-9-]/;
+
+var reNonSpace = /[^ \t\n]/;
+
+var reBulletListMarker = /^[*+-]( +|$)/;
+
+var reOrderedListMarker = /^(\d+)([.)])( +|$)/;
+
+var reATXHeaderMarker = /^#{1,6}(?: +|$)/;
+
+var reCodeFence = /^`{3,}(?!.*`)|^~{3,}(?!.*~)/;
+
+var reClosingCodeFence = /^(?:`{3,}|~{3,})(?= *$)/;
+
+var reSetextHeaderLine = /^(?:=+|-+) *$/;
+
+var reLineEnding = /\r\n|\n|\r/;
+
 // Returns true if string contains only space characters.
 var isBlank = function(s) {
     "use strict";
@@ -44,35 +72,9 @@ var matchAt = function(re, s, offset) {
     }
 };
 
-var BLOCKTAGNAME = '(?:article|header|aside|hgroup|iframe|blockquote|hr|body|li|map|button|object|canvas|ol|caption|output|col|p|colgroup|pre|dd|progress|div|section|dl|table|td|dt|tbody|embed|textarea|fieldset|tfoot|figcaption|th|figure|thead|footer|footer|tr|form|ul|h1|h2|h3|h4|h5|h6|video|script|style)';
-var HTMLBLOCKOPEN = "<(?:" + BLOCKTAGNAME + "[\\s/>]" + "|" +
-        "/" + BLOCKTAGNAME + "[\\s>]" + "|" + "[?!])";
-var reHtmlBlockOpen = new RegExp('^' + HTMLBLOCKOPEN, 'i');
-
-var reHrule = /^(?:(?:\* *){3,}|(?:_ *){3,}|(?:- *){3,}) *$/;
-
-var reMaybeSpecial = /^[ #`~*+_=<>0-9-]/;
-
-var reNonSpace = /[^ \t\n]/;
-
-var reBulletListMarker = /^[*+-]( +|$)/;
-
-var reOrderedListMarker = /^(\d+)([.)])( +|$)/;
-
-var reATXHeaderMarker = /^#{1,6}(?: +|$)/;
-
-var reCodeFence = /^`{3,}(?!.*`)|^~{3,}(?!.*~)/;
-
-var reClosingCodeFence = /^(?:`{3,}|~{3,})(?= *$)/;
-
-var reSetextHeaderLine = /^(?:=+|-+) *$/;
-
-var reFinalNewlines = /(?:\n *)+$/;
-
-var reLineEnding = /\r\n|\n|\r/;
-
 // destructively trip final blank lines in an array of strings
 var stripFinalBlankLines = function(lns) {
+    "use strict";
     var i = lns.length - 1;
     while (!reNonSpace.test(lns[i])) {
         lns.pop();