From e2aaa2860997606104da865dfaff58f5ce2dfd65 Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Tue, 16 Jan 2018 22:08:06 -0500 Subject: [PATCH] Don't require numfig to use :numref: on sections Tweak logic that rejects a :numref: if numfig is not on to bypass this check if the reference is a section. Section numbers are applied independent of numfig, so the check is not needed, and makes it needlessly difficult to use :numref: if the user only cares about using it on sections. --- sphinx/domains/std.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py index bfaa57c4f..686945321 100644 --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -715,15 +715,15 @@ class StandardDomain(Domain): if not docname: return None - if env.config.numfig is False: - logger.warning('numfig is disabled. :numref: is ignored.', location=node) - return contnode - target_node = env.get_doctree(docname).ids.get(labelid) figtype = self.get_figtype(target_node) if figtype is None: return None + if figtype != 'section' and env.config.numfig is False: + logger.warning('numfig is disabled. :numref: is ignored.', location=node) + return contnode + try: fignumber = self.get_fignumber(env, builder, figtype, docname, target_node) if fignumber is None: