diff options
author | Chris Johns <chrisj@rtems.org> | 2017-08-09 20:19:22 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2017-08-09 20:19:22 +1000 |
commit | 58de62d8beb931995ec8bf2677f1714dfa004719 (patch) | |
tree | b0fcd040cdcfc426697b590bdee4e082276e2215 /common/sphinxcontrib/bibtex/roles.py | |
parent | Add the sphinxcontrib.bibtex extension to the repo. (diff) | |
download | rtems-docs-58de62d8beb931995ec8bf2677f1714dfa004719.tar.bz2 |
Revert "Add the sphinxcontrib.bibtex extension to the repo."
This reverts commit aa4f8e2e436d6c49e1524a4a3fb164b28632d894.
The contrib has too many dependencies to add into the repo.
Diffstat (limited to 'common/sphinxcontrib/bibtex/roles.py')
-rw-r--r-- | common/sphinxcontrib/bibtex/roles.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/common/sphinxcontrib/bibtex/roles.py b/common/sphinxcontrib/bibtex/roles.py deleted file mode 100644 index bbbd1f0..0000000 --- a/common/sphinxcontrib/bibtex/roles.py +++ /dev/null @@ -1,43 +0,0 @@ -""" - New Doctree Roles - ~~~~~~~~~~~~~~~~~ - - .. autoclass:: CiteRole - :show-inheritance: - - .. automethod:: result_nodes -""" - -from pybtex.plugin import find_plugin -import pybtex.database -from sphinx.roles import XRefRole # for :cite: - - -class CiteRole(XRefRole): - - """Class for processing the :rst:role:`cite` role.""" - backend = find_plugin('pybtex.backends', 'docutils')() - - def result_nodes(self, document, env, node, is_ref): - """Transform reference node into a citation reference, - and note that the reference was cited. - """ - keys = node['reftarget'].split(',') - # Note that at this point, usually, env.bibtex_cache.bibfiles - # is still empty because the bibliography directive may not - # have been processed yet, so we cannot get the actual entry. - # Instead, we simply fake an entry with the desired key, and - # fix the label at doctree-resolved time. This happens in - # process_citation_references. - refnodes = [ - self.backend.citation_reference(_fake_entry(key), document) - for key in keys] - for key in keys: - env.bibtex_cache.add_cited(key, env.docname) - return refnodes, [] - - -def _fake_entry(key): - entry = pybtex.database.Entry(type_="") - entry.key = key - return entry |