Przeglądaj źródła

Realign continuation lines in the markdown engine to even columns

Keeps the 2-space indent convention used across statum.js; no behaviour change (regressions 51/51, spec 567/588).
saddle-Clanker-Saddle 1 miesiąc temu
rodzic
commit
711e4c61c3
1 zmienionych plików z 16 dodań i 16 usunięć
  1. 16 16
      js/statum.js

+ 16 - 16
js/statum.js

@@ -1906,14 +1906,14 @@
   function mdParseListMarker(p, container) {
   function mdParseListMarker(p, container) {
     var rest = p.currentLine.slice(p.nextNonspace);
     var rest = p.currentLine.slice(p.nextNonspace);
     var data = { type: null, tight: true, bulletChar: null, start: null,
     var data = { type: null, tight: true, bulletChar: null, start: null,
-                 delimiter: null, padding: null, markerOffset: p.indent };
+                delimiter: null, padding: null, markerOffset: p.indent };
     var m, nextc;
     var m, nextc;
     if (p.indent >= 4) return null;
     if (p.indent >= 4) return null;
     if ((m = rest.match(MD_BULLET_RE))) {
     if ((m = rest.match(MD_BULLET_RE))) {
       data.type = 'bullet';
       data.type = 'bullet';
       data.bulletChar = m[0].charAt(0);
       data.bulletChar = m[0].charAt(0);
     } else if ((m = rest.match(MD_ORDERED_RE)) &&
     } else if ((m = rest.match(MD_ORDERED_RE)) &&
-               (container.type !== 'paragraph' || Number(m[1]) === 1)) {
+              (container.type !== 'paragraph' || Number(m[1]) === 1)) {
       data.type = 'ordered';
       data.type = 'ordered';
       data.start = parseInt(m[1], 10);
       data.start = parseInt(m[1], 10);
       data.delimiter = m[2];
       data.delimiter = m[2];
@@ -1949,7 +1949,7 @@
 
 
   function mdListsMatch(a, b) {
   function mdListsMatch(a, b) {
     return a.type === b.type && a.delimiter === b.delimiter &&
     return a.type === b.type && a.delimiter === b.delimiter &&
-           a.bulletChar === b.bulletChar;
+          a.bulletChar === b.bulletChar;
   }
   }
 
 
   /**
   /**
@@ -2599,9 +2599,9 @@
    */
    */
   function mdInlineNode(type, literal) {
   function mdInlineNode(type, literal) {
     return { type: type, literal: literal == null ? '' : literal,
     return { type: type, literal: literal == null ? '' : literal,
-             parent: null, next: null, prev: null,
-             firstChild: null, lastChild: null,
-             destination: null, title: null, hardBreak: false };
+            parent: null, next: null, prev: null,
+            firstChild: null, lastChild: null,
+            destination: null, title: null, hardBreak: false };
   }
   }
 
 
   function mdAppendChild(parent, node) {
   function mdAppendChild(parent, node) {
@@ -2674,8 +2674,8 @@
       // adjacent characters, taking surrogate pairs as one character
       // adjacent characters, taking surrogate pairs as one character
       var charBefore = startpos === 0 ? '\n'
       var charBefore = startpos === 0 ? '\n'
         : (mdIsHighSurrogate(subject.charAt(startpos - 1))
         : (mdIsHighSurrogate(subject.charAt(startpos - 1))
-             ? subject.slice(startpos - 2, startpos)
-             : subject.charAt(startpos - 1));
+            ? subject.slice(startpos - 2, startpos)
+            : subject.charAt(startpos - 1));
       var nextCh = peek();
       var nextCh = peek();
       var charAfter = nextCh === '' ? '\n'
       var charAfter = nextCh === '' ? '\n'
         : (mdIsHighSurrogate(nextCh) ? subject.substr(pos, 2) : nextCh);
         : (mdIsHighSurrogate(nextCh) ? subject.substr(pos, 2) : nextCh);
@@ -2743,8 +2743,8 @@
         var idx = (closer.cc === '_' ? 0 : 4) + (closer.canOpen ? 2 : 0) + (closer.origdelims % 3 === 0 ? 0 : 1);
         var idx = (closer.cc === '_' ? 0 : 4) + (closer.canOpen ? 2 : 0) + (closer.origdelims % 3 === 0 ? 0 : 1);
         while (opener !== null && opener !== stackBottom && opener !== openersBottom[idx]) {
         while (opener !== null && opener !== stackBottom && opener !== openersBottom[idx]) {
           oddMatch = (closer.canOpen || opener.canClose) &&
           oddMatch = (closer.canOpen || opener.canClose) &&
-                     closer.origdelims % 3 !== 0 &&
-                     (opener.origdelims + closer.origdelims) % 3 === 0;
+                    closer.origdelims % 3 !== 0 &&
+                    (opener.origdelims + closer.origdelims) % 3 === 0;
           if (opener.cc === closer.cc && opener.canOpen && !oddMatch) { openerFound = true; break; }
           if (opener.cc === closer.cc && opener.canOpen && !oddMatch) { openerFound = true; break; }
           opener = opener.previous;
           opener = opener.previous;
         }
         }
@@ -2846,7 +2846,7 @@
     function addBracket(node, index, image) {
     function addBracket(node, index, image) {
       if (brackets) brackets.bracketAfter = true;
       if (brackets) brackets.bracketAfter = true;
       brackets = { node: node, previous: brackets, previousDelimiter: delimiters,
       brackets = { node: node, previous: brackets, previousDelimiter: delimiters,
-                   index: index, image: image, active: true, bracketAfter: false };
+                  index: index, image: image, active: true, bracketAfter: false };
     }
     }
 
 
     function removeBracket() { brackets = brackets.previous; }
     function removeBracket() { brackets = brackets.previous; }
@@ -3011,7 +3011,7 @@
             hb.hardBreak = true;
             hb.hardBreak = true;
             match(/^ */);
             match(/^ */);
           } else if (subject.charAt(pos + 1) !== '' &&
           } else if (subject.charAt(pos + 1) !== '' &&
-                     MD_ESCAPABLE.indexOf(subject.charAt(pos + 1)) >= 0) {
+                    MD_ESCAPABLE.indexOf(subject.charAt(pos + 1)) >= 0) {
             text(subject.charAt(pos + 1));
             text(subject.charAt(pos + 1));
             pos += 2;
             pos += 2;
           } else {
           } else {
@@ -3153,13 +3153,13 @@
           break;
           break;
         case 'link':
         case 'link':
           out += '<a href="' + safeMarkdownUrl(mdEscapeAttr(c.destination)) + '"' +
           out += '<a href="' + safeMarkdownUrl(mdEscapeAttr(c.destination)) + '"' +
-                 (c.title ? ' title="' + mdEscapeAttr(c.title) + '"' : '') + '>' +
-                 mdRenderInlines(c) + '</a>';
+                (c.title ? ' title="' + mdEscapeAttr(c.title) + '"' : '') + '>' +
+                mdRenderInlines(c) + '</a>';
           break;
           break;
         case 'image':
         case 'image':
           out += '<img src="' + safeMarkdownUrl(mdEscapeAttr(c.destination)) + '"' +
           out += '<img src="' + safeMarkdownUrl(mdEscapeAttr(c.destination)) + '"' +
-                 ' alt="' + mdImageAlt(c) + '"' +
-                 (c.title ? ' title="' + mdEscapeAttr(c.title) + '"' : '') + ' />';
+                ' alt="' + mdImageAlt(c) + '"' +
+                (c.title ? ' title="' + mdEscapeAttr(c.title) + '"' : '') + ' />';
           break;
           break;
         case 'html':
         case 'html':
           out += mdEscape(c.literal);
           out += mdEscape(c.literal);