Formating and linking of short citation.

This commit is contained in:
Homer S. 2022-01-21 13:35:51 +01:00
parent 45816ce2ef
commit 3c0221ebf7
1 changed files with 12 additions and 5 deletions

View File

@ -24,17 +24,23 @@ class CitationPlugin(Plugin):
def citation_entry(self, id):
return self.bib_data.entries[id]
def citation_short_output(self, id, link="?"):
def citation_short_output(self, id, link=None):
e = self.citation_entry(id)
link = link+"#"+id
if "url" in e.fields.keys() and len(e.fields['url']) > 0:
link = e.fields['url']
else:
link = "?"
authors = ""
lAuthor = e.persons['author']
n = 1
for author in lAuthor:
if len(author.prelast_names) > 0:
authors += str(author.prelast_names)
prelast = author.prelast_names
if len(prelast) > 0:
for item in prelast:
authors += "{i} ".format(i = str(item))
authors += str(author.last_names[0])
if len(lAuthor) > 1:
if n == (len(lAuthor) - 1):
@ -48,6 +54,7 @@ class CitationPlugin(Plugin):
year = e.fields['year']
edition = ""
if 'edition' in e.fields.keys():
edition = e.fields['edition']
edition = " ({ed}. Aufl.)".format(ed = edition)
else:
edition = ""