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

cit

parent 7cf3f06b
No related branches found
No related tags found
No related merge requests found
Pipeline #445556 failed
......@@ -100,11 +100,15 @@ def main():
def makeauthors(authors, out):
authors = authors.replace(" and ", "|")
autlist = authors.split("|")
# Maximale Anzahl der anzuzeigenden Autoren
max_authors = 6
for i, a in enumerate(autlist):
try:
try:
first = None
last = None
name = None
if ',' in a:
s = a.split(", ")
if len(s) > 1:
......@@ -122,22 +126,24 @@ def makeauthors(authors, out):
first = s[0]
first_sh = first[0]
last = s[1]
name = last + ", " + first_sh + "."
else:
name = last + ", " + first_sh + "."
else:
# Falls es mehrere Vornamen gibt, sie in Initialen umwandeln
leng = len(s)
last = s[leng-1]
first = '. '.join([n[0] for n in s[:-1]]) + '.' # Nur Initialen der Vornamen
name = last + ", " + first
# Wenn es der letzte Autor ist, kein Semikolon am Ende
if i == len(autlist) - 1:
# Schreibe den Namen in die Ausgabedatei
if i < max_authors:
out.write("\t" + "\t" + "<span property=\"schema:Name\"> " + name + "</span>" + "\n")
else:
out.write("\t" + "\t" + "<span property=\"schema:Name\"> " + name + "</span>,"+ "\n")
# Wenn wir mehr als 6 Autoren haben, schreibe "et al." nach dem 6. Autor
if i == max_authors:
out.write("\t" + "\t" + "<span property=\"schema:Name\"> et al.</span>" + "\n")
break # Stoppe die Schleife, nachdem "et al." hinzugefügt wurde
except Exception as e:
print(f"An unexpected error occurred: {e} see " + a)
def articleHTML(dictio, x, out):
......@@ -164,10 +170,10 @@ def articleHTML(dictio, x, out):
pag = re.split('--|-|–', pages)
begin = pag[0].strip()
end = pag[1].strip()
out.write("\t" + "<span property=\"schema:pageBegin\"> "+ begin +"</span>-<span property=\"schema:pageEnd\">"+ end + "</span>"+ "\n")
out.write("\t" + "<span property=\"schema:pageBegin\"> "+ begin +"</span>-<span property=\"schema:pageEnd\">"+ end + "</span>&nbsp;"+ "\n")
else:
if re.match(r'^\d+(-\d+)?$', pages): # Check for typical numeric page ranges
out.write("\t" + "<span property=\"schema:pageBegin\">"+ pages +"</span>"+ "\n")
out.write("\t" + "<span property=\"schema:pageBegin\">"+ pages +"</span>&nbsp;"+ "\n")
else:
# Seitenangabe ist nicht numerisch, als fehlend behandeln
print(f"Non-numeric page information detected ('{pages}'). Treating as missing.")
......@@ -181,7 +187,7 @@ def articleHTML(dictio, x, out):
year = dictio['year']
out.write("\t" +"&nbsp;(<time property=\"schema:datePublished\" datatype=\"xsd:gYear\" dateTime=\" " + year + "\">"+year+"</time>)."+ "\n")
out.write("\t" +"(<time property=\"schema:datePublished\" datatype=\"xsd:gYear\" dateTime=\" " + year + "\">"+year+"</time>)."+ "\n")
try:
doi = dictio['doi']
......
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