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): def citation_entry(self, id):
return self.bib_data.entries[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) 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 = "" authors = ""
lAuthor = e.persons['author'] lAuthor = e.persons['author']
n = 1 n = 1
for author in lAuthor: for author in lAuthor:
if len(author.prelast_names) > 0: prelast = author.prelast_names
authors += str(author.prelast_names) if len(prelast) > 0:
for item in prelast:
authors += "{i} ".format(i = str(item))
authors += str(author.last_names[0]) authors += str(author.last_names[0])
if len(lAuthor) > 1: if len(lAuthor) > 1:
if n == (len(lAuthor) - 1): if n == (len(lAuthor) - 1):
@ -48,6 +54,7 @@ class CitationPlugin(Plugin):
year = e.fields['year'] year = e.fields['year']
edition = "" edition = ""
if 'edition' in e.fields.keys(): if 'edition' in e.fields.keys():
edition = e.fields['edition']
edition = " ({ed}. Aufl.)".format(ed = edition) edition = " ({ed}. Aufl.)".format(ed = edition)
else: else:
edition = "" edition = ""