diff options
author | Latosha Maltba <79100569+latosha-maltba@users.noreply.github.com> | 2021-09-21 09:19:54 +0000 |
---|---|---|
committer | Latosha Maltba <79100569+latosha-maltba@users.noreply.github.com> | 2021-09-21 09:19:54 +0000 |
commit | 3b4655310ff2e7521cd9fc73385510cba60512f3 (patch) | |
tree | 63d974c643bf2eafdf3cf46661d8095cac7bd980 /sphinx/directives/code.py | |
parent | cf9b5b5be978355e518a1a8d506fbd967baecb54 (diff) | |
download | sphinx-git-3b4655310ff2e7521cd9fc73385510cba60512f3.tar.gz |
code-block: Handle ``0`` as numeric argument in :dedent:
Due to how Python converts ints to bool the numeric argument ``0`` to
the :dedent: option of the code-block directive was handled like if no
argument was given to :dedent:.
Check properly for None in the options argument processing, so ``0`` is
treated as numeric argument to :dedent:.
Bug: #9636
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r-- | sphinx/directives/code.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index 12ab51c58..5859f359a 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -57,7 +57,7 @@ class Highlight(SphinxDirective): def dedent_lines(lines: List[str], dedent: int, location: Tuple[str, int] = None) -> List[str]: - if not dedent: + if dedent is None: return textwrap.dedent(''.join(lines)).splitlines(True) if any(s[:dedent].strip() for s in lines): |