summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
Commit message (Collapse)AuthorAgeFilesLines
* code-block: Pass list of strings ends with CR code to dedent_lines()Takeshi KOMIYA2022-01-151-3/+3
|
* Merge branch '4.x' into HEADTakeshi KOMIYA2022-01-151-1/+1
|\
| * A happy new year!Takeshi KOMIYA2022-01-011-1/+1
| |
* | Fix: 9636: code-block: Do not remove newlines with :dedent:Latosha Maltba2021-09-211-1/+1
| | | | | | | | | | | | | | If the option :dedent: (without numeric argument) was given to code-block then all newlines where striped from the resulting code. Preserve newlines when stripping common whitespace at the beginning of code blocks.
* | code-block: Handle ``0`` as numeric argument in :dedent:Latosha Maltba2021-09-211-1/+1
|/ | | | | | | | | | | 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
* refactor: Use PEP-526 based variable annotation (sphinx.directives)Takeshi KOMIYA2021-03-231-2/+2
|
* refactor: Add a type alias for the option_spec of directives; OptionSpecTakeshi KOMIYA2021-03-131-3/+4
|
* Merge branch '3.x'Takeshi KOMIYA2021-01-161-3/+5
|\
| * Fix #2030: automatic dedent support in code-block directiveTakeshi KOMIYA2021-01-131-3/+5
| |
* | Merge branch '3.x'Takeshi KOMIYA2021-01-011-1/+1
|\ \ | |/
| * A happy new year!Takeshi KOMIYA2021-01-011-1/+1
| | | | | | | | | | | | | | .. note:: $ find sphinx tests LICENSE doc/conf.py -type f -exec sed -i '' -e 's/2007\-20../2007-2021/' {} \; $ git co sphinx/locale/**/*.js sphinx/templates/epub3/mimetype
* | Do isortTakeshi KOMIYA2020-11-121-2/+1
| |
* | Merge branch '3.x'Takeshi KOMIYA2020-11-121-2/+1
|\ \ | |/
| * Sort imports with isortFrançois Freitag2020-11-111-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | Keep imports alphabetically sorted and their order homogeneous across Python source files. The isort project has more feature and is more active than the flake8-import-order plugin. Most issues caught were simply import ordering from the same module. Where imports were purposefully placed out of order, tag with isort:skip.
* | Merge branch '3.x' into masterTakeshi KOMIYA2020-09-131-1/+1
|\ \ | |/
| * Fix #8163: Update warning message for :dedent: optionTakeshi KOMIYA2020-09-051-1/+1
| |
* | Merge commit '05c65163ecd0ce7bdb7c6807de683266b98e5b28'Takeshi KOMIYA2020-07-051-4/+5
|\ \ | |/
| * Fix exception causes in code.pyRam Rachum2020-06-121-4/+5
| |
* | Remove deprecated features marked as RemovedInSphinx40WarningTakeshi KOMIYA2020-04-291-13/+0
| |
* | Hello TYPE_CHECKING!Takeshi KOMIYA2020-03-071-2/+2
|/
* A happy new year!Takeshi KOMIYA2020-01-011-1/+1
|
* Fix #6742: end-before option of literalinclude skips first lineTakeshi KOMIYA2019-10-281-1/+1
|
* Migrate to py3 style type annotation: sphinx.directives.codeTakeshi KOMIYA2019-06-081-43/+25
|
* Add :force: option to code directivesTakeshi KOMIYA2019-06-011-3/+9
|
* Add a helper method ``SphinxDirective.set_source_info()``Takeshi KOMIYA2019-03-031-3/+2
|
* directive-code: do not force linenos value on runJames Knight2019-02-161-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that `highlightlang` directive is deprecated [1], the `linenothreshold` option is to be used via the `highlight` directive. The `highlight` directive will walk-through literal blocks to apply a `linenos` value if: 1) The literal block has not been explicitly configured with the `linenos` option. 2) If there is enough content (when comparing literal block's line count to `linenothreshold`) that `linenos` should be explicitly enabled or disabled [2]. While the `hightlight` directive should be able to explicitly define if a literal block needs to enable line numbers, the logic is always ignored since the code block and literal include directives already configures `linenos` when checking for line number-specific options on the node [3][4]. This effectively prevents `linenothreshold` from being used. To allow `linenothreshold` to be used in literal blocks, this commit disables the explicit configuration `linenos` on a literal block instance when the `CodeBlock` and `LiteralInclude` directives are processed. [1]: b35198d8475fe89aaf9a5224a9832fb394e73cca [2]: https://github.com/sphinx-doc/sphinx/blob/v1.8.1/sphinx/transforms/post_transforms/code.py#L95-L97 [3]: https://github.com/sphinx-doc/sphinx/blob/v1.8.1/sphinx/directives/code.py#L156-L157 [4]: https://github.com/sphinx-doc/sphinx/blob/v1.8.1/sphinx/directives/code.py#L442-L444 Signed-off-by: James Knight <james.d.knight@live.com>
* Close #1851: Allow to omit an argument for code-block directiveTakeshi KOMIYA2019-02-041-5/+17
|
* Merge branch '1.8'Takeshi KOMIYA2019-01-021-1/+1
|\
| * A happy new year!Takeshi KOMIYA2019-01-021-1/+1
| |
* | Replace EnvironmentError and IOError by OSErrorTakeshi KOMIYA2018-12-191-2/+2
| | | | | | | | | | Since python 3.3, EnvironmentError and IOError were merged into OSError.
* | Fix annotations of code directivesTakeshi KOMIYA2018-12-181-11/+11
| |
* | Merge pull request #5819 from jdufresne/coding-commentTakeshi KOMIYA2018-12-171-1/+0
|\ \ | | | | | | Remove unnecessary encoding cookie from Python source files
| * | Remove unnecessary encoding cookie from Python source filesJon Dufresne2018-12-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Python 3, the default encoding of source files is utf-8. The encoding cookie is now unnecessary and redundant so remove it. For more details, see the docs: https://docs.python.org/3/howto/unicode.html#the-string-type > The default encoding for Python source code is UTF-8, so you can > simply include a Unicode character in a string literal ... Includes a fix for the flake8 header checks to stop expecting an encoding cookie.
* | | Pass exceptions directly to docutils reporterJon Dufresne2018-12-161-4/+3
|/ / | | | | | | | | The docutils reporter supports an exception as an argument. It is converted to a string internally.
* | refactor: Remove u-prefix from stringsTakeshi KOMIYA2018-12-161-1/+1
| |
* | Use Python 3 super() argument-less syntaxJon Dufresne2018-12-151-1/+1
| | | | | | | | | | | | The form is less verbose and more idiomatic for Python 3 only code. https://docs.python.org/3/library/functions.html#super
* | Replace all "unicode" type by "str"Takeshi KOMIYA2018-12-151-16/+15
| |
* | Move to py3 mode for mypy (and remove many "type: ignore" comments)Takeshi KOMIYA2018-12-151-2/+1
| |
* | Simplify open() call by removing default modeJon Dufresne2018-12-111-1/+1
| | | | | | | | | | | | | | | | | | The open() function opens files in read-only text mode by default. Drop the mode argument to be slightly simpler and more idiomatic. https://docs.python.org/3/library/functions.html#open > The default mode is 'r' (open for reading text, synonym of 'rt').
* | Use StringList for params to docutils because of expectedTakeshi KOMIYA2018-12-031-2/+2
| |
* | Fix annotations for Directives (Replace N_co with nodes.Node)Takeshi KOMIYA2018-12-011-5/+5
| |
* | Fix annotations for directivesTakeshi KOMIYA2018-11-291-14/+17
| |
* | refactor: Use super() to call methods of superclassTakeshi KOMIYA2018-11-281-1/+1
| |
* | Add sphinx.util.typing:unicode to help mypy-3 migrationTakeshi KOMIYA2018-11-241-0/+1
| |
* | Merge branch '1.8'Takeshi KOMIYA2018-11-011-1/+1
|\ \ | |/
| * Fix #5471: Show appropriate warning for deprecated APIsTakeshi KOMIYA2018-10-171-1/+1
| |
* | Merge branch 'master' into HEADTakeshi KOMIYA2018-09-221-2/+2
|\ \
| * | Prefer builtin open() over io.open() and codecs.open()Jon Dufresne2018-09-111-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | In Python3, the functions io.open() is an alias of the builtin open() and codecs.open() is functionally equivalent. To reduce indirection, number of imports, and number of patterns, always prefer the builtin. https://docs.python.org/3/library/io.html#high-level-module-interface > io.open() > > This is an alias for the builtin open() function.
* | Remove unnecessary object from class definitionsJon Dufresne2018-09-111-1/+1
|/ | | | | In Python 3, all classes are new-style classes. The object in the definition is redundant and unnecessary.
* Merge branch '1.7'Takeshi KOMIYA2018-06-091-1/+1
|\