Added links to cite methods. (Issue #1)
This commit is contained in:
parent
ed616698a8
commit
af095b8d32
|
@ -15,6 +15,8 @@ class CitationPlugin(Plugin):
|
|||
|
||||
config = self.get_config()
|
||||
self.bibfile = config.get('Bibtex.file', []).strip()
|
||||
self.default_prio = config.get('default.priority', []).strip()
|
||||
self.default_link = config.get('default.link', []).strip()
|
||||
|
||||
self.bib_data = parse_file(os.path.join(env.root_path, 'assets', self.bibfile))
|
||||
|
||||
|
@ -223,18 +225,29 @@ class CitationPlugin(Plugin):
|
|||
""".format(eid = id, link = link, authors = authors, pubYear = year, title = title, edition = edition, publisher = publisher, editors = editors, pages = pages, issbn = issbn, note = note)
|
||||
return output
|
||||
|
||||
def citation_full_cite(self,id,link=""):
|
||||
def citation_base_cite(self,id,link="",output=""):
|
||||
e = self.citation_entry(id)
|
||||
|
||||
if len(link) > 1:
|
||||
link = link
|
||||
elif self.default_prio == "url":
|
||||
link = self.get_url(e)
|
||||
if len(link) < 2:
|
||||
link = self.default_link
|
||||
else:
|
||||
link = self.default_link
|
||||
|
||||
authors = self.get_authors_short(e)
|
||||
year = self.get_pubYear(e)
|
||||
output = """<a href=\"{link}#{id}\" class=\"litref\">({authors}, {pubYear})</a>""".format(link = link, id = id, authors = authors, pubYear = year)
|
||||
output = output.format(link = link, id = id, authors = authors, pubYear = year)
|
||||
return output
|
||||
|
||||
def citation_full_cite(self,id,link=""):
|
||||
output = self.citation_base_cite(id,link="",output="""<a href=\"{link}#{id}\" class=\"litref\">({authors}, {pubYear})</a>""")
|
||||
return output
|
||||
|
||||
def citation_full_citeNP(self,id,link=""):
|
||||
e = self.citation_entry(id)
|
||||
authors = self.get_authors_short(e)
|
||||
year = self.get_pubYear(e)
|
||||
output = """<a href=\"{link}#{id}\" class=\"litref\">{authors} ({pubYear})</a>""".format(link = link, id = id, authors = authors, pubYear = year)
|
||||
output = self.citation_base_cite(id,link="",output="""<a href=\"{link}#{id}\" class=\"litref\">{authors} ({pubYear})</a>""")
|
||||
return output
|
||||
|
||||
def on_setup_env(self, **extra):
|
||||
|
|
Loading…
Reference in New Issue