Skip to content

Commit

Permalink
🗜️ build [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkedJS bot committed Apr 8, 2020
1 parent 51119d6 commit 0b5842e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 37 deletions.
38 changes: 20 additions & 18 deletions lib/marked.esm.js
Expand Up @@ -621,17 +621,17 @@ var Lexer_1 = class Lexer {
.replace(/\r\n|\r/g, '\n')
.replace(/\t/g, ' ');

this.blockTokens(this.tokens, src);
this.blockTokens(src, this.tokens);

this.inlineTokens(this.tokens);
this.inline(this.tokens);

return this.tokens;
}

/**
* Lexing
*/
blockTokens(tokens, src, top = true) {
blockTokens(src, tokens, top = true) {
src = src.replace(/^ +$/gm, '');
let next,
loose,
Expand Down Expand Up @@ -772,7 +772,7 @@ var Lexer_1 = class Lexer {
tokens.push({
type: 'blockquote',
raw,
tokens: this.blockTokens([], cap, top)
tokens: this.blockTokens(cap, [], top)
});

continue;
Expand Down Expand Up @@ -859,7 +859,7 @@ var Lexer_1 = class Lexer {
task: istask,
checked: ischecked,
loose: loose,
tokens: this.blockTokens([], item, false)
tokens: this.blockTokens(item, [], false)
});
}

Expand Down Expand Up @@ -988,7 +988,7 @@ var Lexer_1 = class Lexer {
return tokens;
}

inlineTokens(tokens) {
inline(tokens) {
let i,
j,
k,
Expand All @@ -1004,7 +1004,7 @@ var Lexer_1 = class Lexer {
case 'text':
case 'heading': {
token.tokens = [];
this.inlineOutput(token.text, token.tokens);
this.inlineTokens(token.text, token.tokens);
break;
}
case 'table': {
Expand All @@ -1017,7 +1017,7 @@ var Lexer_1 = class Lexer {
l2 = token.header.length;
for (j = 0; j < l2; j++) {
token.tokens.header[j] = [];
this.inlineOutput(token.header[j], token.tokens.header[j]);
this.inlineTokens(token.header[j], token.tokens.header[j]);
}

// cells
Expand All @@ -1027,20 +1027,20 @@ var Lexer_1 = class Lexer {
token.tokens.cells[j] = [];
for (k = 0; k < row.length; k++) {
token.tokens.cells[j][k] = [];
this.inlineOutput(row[k], token.tokens.cells[j][k]);
this.inlineTokens(row[k], token.tokens.cells[j][k]);
}
}

break;
}
case 'blockquote': {
this.inlineTokens(token.tokens);
this.inline(token.tokens);
break;
}
case 'list': {
l2 = token.items.length;
for (j = 0; j < l2; j++) {
this.inlineTokens(token.items[j].tokens);
this.inline(token.items[j].tokens);
}
break;
}
Expand All @@ -1053,7 +1053,7 @@ var Lexer_1 = class Lexer {
/**
* Lexing/Compiling
*/
inlineOutput(src, tokens) {
inlineTokens(src, tokens) {
let out = '',
link,
text,
Expand Down Expand Up @@ -1177,7 +1177,7 @@ var Lexer_1 = class Lexer {
src = src.substring(cap[0].length);
raw = cap[0];
newTokens = tokens ? [] : null;
text = this.inlineOutput(cap[4] || cap[3] || cap[2] || cap[1], newTokens);
text = this.inlineTokens(cap[4] || cap[3] || cap[2] || cap[1], newTokens);

tokens.push({
type: 'strong',
Expand All @@ -1194,7 +1194,7 @@ var Lexer_1 = class Lexer {
src = src.substring(cap[0].length);
raw = cap[0];
newTokens = tokens ? [] : null;
text = this.inlineOutput(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1], newTokens);
text = this.inlineTokens(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1], newTokens);
tokens.push({
type: 'em',
raw,
Expand Down Expand Up @@ -1236,7 +1236,7 @@ var Lexer_1 = class Lexer {
src = src.substring(cap[0].length);
raw = cap[0];
newTokens = tokens ? [] : null;
text = this.inlineOutput(cap[1], newTokens);
text = this.inlineTokens(cap[1], newTokens);
tokens.push({
type: 'del',
raw,
Expand Down Expand Up @@ -1356,7 +1356,7 @@ var Lexer_1 = class Lexer {
const newTokens = tokens ? [] : null;

if (cap[0].charAt(0) !== '!') {
const text = this.inlineOutput(cap[1], newTokens);
const text = this.inlineTokens(cap[1], newTokens);
tokens.push({
type: 'link',
raw,
Expand Down Expand Up @@ -1676,8 +1676,8 @@ var Parser_1 = class Parser {
this.options = options || defaults$3;
this.options.renderer = this.options.renderer || new Renderer_1();
this.renderer = this.options.renderer;
this.textRenderer = new TextRenderer_1();
this.renderer.options = this.options;
this.textRenderer = new TextRenderer_1();
this.slugger = new Slugger_1();
}

Expand Down Expand Up @@ -1837,6 +1837,7 @@ var Parser_1 = class Parser {
const errMsg = 'Token with "' + token.type + '" type was not found.';
if (this.options.silent) {
console.error(errMsg);
return;
} else {
throw new Error(errMsg);
}
Expand Down Expand Up @@ -1901,9 +1902,10 @@ var Parser_1 = class Parser {
break;
}
default: {
const errMsg = 'Token with "' + this.token.type + '" type was not found.';
const errMsg = 'Token with "' + token.type + '" type was not found.';
if (this.options.silent) {
console.error(errMsg);
return;
} else {
throw new Error(errMsg);
}
Expand Down
38 changes: 20 additions & 18 deletions lib/marked.js
Expand Up @@ -564,16 +564,16 @@

_proto.lex = function lex(src) {
src = src.replace(/\r\n|\r/g, '\n').replace(/\t/g, ' ');
this.blockTokens(this.tokens, src);
this.inlineTokens(this.tokens);
this.blockTokens(src, this.tokens);
this.inline(this.tokens);
return this.tokens;
}
/**
* Lexing
*/
;

_proto.blockTokens = function blockTokens(tokens, src, top) {
_proto.blockTokens = function blockTokens(src, tokens, top) {
if (top === void 0) {
top = true;
}
Expand Down Expand Up @@ -700,7 +700,7 @@
tokens.push({
type: 'blockquote',
raw: raw,
tokens: this.blockTokens([], cap, top)
tokens: this.blockTokens(cap, [], top)
});
continue;
} // list
Expand Down Expand Up @@ -780,7 +780,7 @@
task: istask,
checked: ischecked,
loose: loose,
tokens: this.blockTokens([], item, false)
tokens: this.blockTokens(item, [], false)
});
}

Expand Down Expand Up @@ -905,7 +905,7 @@
return tokens;
};

_proto.inlineTokens = function inlineTokens(tokens) {
_proto.inline = function inline(tokens) {
var i, j, k, l2, row, token;
var l = tokens.length;

Expand All @@ -918,7 +918,7 @@
case 'heading':
{
token.tokens = [];
this.inlineOutput(token.text, token.tokens);
this.inlineTokens(token.text, token.tokens);
break;
}

Expand All @@ -933,7 +933,7 @@

for (j = 0; j < l2; j++) {
token.tokens.header[j] = [];
this.inlineOutput(token.header[j], token.tokens.header[j]);
this.inlineTokens(token.header[j], token.tokens.header[j]);
} // cells


Expand All @@ -945,7 +945,7 @@

for (k = 0; k < row.length; k++) {
token.tokens.cells[j][k] = [];
this.inlineOutput(row[k], token.tokens.cells[j][k]);
this.inlineTokens(row[k], token.tokens.cells[j][k]);
}
}

Expand All @@ -954,7 +954,7 @@

case 'blockquote':
{
this.inlineTokens(token.tokens);
this.inline(token.tokens);
break;
}

Expand All @@ -963,7 +963,7 @@
l2 = token.items.length;

for (j = 0; j < l2; j++) {
this.inlineTokens(token.items[j].tokens);
this.inline(token.items[j].tokens);
}

break;
Expand All @@ -978,7 +978,7 @@
*/
;

_proto.inlineOutput = function inlineOutput(src, tokens) {
_proto.inlineTokens = function inlineTokens(src, tokens) {
var out = '',
link,
text,
Expand Down Expand Up @@ -1102,7 +1102,7 @@
src = src.substring(cap[0].length);
raw = cap[0];
newTokens = tokens ? [] : null;
text = this.inlineOutput(cap[4] || cap[3] || cap[2] || cap[1], newTokens);
text = this.inlineTokens(cap[4] || cap[3] || cap[2] || cap[1], newTokens);
tokens.push({
type: 'strong',
raw: raw,
Expand All @@ -1118,7 +1118,7 @@
src = src.substring(cap[0].length);
raw = cap[0];
newTokens = tokens ? [] : null;
text = this.inlineOutput(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1], newTokens);
text = this.inlineTokens(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1], newTokens);
tokens.push({
type: 'em',
raw: raw,
Expand Down Expand Up @@ -1160,7 +1160,7 @@
src = src.substring(cap[0].length);
raw = cap[0];
newTokens = tokens ? [] : null;
text = this.inlineOutput(cap[1], newTokens);
text = this.inlineTokens(cap[1], newTokens);
tokens.push({
type: 'del',
raw: raw,
Expand Down Expand Up @@ -1285,7 +1285,7 @@
var newTokens = tokens ? [] : null;

if (cap[0].charAt(0) !== '!') {
var text = this.inlineOutput(cap[1], newTokens);
var text = this.inlineTokens(cap[1], newTokens);
tokens.push({
type: 'link',
raw: raw,
Expand Down Expand Up @@ -1604,8 +1604,8 @@
this.options = options || defaults$3;
this.options.renderer = this.options.renderer || new Renderer_1();
this.renderer = this.options.renderer;
this.textRenderer = new TextRenderer_1();
this.renderer.options = this.options;
this.textRenderer = new TextRenderer_1();
this.slugger = new Slugger_1();
}
/**
Expand Down Expand Up @@ -1796,6 +1796,7 @@

if (this.options.silent) {
console.error(errMsg);
return;
} else {
throw new Error(errMsg);
}
Expand Down Expand Up @@ -1883,10 +1884,11 @@

default:
{
var errMsg = 'Token with "' + this.token.type + '" type was not found.';
var errMsg = 'Token with "' + token.type + '" type was not found.';

if (this.options.silent) {
console.error(errMsg);
return;
} else {
throw new Error(errMsg);
}
Expand Down

0 comments on commit 0b5842e

Please sign in to comment.