diff --git a/index.js b/index.js index d6ed6ae..d7e6e8e 100644 --- a/index.js +++ b/index.js @@ -162,7 +162,7 @@ function toNlcst(tree, file, Parser) { } else if (child && start === -1) { find(child) start = index + 1 - } else { + } else if (start !== -1) { ;(viable ? add : findAll)(children.slice(start, index)) if (child) { diff --git a/package.json b/package.json index fc45308..5dd28c2 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,8 @@ "parse-latin": "^4.0.0", "prettier": "^1.0.0", "rehype": "^9.0.0", - "remark-cli": "^6.0.0", - "remark-preset-wooorm": "^5.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", "tape": "^4.0.0", "tinyify": "^2.0.0", "vfile": "^4.0.0", diff --git a/test/fixtures/eof-eol-missing-two-paragraphs/input.html b/test/fixtures/eof-eol-missing-two-paragraphs/input.html new file mode 100644 index 0000000..713c8e6 --- /dev/null +++ b/test/fixtures/eof-eol-missing-two-paragraphs/input.html @@ -0,0 +1 @@ +
🤔
✨
\ No newline at end of file diff --git a/test/fixtures/eof-eol-missing-two-paragraphs/output.json b/test/fixtures/eof-eol-missing-two-paragraphs/output.json new file mode 100644 index 0000000..ddda60c --- /dev/null +++ b/test/fixtures/eof-eol-missing-two-paragraphs/output.json @@ -0,0 +1,117 @@ +{ + "type": "RootNode", + "children": [ + { + "type": "ParagraphNode", + "children": [ + { + "type": "SentenceNode", + "children": [ + { + "type": "SymbolNode", + "value": "🤔", + "position": { + "start": { + "line": 1, + "column": 4, + "offset": 3 + }, + "end": { + "line": 1, + "column": 6, + "offset": 5 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 4, + "offset": 3 + }, + "end": { + "line": 1, + "column": 6, + "offset": 5 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 4, + "offset": 3 + }, + "end": { + "line": 1, + "column": 6, + "offset": 5 + } + } + }, + { + "type": "ParagraphNode", + "children": [ + { + "type": "SentenceNode", + "children": [ + { + "type": "SymbolNode", + "value": "✨", + "position": { + "start": { + "line": 1, + "column": 13, + "offset": 12 + }, + "end": { + "line": 1, + "column": 14, + "offset": 13 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 13, + "offset": 12 + }, + "end": { + "line": 1, + "column": 14, + "offset": 13 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 13, + "offset": 12 + }, + "end": { + "line": 1, + "column": 14, + "offset": 13 + } + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 18, + "offset": 17 + } + } +}