diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-12-14 02:02:29 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-12-14 02:02:29 +0900 |
commit | 2c98e909bf1a6de5f689aeca908e8ccc73f181ac (patch) | |
tree | 43752eff923aac12cd786424c1f5bb7725080143 /sphinx/domains/std.py | |
parent | 0b074c9e48dbc00137c2e94769bbe6e4685199c6 (diff) | |
parent | 5b28d77b376cad5d93942743ea1d18098b459948 (diff) | |
download | sphinx-git-2c98e909bf1a6de5f689aeca908e8ccc73f181ac.tar.gz |
Merge branch '3.x'
Diffstat (limited to 'sphinx/domains/std.py')
-rw-r--r-- | sphinx/domains/std.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py index eac5977e5..67eb3a26f 100644 --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -41,7 +41,7 @@ logger = logging.getLogger(__name__) # RE for option descriptions -option_desc_re = re.compile(r'((?:/|--|-|\+)?[^\s=[]+)(=?\s*.*)') +option_desc_re = re.compile(r'((?:/|--|-|\+)?[^\s=]+)(=?\s*.*)') # RE for grammar tokens token_re = re.compile(r'`(\w+)`', re.U) @@ -195,6 +195,11 @@ class Cmdoption(ObjectDescription): location=signode) continue optname, args = m.groups() + if optname.endswith('[') and args.endswith(']'): + # optional value surrounded by brackets (ex. foo[=bar]) + optname = optname[:-1] + args = '[' + args + if count: signode += addnodes.desc_addname(', ', ', ') signode += addnodes.desc_name(optname, optname) @@ -832,8 +837,9 @@ class StandardDomain(Domain): if fignumber is None: return contnode except ValueError: - logger.warning(__("no number is assigned for %s: %s"), figtype, labelid, - location=node) + logger.warning(__("Failed to create a cross reference. Any number is not " + "assigned: %s"), + labelid, location=node) return contnode try: @@ -1074,7 +1080,7 @@ class StandardDomain(Domain): def warn_missing_reference(app: "Sphinx", domain: Domain, node: pending_xref) -> bool: - if domain.name != 'std' or node['reftype'] != 'ref': + if (domain and domain.name != 'std') or node['reftype'] != 'ref': return None else: target = node['reftarget'] |