diff --git a/code/cit.py b/code/cit.py index 68e71052e645f00dc3482965476c003f3866a3f2..8cf3ace8f897e5f63630034b642026dd0b499d95 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 0000000000000000000000000000000000000000..4082947974f4f0f3e5e7c9a34cc38783fcc7a151 --- /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> +