summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix exception causes in code.pyRam Rachum2020-06-121-4/+5
|
* 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
|\
| * Fix mypy violationTakeshi KOMIYA2018-06-091-1/+1
| |
* | Fix #4927: Display a warning when invalid values are passed to ↵Takeshi KOMIYA2018-05-221-8/+2
| | | | | | | | linenothreshold option of highlight directive
* | Deprecate highlightlang directiveTakeshi KOMIYA2018-04-151-1/+14
| | | | | | | | highlightlang directive is not documented, and marked as old in v0.2.
* | Add SphinxDirective as a helperTakeshi KOMIYA2018-03-311-11/+10
| |
* | Merge branch '1.7'Takeshi KOMIYA2018-03-181-2/+2
|\ \ | |/
| * Revert "Use typing.TYPE_CHECKING for typehints"Takeshi KOMIYA2018-03-131-2/+2
| | | | | | | | This reverts commit a073e17537c2aacaac305feadea58d4473ec97f4.
* | Merge branch 'master' into dont_stringify_exceptionsTakeshi KOMIYA2018-03-041-3/+3
|\ \
| * | Make console and warning messages translatableTakeshi KOMIYA2018-03-031-3/+3
| | |
* | | Use six.text_type to stringify exceptionsTakeshi KOMIYA2018-03-031-2/+3
|/ / | | | | | | | | On py2, an exception having i18nized message causes UnicodeError on stringify. This uses ``six.text_type()`` to stringify them instead.
* | Merge branch '1.7'Takeshi KOMIYA2018-02-181-2/+2
|\ \ | |/
| * Use typing.TYPE_CHECKING for typehintsTakeshi KOMIYA2018-02-141-2/+2
| |
* | Update type annotationsTakeshi KOMIYA2018-02-041-0/+1
|/
* Use flake8-import-orderTakeshi KOMIYA2018-01-281-1/+1
|
* Merge branch 'happy_new_year' into masterTakeshi KOMIYA2018-01-011-1/+1
|\
| * A happy new year!Takeshi KOMIYA2018-01-011-1/+1
| |
* | remove unnecessary else clauses in for loopSrinivas Reddy Thatiparthy2017-08-191-8/+7
| |
* | pycode: Replace pgen2 by own parserTakeshi KOMIYA2017-07-261-1/+1
|/
* Fix #3833: command line messages are translated unintentionallyTakeshi KOMIYA2017-06-251-11/+11
|
* Fix #3770: Fix KeyError from code-block directiveTakeshi KOMIYA2017-05-211-2/+2
|