Skip to content

Commit 231fa2a

Browse files
committed
Fix no end-of-file linefeed producing duplicates
Closes GH-4.
1 parent b27fb63 commit 231fa2a

File tree

3 files changed

+119
-1
lines changed

3 files changed

+119
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function toNlcst(tree, file, Parser) {
162162
} else if (child && start === -1) {
163163
find(child)
164164
start = index + 1
165-
} else {
165+
} else if (start !== -1) {
166166
;(viable ? add : findAll)(children.slice(start, index))
167167

168168
if (child) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>🤔</p><p></p>
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
"type": "RootNode",
3+
"children": [
4+
{
5+
"type": "ParagraphNode",
6+
"children": [
7+
{
8+
"type": "SentenceNode",
9+
"children": [
10+
{
11+
"type": "SymbolNode",
12+
"value": "🤔",
13+
"position": {
14+
"start": {
15+
"line": 1,
16+
"column": 4,
17+
"offset": 3
18+
},
19+
"end": {
20+
"line": 1,
21+
"column": 6,
22+
"offset": 5
23+
}
24+
}
25+
}
26+
],
27+
"position": {
28+
"start": {
29+
"line": 1,
30+
"column": 4,
31+
"offset": 3
32+
},
33+
"end": {
34+
"line": 1,
35+
"column": 6,
36+
"offset": 5
37+
}
38+
}
39+
}
40+
],
41+
"position": {
42+
"start": {
43+
"line": 1,
44+
"column": 4,
45+
"offset": 3
46+
},
47+
"end": {
48+
"line": 1,
49+
"column": 6,
50+
"offset": 5
51+
}
52+
}
53+
},
54+
{
55+
"type": "ParagraphNode",
56+
"children": [
57+
{
58+
"type": "SentenceNode",
59+
"children": [
60+
{
61+
"type": "SymbolNode",
62+
"value": "",
63+
"position": {
64+
"start": {
65+
"line": 1,
66+
"column": 13,
67+
"offset": 12
68+
},
69+
"end": {
70+
"line": 1,
71+
"column": 14,
72+
"offset": 13
73+
}
74+
}
75+
}
76+
],
77+
"position": {
78+
"start": {
79+
"line": 1,
80+
"column": 13,
81+
"offset": 12
82+
},
83+
"end": {
84+
"line": 1,
85+
"column": 14,
86+
"offset": 13
87+
}
88+
}
89+
}
90+
],
91+
"position": {
92+
"start": {
93+
"line": 1,
94+
"column": 13,
95+
"offset": 12
96+
},
97+
"end": {
98+
"line": 1,
99+
"column": 14,
100+
"offset": 13
101+
}
102+
}
103+
}
104+
],
105+
"position": {
106+
"start": {
107+
"line": 1,
108+
"column": 1,
109+
"offset": 0
110+
},
111+
"end": {
112+
"line": 1,
113+
"column": 18,
114+
"offset": 17
115+
}
116+
}
117+
}

0 commit comments

Comments
 (0)