Extended the plugin with the lektor-jinja-content plugin, too in-text citation methods and a tidied code structure.

This commit is contained in:
2022-01-25 00:24:48 +01:00
parent 06b23ff2d6
commit e49b40d33c
3 changed files with 184 additions and 83 deletions

View File

@@ -21,6 +21,7 @@ And put a _Literature.bib_ BibTex-file into the project's _assets_-folder respec
## 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.
```
@@ -66,7 +67,32 @@ produces
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.
## Limitations
It would be awesome if one could use s.th. like a _cite(id)_-function in the entire project to automatically convert it to proper links to the literature list.
Like e.g. ```<a href="/myproject/literature/#Stahl2015" class="litref">Stahl (2015)</a>```
But as the only templates can make use of the functions this won't be possible for the markdown content of the page. Or maybe I just don't know how to implement this :shrug:
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)
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.