Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Put config serialization into main()
  • Loading branch information
kthoden committed Mar 7, 2019
1 parent b164a71 commit dda6184
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions tei2imxml.py
Expand Up @@ -220,11 +220,7 @@ def make_publication_cfg(info_dict):
except IndexError:
authors_config[author_label] = ""

output_filename = OUTPUT_DIR + os.path.sep + "publication.cfg"
with open(output_filename, 'w') as configfile:
config.write(configfile)

print("Wrote", output_filename)
return config
# def make_publication_cfg ends here

def render_reference(list_of_xml_elements, cited_data):
Expand Down Expand Up @@ -1110,9 +1106,20 @@ def main():

if not os.path.exists(OUTPUT_DIR):
os.mkdir(os.path.expanduser(OUTPUT_DIR))
logging.info(f"Created {os.path.expanduser(OUTPUT_DIR)}")
input("press enter")
else:
logging.info(f"We are using {os.path.expanduser(OUTPUT_DIR)} as output dir")
input("press enter")

publication_info = get_publication_info(xml_tree)
make_publication_cfg(publication_info)
config_data = make_publication_cfg(publication_info)

output_filename = OUTPUT_DIR + os.path.sep + "publication.cfg"
with open(output_filename, 'w') as configfile:
config_data.write(configfile)

print("Wrote", output_filename)

if not os.path.exists(TMP_DIR):
os.mkdir(os.path.expanduser(TMP_DIR))
Expand Down

0 comments on commit dda6184

Please sign in to comment.