Skip to content

Commit

Permalink
Compiled
Browse files Browse the repository at this point in the history
  • Loading branch information
jun-sheaf committed Jun 17, 2020
1 parent fcfe15f commit d8e1275
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
9 changes: 5 additions & 4 deletions lib/marked.esm.js
Expand Up @@ -492,12 +492,13 @@ var Tokenizer_1 = class Tokenizer {
let raw = cap[0];
const bull = cap[2];
const isordered = bull.length > 1;
const isparen = bull[bull.length - 1] === ')';

const list = {
type: 'list',
raw,
ordered: isordered,
start: isordered ? +bull : '',
start: isordered ? +bull.slice(0, -1) : '',
loose: false,
items: []
};
Expand All @@ -522,7 +523,7 @@ var Tokenizer_1 = class Tokenizer {
// Remove the list item's bullet
// so it is seen as the next token.
space = item.length;
item = item.replace(/^ *([*+-]|\d+\.) */, '');
item = item.replace(/^ *([*+-]|\d+[.)]) */, '');

// Outdent whatever the
// list item contains. Hacky.
Expand All @@ -537,7 +538,7 @@ var Tokenizer_1 = class Tokenizer {
// Backpedal if it does not belong in this list.
if (i !== l - 1) {
b = this.rules.block.bullet.exec(itemMatch[i + 1])[0];
if (bull.length > 1 ? b.length === 1
if (isordered ? b.length === 1 || (!isparen && b[b.length - 1] === ')')
: (b.length > 1 || (this.options.smartLists && b !== bull))) {
addBack = itemMatch.slice(i + 1).join('\n');
list.raw = list.raw.substring(0, list.raw.length - addBack.length);
Expand Down Expand Up @@ -974,7 +975,7 @@ block.def = edit$1(block.def)
.replace('title', block._title)
.getRegex();

block.bullet = /(?:[*+-]|\d{1,9}\.)/;
block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
block.item = edit$1(block.item, 'gm')
.replace(/bull/g, block.bullet)
Expand Down
9 changes: 5 additions & 4 deletions lib/marked.js
Expand Up @@ -585,11 +585,12 @@
var raw = cap[0];
var bull = cap[2];
var isordered = bull.length > 1;
var isparen = bull[bull.length - 1] === ')';
var list = {
type: 'list',
raw: raw,
ordered: isordered,
start: isordered ? +bull : '',
start: isordered ? +bull.slice(0, -1) : '',
loose: false,
items: []
}; // Get each top-level item.
Expand All @@ -611,7 +612,7 @@
// so it is seen as the next token.

space = item.length;
item = item.replace(/^ *([*+-]|\d+\.) */, ''); // Outdent whatever the
item = item.replace(/^ *([*+-]|\d+[.)]) */, ''); // Outdent whatever the
// list item contains. Hacky.

if (~item.indexOf('\n ')) {
Expand All @@ -624,7 +625,7 @@
if (i !== l - 1) {
b = this.rules.block.bullet.exec(itemMatch[i + 1])[0];

if (bull.length > 1 ? b.length === 1 : b.length > 1 || this.options.smartLists && b !== bull) {
if (isordered ? b.length === 1 || !isparen && b[b.length - 1] === ')' : b.length > 1 || this.options.smartLists && b !== bull) {
addBack = itemMatch.slice(i + 1).join('\n');
list.raw = list.raw.substring(0, list.raw.length - addBack.length);
i = l - 1;
Expand Down Expand Up @@ -1076,7 +1077,7 @@
block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
block.def = edit$1(block.def).replace('label', block._label).replace('title', block._title).getRegex();
block.bullet = /(?:[*+-]|\d{1,9}\.)/;
block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
block.item = edit$1(block.item, 'gm').replace(/bull/g, block.bullet).getRegex();
block.list = edit$1(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
Expand Down

0 comments on commit d8e1275

Please sign in to comment.