Browse Source

Smartquote rule cleanup

pull/82/head
Alex Kocharin 10 years ago
parent
commit
e91574c391
  1. 4
      lib/rules_core/smartquotes.js
  2. 6
      test/fixtures/markdown-it/smartquotes.txt

4
lib/rules_core/smartquotes.js

@ -26,8 +26,6 @@ function process_inlines(tokens, state) {
for (i = 0; i < tokens.length; i++) { for (i = 0; i < tokens.length; i++) {
token = tokens[i]; token = tokens[i];
if (token.type !== 'text' || QUOTE_TEST_RE.test(token.text)) { continue; }
thisLevel = tokens[i].level; thisLevel = tokens[i].level;
for (j = stack.length - 1; j >= 0; j--) { for (j = stack.length - 1; j >= 0; j--) {
@ -35,6 +33,8 @@ function process_inlines(tokens, state) {
} }
stack.length = j + 1; stack.length = j + 1;
if (token.type !== 'text') { continue; }
text = token.content; text = token.content;
pos = 0; pos = 0;
max = text.length; max = text.length;

6
test/fixtures/markdown-it/smartquotes.txt

@ -50,6 +50,12 @@ Should not match quotes on different levels:
<p><em>&quot;foo</em> bar <em>baz&quot;</em></p> <p><em>&quot;foo</em> bar <em>baz&quot;</em></p>
. .
Smartquotes should not overlap with other tags:
.
*foo "bar* *baz" quux*
.
<p><em>foo &quot;bar</em> <em>baz&quot; quux</em></p>
.
Should try and find matching quote in this case: Should try and find matching quote in this case:

Loading…
Cancel
Save