summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
Commit message (Collapse)AuthorAgeFilesLines
* Resolve ``flake8-return`` errorsAdam Turner2023-02-181-9/+7
|
* Fix COM812Adam Turner2023-02-181-10/+10
|
* Run pyupgrade (#11070)Adam Turner2023-01-021-1/+1
|
* Use PEP 604 typesAdam Turner2023-01-011-12/+12
|
* Use PEP 595 typesAdam Turner2023-01-011-26/+26
|
* Insert ``from __future__ import annotations``Adam Turner2023-01-011-0/+2
|
* remove blanket 'noqas'Daniel Eades2022-12-161-1/+3
|
* Fix more strict static typing errors (#10681)danieleades2022-08-281-1/+1
|
* Improve static typing strictness (#10569)danieleades2022-07-181-13/+31
|
* Fix #10318: literalinclude: :prepend: option working with :dedent:Takeshi KOMIYA2022-04-021-2/+2
| | | | | It will always be warned because prepending is processed before dedenting. This changes the order of processing options.
* Remove copyright and licence fieldsAdam Turner2022-02-201-5/+0
|
* Fix module docstring indentationAdam Turner2022-02-201-2/+2
|
* Remove module titles in docstringsAdam Turner2022-02-191-3/+0
|
* 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
| |