diff --git a/lektor_citation.py b/lektor_citation.py index 2697a58..51e1d85 100644 --- a/lektor_citation.py +++ b/lektor_citation.py @@ -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 = "" @@ -57,7 +64,7 @@ class CitationPlugin(Plugin): publisher = e.fields['publisher'] if 'address' in e.fields.keys(): location = e.fields['address'] - publisher = " {location}:{publisher}.".format(location = location, publisher = publisher) + publisher = " {location}: {publisher}.".format(location = location, publisher = publisher) elif publisher: publisher = " {publisher}.".format(publisher = publisher) else: