From b27fb63e79dc628dc6eacf1abfb4aa792d9f883d Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 16 Aug 2019 10:25:52 +0200 Subject: [PATCH 1/2] Update dev-dependencies --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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", From 231fa2ac9a6be9ab9a14639dce45aad2584377f3 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 16 Aug 2019 11:00:02 +0200 Subject: [PATCH 2/2] Fix no end-of-file linefeed producing duplicates Closes GH-4. --- index.js | 2 +- .../eof-eol-missing-two-paragraphs/input.html | 1 + .../output.json | 117 ++++++++++++++++++ 3 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/eof-eol-missing-two-paragraphs/input.html create mode 100644 test/fixtures/eof-eol-missing-two-paragraphs/output.json 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/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 + } + } +}