Commit 5a79812d authored by Pierre-Antoine Champin's avatar Pierre-Antoine Champin

proposed resolution to #16

parent d5737e53
......@@ -3,7 +3,6 @@ import itertools
from xciterst.util import html2rst
import xciterst
from xciterst.parser import CiteParser
from docutils.parsers.rst import roles
import sys
def check_citeproc():
......@@ -68,5 +67,3 @@ citeproc = None
citekeymap = None
class smallcaps(docutils.nodes.Inline, docutils.nodes.TextElement): pass
roles.register_local_role("smallcaps", smallcaps)
......@@ -131,5 +131,3 @@ class CitationSecondTransform(docutils.transforms.Transform):
cite_cluster = self.startnode.details['cite_cluster']
newnode = xciterst.citeproc.get_citation(cite_cluster)
self.startnode.replace_self(newnode)
docutils.parsers.rst.directives.register_directive('bibliography', BibliographyDirective)
"""
This module must be explicitly imported
in order to register docutils directives and roles,
unless this registration is done otherwise (e.g. Sphinx extension).
"""
from docutils.parsers.rst import directives, roles
from . import smallcaps
from .directives import BibliographyDirective
from .roles import cite_role
roles.register_local_role("smallcaps", smallcaps)
directives.register_directive('bibliography', BibliographyDirective)
roles.register_canonical_role('xcite', cite_role)
......@@ -63,5 +63,3 @@ def cite_role(role, rawtext, text, lineno, inliner,
nodeset.append(docutils.nodes.Text(" ", rawsource=" "))
nodeset.append(handle_cite_cluster(inliner, second_cluster))
return nodeset, []
docutils.parsers.rst.roles.register_canonical_role('xcite', cite_role)
......@@ -86,4 +86,3 @@ class ZoteroSetupDirective(docutils.parsers.rst.Directive):
self.state_machine.document.note_pending(pending)
return [pending]
docutils.parsers.rst.directives.register_directive('zotero-setup', ZoteroSetupDirective)
"""
This module must be explicitly imported
in order to register docutils directives and roles,
unless this registration is done otherwise (e.g. Sphinx extension).
"""
import xciterst.register
from docutils.parsers.rst import directives, roles
from . import ZoteroSetupDirective
directives.register_directive('zotero-setup', ZoteroSetupDirective)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment