Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue63: add <fr> tag to entry-metadata.csv + bug fixes #69

Merged
merged 4 commits into from
Jan 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions manuscript.py
Original file line number Diff line number Diff line change
@@ -31,6 +31,10 @@ def clean_folio(folio: str) -> str:
def clean_id(identity: str) -> str:
return identity.lstrip("p").lstrip("0").replace("_","")

def display_id(identity: str) -> str:
# inverse of clean_id()
return "p" + identity[:-1].zfill(4) + "_" + identity[-1]

def separate_by_id(filepath: str) -> Dict[str, et.Element]:
"""Take a file path, read it as XML, and process it into separate elements by ID.
Returned object is a dictionary of lxml.etree.Element objects keyed by entry ID as a string.
@@ -229,8 +233,9 @@ def update_entries(self, outdir=utils.entries_path, dry_run=False):
os.makedirs(xml_path, exist_ok=True)

for identity, entry in entries.items():
filepath_txt = os.path.join(txt_path, f'{version}_{entry.identity}.txt')
filepath_xml = os.path.join(xml_path, f'{version}_{entry.identity}.xml')
# need to leftpad this
filepath_txt = os.path.join(txt_path, f'{version}_{display_id(entry.identity)}.txt')
filepath_xml = os.path.join(xml_path, f'{version}_{display_id(entry.identity)}.xml')

content_txt = entry.text
content_xml = entry.xml_string # should already have an <entry> root tag :)
2 changes: 1 addition & 1 deletion update.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Last Updated | 2021-01-08
# Last Updated | 2021-01-25
# Python Modules
import os
import sys
1 change: 1 addition & 0 deletions utils.py
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@
'greek': 'el',
'italian': 'it',
'latin': 'la',
'french': 'fr',
'occitan': 'oc',
'poitevin': 'po'
}