From 1d97196a36928c35ffbcad07f06f35233c4e33c3 Mon Sep 17 00:00:00 2001 From: Liliana Sanfilippo <liliana.sanfilippo@uni-bielefeld.de> Date: Wed, 25 Sep 2024 10:52:50 +0200 Subject: [PATCH] code --- code/cit.py | 15 +++++++++------ code/output.txt | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 code/output.txt diff --git a/code/cit.py b/code/cit.py index 68e71052..8cf3ace8 100644 --- a/code/cit.py +++ b/code/cit.py @@ -26,7 +26,7 @@ def main(): file_content = file.read() print("Parsing file...") try: - library = bibtexparser.parse_string(file_content) + library = bibtexparser.loads(file_content) #opening output file try: with open('output.txt', 'w') as out: @@ -39,16 +39,19 @@ def main(): dictio = {} en_x = library.entries[x] print("Filling dictionary for entry "+ str(x+1) + "") - for y in en_x.fields: - key = y.key + + # Direkt auf die Einträge zugreifen, da es sich um ein Dictionary handelt + for key, value in en_x.items(): key_low = key.lower() - dictio[key_low] = y.value + dictio[key_low] = value - if en_x.entry_type == "article": + # Überprüfung auf den Typ des Eintrags über 'ENTRYTYPE' + if en_x['ENTRYTYPE'] == "article": articleHTML(dictio, x, out) - elif en_x.entry_type =="misc": + elif en_x['ENTRYTYPE'] == "misc": miscHTML(dictio, x, out) + except Exception as e: print(f"An unexpected error occurred: {e}") except Exception as e: diff --git a/code/output.txt b/code/output.txt new file mode 100644 index 00000000..40829479 --- /dev/null +++ b/code/output.txt @@ -0,0 +1,14 @@ +{/*<!-- Citation num 1--> */} +<li typeof="schema:ScolarlyArticle" role="doc-biblioentry" property="schema:citation" id="desc-1"> + <span property="schema:author" typeof="schema:Person"> + <span property="schema:Name"> Roth, F.</span>; + <span property="schema:Name"> Draguhn, A.</span> + </span> + <span property="schema:name"> Die Entwicklung der Patch-Clamp-Technik. </span> + <i property="schema:publisher" typeof="schema:Organization"> Springer eBooks</i> + <b property="issueNumber" typeof="PublicationIssue"> </b>, + <span property="schema:pageBegin"> 1</span>-<span property="schema:pageEnd">14</span> + (<time property="schema:datePublished" datatype="xsd:gYear" dateTime=" 2023">2023</time>). + <a className="doi" href="https://doi.org/10.1007/978-3-662-66053-9_1"> doi: 10.1007/978-3-662-66053-9_1</a> +</li> + -- GitLab