Skip to content
Snippets Groups Projects
Commit 7cf3f06b authored by Liliana Sanfilippo's avatar Liliana Sanfilippo
Browse files

cit

parent 61382afc
No related branches found
No related tags found
No related merge requests found
Pipeline #445541 failed
......@@ -96,20 +96,11 @@ def main():
else:
print("DONE")
def articleHTML(dictio, x, out):
print("Writing html code for article "+ str(x) + "...")
out.write("{/*<!-- Citation num " + str(x) + "--> */}" + "\n")
out.write("<li typeof=\"schema:ScolarlyArticle\" role=\"doc-biblioentry\" property=\"schema:citation\" id=\"desc-" + str(x) + "\">"+ "\n")
out.write("\t" + "<span property=\"schema:author\" typeof=\"schema:Person\">"+ "\n")
print("Just a sec, separating authors...")
authors = dictio['author']
def makeauthors(authors, out):
authors = authors.replace(" and ", "|")
liste = authors.split("|")
for i, a in enumerate(liste):
autlist = authors.split("|")
for i, a in enumerate(autlist):
try:
first = None
last = None
......@@ -140,13 +131,24 @@ def articleHTML(dictio, x, out):
name = last + ", " + first
# Wenn es der letzte Autor ist, kein Semikolon am Ende
if i == len(liste) - 1:
if i == len(autlist) - 1:
out.write("\t" + "\t" + "<span property=\"schema:Name\"> " + name + "</span>" + "\n")
else:
out.write("\t" + "\t" + "<span property=\"schema:Name\"> " + name + "</span>;"+ "\n")
out.write("\t" + "\t" + "<span property=\"schema:Name\"> " + name + "</span>,"+ "\n")
except Exception as e:
print(f"An unexpected error occurred: {e} see " + a)
def articleHTML(dictio, x, out):
print("Writing html code for article "+ str(x) + "...")
out.write("{/*<!-- Citation num " + str(x) + "--> */}" + "\n")
out.write("<li typeof=\"schema:ScolarlyArticle\" role=\"doc-biblioentry\" property=\"schema:citation\" id=\"desc-" + str(x) + "\">"+ "\n")
out.write("\t" + "<span property=\"schema:author\" typeof=\"schema:Person\">"+ "\n")
print("Just a sec, separating authors...")
authors = dictio['author']
makeauthors(authors, out)
out.write("\t" +"</span>"+ "\n")
title = dictio['title'].replace('{', '').replace('}', '')
......@@ -179,7 +181,7 @@ def articleHTML(dictio, x, out):
year = dictio['year']
out.write("\t" +"(<time property=\"schema:datePublished\" datatype=\"xsd:gYear\" dateTime=\" " + year + "\">"+year+"</time>)."+ "\n")
out.write("\t" +"&nbsp;(<time property=\"schema:datePublished\" datatype=\"xsd:gYear\" dateTime=\" " + year + "\">"+year+"</time>)."+ "\n")
try:
doi = dictio['doi']
......@@ -208,10 +210,12 @@ def miscHTML(dictio, x, out):
def bookHTML(dictio, x, out):
print("Writing html code for entry "+ str(x) + "...")
out.write("{/*<!-- Citation num " + str(x) + "--> */}" + "\n")
out.write("<li typeof=\"schema:WebPage\" role=\"doc-biblioentry\" property=\"schema:citation\" id=\"desc-" + str(x) + "\">"+ "\n")
out.write("<li typeof=\"schema:Book\" role=\"doc-biblioentry\" property=\"schema:citation\" id=\"desc-" + str(x) + "\">"+ "\n")
out.write("\t" + "<span property=\"schema:author\" typeof=\"schema:Organisation\">"+ "\n")
aut = dictio['author']
out.write("\t" + "\t" +"<span property=\"schema:Name\"> " + aut + "</span>."+ "\n")
print("Just a sec, separating authors...")
authors = dictio['author']
makeauthors(authors, out)
# out.write("\t" + "\t" +"<span property=\"schema:Name\"> " + aut + "</span>."+ "\n")
out.write("\t" +"</span>"+ "\n")
if 'title' in dictio:
out.write("\t" + "<span property=\"schema:name\">&nbsp;"+dictio['title']+ ".</span>"+ "\n")
......@@ -227,4 +231,5 @@ def bookHTML(dictio, x, out):
out.write("</li>" + "\n"+ "\n")
main()
\ No newline at end of file
main()
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment