From 8d882e473769448e4685988db74cc8e1480564ac Mon Sep 17 00:00:00 2001 From: Fabio Utzig Date: Fri, 28 Aug 2020 15:40:15 -0300 Subject: [PATCH 1/4] domains: c: cpp: fix typos Signed-off-by: Fabio Utzig --- sphinx/domains/c.py | 2 +- sphinx/domains/cpp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py index d8ccc2e3d..7e153472e 100644 --- a/sphinx/domains/c.py +++ b/sphinx/domains/c.py @@ -1792,7 +1792,7 @@ class Symbol: if not declaration: if Symbol.debug_lookup: - Symbol.debug_print("no delcaration") + Symbol.debug_print("no declaration") Symbol.debug_indent -= 2 # good, just a scope creation # TODO: what if we have more than one symbol? diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index 92d578427..7b10f8166 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -4292,7 +4292,7 @@ class Symbol: if not declaration: if Symbol.debug_lookup: - Symbol.debug_print("no delcaration") + Symbol.debug_print("no declaration") Symbol.debug_indent -= 2 # good, just a scope creation # TODO: what if we have more than one symbol? From 8c4193027b6ed62c7eaf8c127f3b1b6fa8ca28a2 Mon Sep 17 00:00:00 2001 From: Fabio Utzig Date: Fri, 28 Aug 2020 15:39:06 -0300 Subject: [PATCH 2/4] domains: c: add missing intersphinx object types For intersphinx to be able to resolve references to C-Domain objects, it needs to have them declared in the obj_types dict. This is currently missing enum, enumerator, struct and union so those can't be referenced by an external project. This commit fixes the issue by adding them. Signed-off-by: Fabio Utzig --- sphinx/domains/c.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py index d8ccc2e3d..a7bebdcda 100644 --- a/sphinx/domains/c.py +++ b/sphinx/domains/c.py @@ -3607,6 +3607,10 @@ class CDomain(Domain): 'macro': ObjType(_('macro'), 'macro'), 'type': ObjType(_('type'), 'type'), 'var': ObjType(_('variable'), 'data'), + 'enum': ObjType(_('enum'), 'enum'), + 'enumerator': ObjType(_('enumerator'), 'enumerator'), + 'struct': ObjType(_('struct'), 'struct'), + 'union': ObjType(_('union'), 'union'), } directives = { From 59766c23513fe6a82deb04ba0cca10075d023fec Mon Sep 17 00:00:00 2001 From: Jakob Lykke Andersen Date: Sat, 12 Sep 2020 14:33:57 +0200 Subject: [PATCH 3/4] Update CHANGES after PR --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 5176d8372..ae9505742 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,10 @@ Features added Bugs fixed ---------- +* #8188: C, add missing items to internal object types dictionary, + e.g., preventing intersphinx from resolving them. + + Testing -------- From 85b24a2e88ea71edc728aff3b078d34c2f374f06 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 13 Sep 2020 09:16:32 +0900 Subject: [PATCH 4/4] Fix our test failed with pygments-2.7.0 Since pygments-2.7.0, it has changed the style of output HTML. That makes our test broken. This fixes it to pass with new pygments. --- tests/test_build_html.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_build_html.py b/tests/test_build_html.py index e949f1157..1efc6c14a 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -10,8 +10,10 @@ import os import re +from distutils.version import LooseVersion from itertools import cycle, chain +import pygments import pytest from html5lib import HTMLParser @@ -1591,4 +1593,8 @@ def test_html_codeblock_linenos_style_inline(app): app.build() content = (app.outdir / 'index.html').read_text() - assert '1 ' in content + pygments_version = tuple(LooseVersion(pygments.__version__).version) + if pygments_version > (2, 7): + assert '1' in content + else: + assert '1 ' in content