diff --git a/CHANGES b/CHANGES index e94fb7f30..904ff098c 100644 --- a/CHANGES +++ b/CHANGES @@ -13,6 +13,7 @@ Features added * #2245: Add ``latex_elements["passoptionstopackages"]`` option to call PassOptionsToPackages in early stage of preambles. * Add :confval:`suppress_warnings` to suppress arbitrary warning message (experimental) +* #2229: Fix no warning is given for unknown options Bugs fixed ---------- diff --git a/doc/config.rst b/doc/config.rst index 84da0cea3..41ec68ec8 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -222,6 +222,7 @@ General configuration * ref.ref * ref.numref * ref.keyword + * ref.option * ref.citation * ref.doc diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py index dc1a283bb..e5f9ab557 100644 --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -447,7 +447,7 @@ class StandardDomain(Domain): 'productionlist': ProductionList, } roles = { - 'option': OptionXRefRole(), + 'option': OptionXRefRole(warn_dangling=True), 'envvar': EnvVarXRefRole(), # links to tokens in grammar productions 'token': XRefRole(), @@ -485,6 +485,7 @@ class StandardDomain(Domain): 'the label must precede a section header)', 'numref': 'undefined label: %(target)s', 'keyword': 'unknown keyword: %(target)s', + 'option': 'unknown option: %(target)s', } enumerable_nodes = { # node_class -> (figtype, title_getter) diff --git a/tests/test_build_html.py b/tests/test_build_html.py index ab23ed084..b1181fbeb 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -40,6 +40,7 @@ HTML_WARNINGS = ENV_WARNINGS + """\ %(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*' %(root)s/markup.txt:271: WARNING: Could not lex literal_block as "c". Highlighting skipped. %(root)s/footnote.txt:60: WARNING: citation not found: missing +%(root)s/markup.txt:160: WARNING: unknown option: &option """ if PY3: diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index b71751266..73fa17275 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -24,6 +24,7 @@ from test_build_html import ENV_WARNINGS LATEX_WARNINGS = ENV_WARNINGS + """\ +%(root)s/markup.txt:160: WARNING: unknown option: &option %(root)s/footnote.txt:60: WARNING: citation not found: missing %(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*' %(root)s/markup.txt:271: WARNING: Could not lex literal_block as "c". Highlighting skipped. diff --git a/tests/test_build_texinfo.py b/tests/test_build_texinfo.py index 00f2b2232..1cf2232c4 100644 --- a/tests/test_build_texinfo.py +++ b/tests/test_build_texinfo.py @@ -23,6 +23,7 @@ from test_build_html import ENV_WARNINGS TEXINFO_WARNINGS = ENV_WARNINGS + """\ +%(root)s/markup.txt:160: WARNING: unknown option: &option %(root)s/footnote.txt:60: WARNING: citation not found: missing %(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*' %(root)s/images.txt:29: WARNING: no matching candidate for image URI u'svgimg.\\*'