Skip to content

Commit

Permalink
Sphinx-3 compatibility.
Browse files Browse the repository at this point in the history
This is likely to break in the future, since it uses internal APIs.

Fixes #19.
  • Loading branch information
jcarrano committed Aug 24, 2020
1 parent f43b818 commit 7018717
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 12 additions & 2 deletions antidox/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from docutils import nodes as _nodes
from docutils.parsers.rst import directives, DirectiveError
from sphinx import addnodes
from sphinx.domains.c import Symbol, ASTDeclaration, ASTIdentifier

__author__ = "Juan I Carrano"
__copyright__ = "Copyright 2018, Freie Universität Berlin"
Expand Down Expand Up @@ -102,6 +103,10 @@ class UserContent(DeferredPlaceholder):
_name = "usercontent"


class NoDecl:
function_params = None


class Index(PlaceHolder, _nodes.Inline, _nodes.TextElement):
"""Add a cross-referenceable index entry to the parent of this element.
"""
Expand Down Expand Up @@ -138,13 +143,18 @@ def replace_placeholder(self, lineno, state, state_machine):
env = state.document.settings.env

for domain, _, sref in (s.partition(".") for s in self.parent['ids']):
inv = env.domaindata[domain]['objects']
dom = env.get_domain(domain)
inv = dom.objects

if sref in inv:
state_machine.reporter.warning(
'duplicate %s object description of %s, ' % (domain, sref) +
'other instance in ' + env.doc2path(inv[sref][0]),
line=lineno) # FIXME
inv[sref] = (env.docname, self.guess_objtype())
typ = self.guess_objtype()
inv[sref] = (env.docname, sref, typ)

Symbol(dom.data['root_symbol'], ASTIdentifier(sref), ASTDeclaration(typ, typ, NoDecl()), env.docname)

return super().replace_placeholder(lineno, state, state_machine)

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def readme():
return f.read()

setup(name='antidox',
version='0.1.4',
version='0.2.0',
description='Sphinx extension to extract and insert Doxygen documentation.',
long_description=readme(),
long_description_content_type='text/x-rst',
Expand All @@ -30,7 +30,7 @@ def readme():
license='BSD',
packages=['antidox'],
install_requires=[
'sphinx',
'sphinx>=3.0,<4.0',
'lxml'
],
entry_points={
Expand Down

0 comments on commit 7018717

Please sign in to comment.