diff --git a/sphinx/directives.py b/sphinx/directives.py index 890b3da14..8df7e9b6b 100644 --- a/sphinx/directives.py +++ b/sphinx/directives.py @@ -299,8 +299,20 @@ def desc_directive(desctype, arguments, options, content, lineno, name = parse_c_signature(signode, sig, desctype) elif desctype == 'opcode': name = parse_opcode_signature(signode, sig, desctype) + elif desctype == 'cmdoption': + # TODO: add custom parsing for parts? + signode.clear() + signode += addnodes.desc_name(sig, sig) + if not noindex: + targetname = 'cmdoption-%s' % env.index_num + env.index_num += 1 + signode['ids'].append(targetname) + state.document.note_explicit_target(signode) + env.note_index_entry('pair', 'command line option; %s' % sig, + targetname, targetname) + continue else: - # describe: use generic fallback + # for "describe": use generic fallback raise ValueError except ValueError, err: signode.clear() @@ -364,7 +376,8 @@ desctypes = [ 'cvar', # the odd one 'opcode', - # the generic one + # the generic ones + 'cmdoption', # for command line options 'describe', ] diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py index a91b8f15d..6b77fcb77 100644 --- a/sphinx/highlighting.py +++ b/sphinx/highlighting.py @@ -22,7 +22,7 @@ try: from pygments.filters import ErrorToken from pygments.style import Style from pygments.styles.friendly import FriendlyStyle - from pygments.token import Generic, Comment + from pygments.token import Generic, Comment, Number except ImportError: pygments = None else: @@ -38,6 +38,7 @@ else: styles.update({ Generic.Output: 'italic #333', Comment: 'italic #408090', + Number: '#208050', }) lexers = defaultdict(TextLexer,