Compare commits
No commits in common. "00471acc839d208c8a5249d300a3ee5c4cbb636c" and "8880fc780b208c525072eea7541b2035fd68bcec" have entirely different histories.
00471acc83
...
8880fc780b
|
@ -1,3 +1,3 @@
|
||||||
# lektor-citation
|
# lektor-citation
|
||||||
|
|
||||||
An APA-style citation plugin for the lektor static content management system (https://getlektor.com).
|
An APA-style citation plugin for the lektor static content management system (https://getlektor.com).
|
|
@ -1,36 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import os
|
|
||||||
from pylatexenc.latex2text import LatexNodes2Text
|
|
||||||
from pybtex.database import parse_file
|
|
||||||
from lektor.pluginsystem import Plugin
|
|
||||||
|
|
||||||
|
|
||||||
class CitationPlugin(Plugin):
|
|
||||||
name = 'lektor-citation'
|
|
||||||
description = u'This Plugin should extend lektor with APA-style citations using bibtex files. It is based on the known lektor-bibtex-support plugin by arunpersaud.'
|
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, env, id):
|
|
||||||
super().__init__(env, id)
|
|
||||||
|
|
||||||
config = self.get_config()
|
|
||||||
self.bibfile = config.get('Bibtex.file', []).strip()
|
|
||||||
|
|
||||||
self.bib_data = parse_file(os.path.join(env.root_path, 'assets', self.bibfile))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def citation_entries(self):
|
|
||||||
return self.bib_data.entries
|
|
||||||
|
|
||||||
def citation_entry(self, id):
|
|
||||||
return self.bib_data.entries[id]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def on_setup_env(self, **extra):
|
|
||||||
|
|
||||||
self.env.jinja_env.globals['citation_entries'] = self.citation_entries
|
|
||||||
self.env.jinja_env.globals['citation_entry'] = self.citation_entry
|
|
||||||
|
|
||||||
|
|
39
setup.py
39
setup.py
|
@ -1,39 +0,0 @@
|
||||||
import ast
|
|
||||||
import io
|
|
||||||
import re
|
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
|
||||||
|
|
||||||
with io.open('README.md', 'rt', encoding="utf8") as f:
|
|
||||||
readme = f.read()
|
|
||||||
|
|
||||||
_description_re = re.compile(r'description\s+=\s+(?P<description>.*)')
|
|
||||||
|
|
||||||
with open('lektor_citation.py', 'rb') as f:
|
|
||||||
description = str(ast.literal_eval(_description_re.search(
|
|
||||||
f.read().decode('utf-8')).group(1)))
|
|
||||||
|
|
||||||
setup(
|
|
||||||
author='Homer S',
|
|
||||||
author_email='homer77@ismus.net',
|
|
||||||
description=description,
|
|
||||||
keywords='Lektor plugin',
|
|
||||||
license='MIT',
|
|
||||||
long_description=readme,
|
|
||||||
long_description_content_type='text/markdown',
|
|
||||||
name='lektor-citation',
|
|
||||||
packages=find_packages(),
|
|
||||||
py_modules=['lektor_citation'],
|
|
||||||
# url='[link to your repository]',
|
|
||||||
version='0.1',
|
|
||||||
classifiers=[
|
|
||||||
'Framework :: Lektor',
|
|
||||||
'Environment :: Plugins',
|
|
||||||
],
|
|
||||||
entry_points={
|
|
||||||
'lektor.plugins': [
|
|
||||||
'citation = lektor_citation:CitationPlugin',
|
|
||||||
]
|
|
||||||
},
|
|
||||||
install_requires=['pybtex','pylatexenc']
|
|
||||||
)
|
|
Loading…
Reference in New Issue