Skip to content

Commit 7f4befe

Browse files
authored
Fix issue with carriage return (EOL) at the EOF (hellt#6)
1 parent 3335855 commit 7f4befe

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

fnsort.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ def refrepl(m, order):
4949

5050

5151
def sort_footnotes(text):
52+
# removes the last newline from EOF so there is no EOL on the last line
53+
text = text.rstrip()
54+
5255
links = link.findall(text)
5356
# print(f"links: {links}")
5457

tests/duplicates/duplicates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ Fifteen of the twenty-one species are native to the United States. The Texas hor
1010

1111
[^1]: the more spiky, the better
1212
[^3]: really cool
13+
[^4]: it's hot in the desert
1314
[^2]: a bit of a misnomer, right?
1415
[^5]: not to be confused with antlers, since horns don't fall off each year
15-
[^4]: it's hot in the desert

tests/duplicates/duplicates_expected.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ Fifteen of the twenty-one species are native to the United States. The Texas hor
1212
[^2]: really cool
1313
[^3]: a bit of a misnomer, right?
1414
[^4]: not to be confused with antlers, since horns don't fall off each year
15-
[^5]: it's hot in the desert
15+
[^5]: it's hot in the desert

0 commit comments

Comments
 (0)