Browse Source

Remove dead code in em/del

pull/14/head
Alex Kocharin 10 years ago
parent
commit
ba2463f2f5
  1. 19
      lib/rules_inline/emphasis.js
  2. 7
      lib/rules_inline/strikethrough.js
  3. 11
      test/fixtures/remarkable/regression.txt

19
lib/rules_inline/emphasis.js

@ -52,14 +52,12 @@ module.exports = function emphasis(state, silent) {
var startCount, var startCount,
count, count,
found, found,
ok,
oldCount, oldCount,
newCount, newCount,
stack, stack,
res, res,
max = state.posMax, max = state.posMax,
start = state.pos, start = state.pos,
haveLiteralAsterisk,
marker = state.src.charCodeAt(start); marker = state.src.charCodeAt(start);
if (marker !== 0x5F/* _ */ && marker !== 0x2A /* * */) { return false; } if (marker !== 0x5F/* _ */ && marker !== 0x2A /* * */) { return false; }
@ -83,7 +81,7 @@ module.exports = function emphasis(state, silent) {
stack = [ startCount ]; stack = [ startCount ];
while (state.pos < max) { while (state.pos < max) {
if (state.src.charCodeAt(state.pos) === marker && !haveLiteralAsterisk) { if (state.src.charCodeAt(state.pos) === marker) {
res = scanDelims(state, state.pos); res = scanDelims(state, state.pos);
count = res.delims; count = res.delims;
if (res.can_close) { if (res.can_close) {
@ -112,22 +110,9 @@ module.exports = function emphasis(state, silent) {
state.pos += count; state.pos += count;
continue; continue;
} }
if (res.can_open) {
stack.push(count);
state.pos += count;
continue;
}
} }
ok = state.parser.skipToken(state); if (!state.parser.skipToken(state)) { state.pos++; }
if (ok) {
haveLiteralAsterisk = false;
} else {
haveLiteralAsterisk = state.src.charCodeAt(state.pos) === marker;
state.pos++;
}
} }
if (!found) { if (!found) {

7
lib/rules_inline/strikethrough.js

@ -4,7 +4,6 @@
module.exports = function strikethrough(state, silent) { module.exports = function strikethrough(state, silent) {
var found, var found,
ok,
pos, pos,
max = state.posMax, max = state.posMax,
start = state.pos, start = state.pos,
@ -54,11 +53,7 @@ module.exports = function strikethrough(state, silent) {
} }
} }
ok = state.parser.skipToken(state); if (!state.parser.skipToken(state)) { state.pos++; }
if (!ok) {
state.pos++;
}
} }
if (!found) { if (!found) {

11
test/fixtures/remarkable/regression.txt

@ -60,3 +60,14 @@ test~~</p>
test test
~~</p> ~~</p>
. .
Link priority, not covered by stmd tests:
.
[**link]()**
**[link**]()
.
<p><a href="">**link</a>**</p>
<p>**<a href="">link**</a></p>
.

Loading…
Cancel
Save