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

7
lib/rules_inline/strikethrough.js

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

11
test/fixtures/remarkable/regression.txt

@ -60,3 +60,14 @@ test~~</p>
test
~~</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