diff options
author | Airan Shao <shaoairan@gmail.com> | 2017-02-11 13:28:45 +0800 |
---|---|---|
committer | Airan Shao <shaoairan@gmail.com> | 2017-02-11 13:28:45 +0800 |
commit | 167043de4167eeabde695b20d9f159034cae869e (patch) | |
tree | dad8e0e1293e09555a21d93daef9afbe32943c50 | |
parent | 97d39b6c2bf533d33538205a399638b63f6baa66 (diff) | |
download | yamljs-167043de4167eeabde695b20d9f159034cae869e.tar.gz |
Fix issue #60
Parser.getNextEmbedBlock() should not return if current line is comment
or blank.
-rw-r--r-- | src/Parser.coffee | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/Parser.coffee b/src/Parser.coffee index c0299d9..48d3030 100644 --- a/src/Parser.coffee +++ b/src/Parser.coffee @@ -333,17 +333,16 @@ class Parser if indent is newIndent removeComments = not removeCommentsPattern.test @currentLine - if isItUnindentedCollection and not @isStringUnIndentedCollectionItem(@currentLine) and indent is newIndent - @moveToPreviousLine() - break + if removeComments and @isCurrentLineComment() + continue if @isCurrentLineBlank() data.push @currentLine[newIndent..] continue - if removeComments and @isCurrentLineComment() - if indent is newIndent - continue + if isItUnindentedCollection and not @isStringUnIndentedCollectionItem(@currentLine) and indent is newIndent + @moveToPreviousLine() + break if indent >= newIndent data.push @currentLine[newIndent..] |