Skip to main content

This Plugin should extend lektor with APA-styled citations using bibtex files. It was based on the known lektor-bibtex-support plugin by arunpersaud.

Project description

lektor-citation

An APA-styled citation plugin for the lektor static content management system (https://getlektor.com).

Preparations

Install the plugin by

lektor plugin add lektor-citation

or by copying this repository into the packages-folder of your lektor-project.

Create an citation.ini in its configs-folder:

[Bibtex]
file = Literature.bib

[default]
priority = url
link = /for-example/link-to-your/biblioprahy

And put a Literature.bib BibTex-file into the project's assets-folder respectively.

Jinja_env

Bibliography

To get a formated output of your whole BibTex library you can either

  1. Use method citation_short_output in the template of your literature page. It creates an unordered list of entries.
  <ul id="literatur">
  {% for entry in citation_entries() %}
  {{ citation_short_output(entry)|decode|safe }}
  {% endfor %}

</ul>
  1. Use method citation_full_output instead. This creates a more complete html-output for every entry.
  {% for entry in citation_entries() %}
  {{ citation_full_output(entry)|decode|safe }}
  {% endfor %}

produces

<h2>{title}</h2><h3>{authors} ({pubYear})</h3>
<p>{note}</p>
<dl class="literature">
<dt class="edition"></dt>
<dd>{edition}</dd>
<dt class="editors"></dt>
<dd>{editors}</dd>
<dt class="pages"></dt>
<dd>{pages}</dd>
<dt class="issbn"></dt>
<dd>{issbn}</dd>
<dt class="publisher"></dt>
<dd>{publisher}</dd>
</dl>
  1. You may also use the citation_entry method in combination with pybtex*s Entry-class. For example:
<ul>
  {% for entry in citation_entries() %}
<li>{{ citation_entry(entry).fields['title'] |decode }}</li>
  {% endfor %}
  </ul>

This creates an unordered list of all the titles of your bibtex file. Of course you can also use citation_entry without a loop and put any id of your bibtex entries into it as parameter.

Alternatively to the pybtex methods you can use the following jinja_env globals:

citation_authors_short(entry)
citation_authors_full(entry)
citation_editors_short(entry)
citation_editors_full(entry)
citation_pubYear(entry)
citation_edition(entry)
citation_publisher(entry)
citation_title(entry)
citation_url(entry)
citation_issbn(entry)
citation_pages(entry)
citation_note(entry)

In-text Cites

To cite a certain entry in your texts you can use the jinja_env globals:

citation_full_cite(id, link="")
citation_full_citeNP(id, link="")

Both methods create a complete hyperlink inside your text for the entry with id. You may give it any url to the link parameter to e.g. link it to your bibliography page. The NP in the second stands for No Parantheses. So you'll receive e.g.

AuthorI & AuthorII (2019)

or

(AuthorI & AuthorII, 2019)

link parameter

Which url is used for your citation's link depends on what you set in the citation.ini file.

  • If you set priority in the default section to url the link is set to the value of the url field of the entry.
  • If there's no value in it the default-link you may set with link in the same section is used.
  • If you set the link parameter of the function it overwrites the former options.

Thanks to the lektor-jinja-content plugin which is a dependency of this plugin you might also use the globals inside your markdown or html contents, too.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lektor-citation-0.21.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lektor_citation-0.21-py2.py3-none-any.whl (16.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file lektor-citation-0.21.tar.gz.

File metadata

  • Download URL: lektor-citation-0.21.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for lektor-citation-0.21.tar.gz
Algorithm Hash digest
SHA256 703d941f32be8de4e85bdd1647f4758b36296b97adaa55f42d197da569b0fe87
MD5 4a36dc66dc97c2e910799846621600ef
BLAKE2b-256 ff7393fca3ab7700ca10b7f4ee8f09370170379e20ea3486ee48778b51457028

See more details on using hashes here.

File details

Details for the file lektor_citation-0.21-py2.py3-none-any.whl.

File metadata

  • Download URL: lektor_citation-0.21-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for lektor_citation-0.21-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0064543acac41e1e5650eacd0929d10450d61f282702164f9e2565cf09406060
MD5 8e3f09d3f4c048a004c3ab013a66ae75
BLAKE2b-256 a232461e524d2a33aa66da5b4b3ac0651ab6e3b84ac6b4cb32d392616abbeb7e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page