diff options
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r-- | sphinx/directives/code.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index 713e5ad0c..20ad5a20c 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -45,18 +45,12 @@ class Highlight(SphinxDirective): optional_arguments = 0 final_argument_whitespace = False option_spec = { - 'linenothreshold': directives.unchanged, + 'linenothreshold': directives.positive_int, } def run(self): # type: () -> List[nodes.Node] - if 'linenothreshold' in self.options: - try: - linenothreshold = int(self.options['linenothreshold']) - except Exception: - linenothreshold = 10 - else: - linenothreshold = sys.maxsize + linenothreshold = self.options.get('linenothreshold', sys.maxsize) return [addnodes.highlightlang(lang=self.arguments[0].strip(), linenothreshold=linenothreshold)] |