Skip to content

Commit

Permalink
fixup! Adjust magic numbers used for XML manipulation
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed May 7, 2024
1 parent 9513e57 commit 21262b0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/sotoki/utils/preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def read_sub():
for main_line in mainfh:
main_id = get_id_in(main_line, field_index_in_main)

# write main line to dest; removing tag end (/> -> >) and CRLF
# write main line to dest; removing tag end (/>) and LF
dsth.write(main_line[:-3])
dsth.write(b">")

Expand All @@ -247,8 +247,8 @@ def read_sub():
has_subs = True

dsth.write(node_start)
# write the sub line removing the 2 heading spaces, node name (<row)
# removing trailing CRLF as well. node already self closed in source
# write the sub line removing node name (<row) and trailing LF as well. node already
# self closed in source
dsth.write(current_sub[1][4:-1])
current_sub = read_sub()

Expand Down Expand Up @@ -334,7 +334,7 @@ def split_posts_by_posttypeid(
except IndexError:
break
try:
# rewrite with new name replacing ` <row` and `row>`
# rewrite with new name replacing `<row` and `row>LF`
fhs[found_id].write(starts[found_id])
fhs[found_id].write(line[4:-5])
fhs[found_id].write(ends[found_id])
Expand Down Expand Up @@ -403,7 +403,7 @@ def read_csv():
break

if current_csv[0] == post_id:
# write user line to dest; removing tag end and CRLF
# write user line to dest; removing tag open (<row), tag end (/>) and LF
dsth.write(b"<link")
dsth.write(line[4:-3])
# CSV title already includes appropriate quoting
Expand Down

0 comments on commit 21262b0

Please sign in to comment.