From 178cdf477707b7b6ccf5d0e64a52e9f62d71745b Mon Sep 17 00:00:00 2001 From: Alex Kocharin Date: Thu, 18 Sep 2014 02:15:05 +0400 Subject: [PATCH] Fix paragraph tightness `state.tight` might be updated in the rules, so we should set it after running rules, not before --- lib/lexer_block.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/lexer_block.js b/lib/lexer_block.js index 799a59d..206d62a 100644 --- a/lib/lexer_block.js +++ b/lib/lexer_block.js @@ -127,8 +127,6 @@ LexerBlock.prototype.tokenize = function (state, startLine, endLine) { if (state.tShift[line] < state.blkIndent) { break; } if (state.bqMarks[line] < state.bqLevel) { break; } - state.tight = !hasEmptyLines; - // Try all possible rules. // On success, rule should: // @@ -149,6 +147,10 @@ LexerBlock.prototype.tokenize = function (state, startLine, endLine) { line = state.line; + // set state.tight iff we had an empty line before current tag + // i.e. latest empty line should not count + state.tight = !hasEmptyLines; + if (line < endLine && isEmpty(state, line)) { hasEmptyLines = true; line++;