fix: ensure newline at end of file.
This commit is contained in:
parent
2e76b88d09
commit
3fef197d33
1 changed files with 5 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import string
|
||||||
import sys
|
import sys
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
|
@ -31,12 +32,15 @@ def process_line(
|
||||||
columns = [_sanitize_line(l) for l in columns]
|
columns = [_sanitize_line(l) for l in columns]
|
||||||
deckpath = _get_path(target_dir, columns[deck_index])
|
deckpath = _get_path(target_dir, columns[deck_index])
|
||||||
columns = [columns[i] for i in columns_indices]
|
columns = [columns[i] for i in columns_indices]
|
||||||
slug = ''.join(c for c in columns[0].lower() if c.isalnum() or c == ' ')
|
slug = ''.join(c for c in columns[0].lower() if c in string.ascii_lowercase + string.digits + ' ')
|
||||||
slug = slug.replace(' ', '-')
|
slug = slug.replace(' ', '-')
|
||||||
base_filename = deckpath / slug
|
base_filename = deckpath / slug
|
||||||
for i, c in enumerate(columns):
|
for i, c in enumerate(columns):
|
||||||
with (base_filename.parent / (base_filename.name + f'.{i}.md')).open('w') as fp:
|
with (base_filename.parent / (base_filename.name + f'.{i}.md')).open('w') as fp:
|
||||||
fp.write(c)
|
fp.write(c)
|
||||||
|
if not c.endswith('\n'):
|
||||||
|
fp.write('\n')
|
||||||
|
|
||||||
|
|
||||||
def main(
|
def main(
|
||||||
*,
|
*,
|
||||||
|
|
Loading…
Add table
Reference in a new issue