summaryrefslogtreecommitdiff
path: root/docutils/transforms
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused local variablesmilde2022-03-051-1/+0
| | | | | | | | flake rule F841: local variable 'foo' is assigned to but never used In test_odt.py, a no-op class definition is removed completely. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9038 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove unused imports.milde2022-03-057-12/+10
| | | | | | flake8 rule F401 git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9037 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Avoid line break after binary operator.milde2022-03-052-12/+12
| | | | | | | | | Breaking before binary operators is the recommended style in PEP 8 (changed in April 2016). flake8 rule W504 git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9035 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Avoid multiple statements on one line. Fix redundant backslashmilde2022-03-052-2/+4
| | | | | | | | | | | | Exceptions for sets of empty class definitions and other cases where it improves comprehension. flake8 rules E502: the backslash is redundant between brackets E701: multiple statements on one line (colon) E704: multiple statements on one line (def) git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9032 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Avoid too long lines.milde2022-03-053-5/+10
| | | | | | flake8 rule E501: line too long (N > 79 characters) git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9030 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Ensure 2 blank lines around top-level functions and classes.milde2022-03-041-0/+1
| | | | | | | | flake8 rules E302: expected 2 blank lines, found 1 E305: expected 2 blank lines after class or function definition git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9026 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove excess blank lines.milde2022-03-041-1/+0
| | | | | | flakei rule E303: too many blank lines (N) git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9025 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix multiple spaces after keywordmilde2022-03-041-6/+6
| | | | | | flake8 rule E271 git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9023 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Ensure at least two spaces before inline comment.milde2022-03-045-10/+10
| | | | | | | | | flake 8 rule E261 Exceptions for modules sheduled for removal or with 3rd-party origin and for data collections. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9021 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix missing whitespace after ',' or ':'.milde2022-03-031-1/+1
| | | | | | | | flake8 rule E231. Mostly trailing commas in list and dictionary literals. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9018 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix missing whitespace around operator.milde2022-03-031-1/+1
| | | | | | | | | | | | | | flake8 rules E225: missing whitespace around operator E226: missing whitespace around arithmetic operator E228: missing whitespace around modulo operator Keep ignoring the latter two rules: PEP8 limits the recommendation to "operators with lowest priority" "if operators with different priorities are used". flake8 also flags top level operators. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9017 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix multiple spaces before/after operatormilde2022-03-032-2/+2
| | | | | | | E221 multiple spaces before operator E222 multiple spaces after operator git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9016 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix whitespace before/after delimiters and colon.milde2022-03-031-2/+2
| | | | | | | | | | | | | | Flake rules E201 whitespace after '(' E202 whitespace before '}' E203 whitespace before ':' E211 whitespace before '(' Exception: : as binary operator in extended slices (cf. https://www.python.org/dev/peps/pep-0008/#pet-peeves). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9015 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix FilterMessages transform [bug:#435].milde2022-02-031-5/+14
| | | | | | | | | | | The "Messages" transform no longer tests for to-be-ignored messages but inserts all `system-messages` without parent into a "System Messages" section. This allows the "FilterMessages" transform to find and convert matching `problematic` nodes (but now it also has to remove the "System Messages" section if empty). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8997 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix code indentationmilde2022-01-293-19/+20
| | | | | | | | | | | | | | | | | | | | Check conformance to our coding policies with flake8. Fix the following problems: E111 indentation is not a multiple of four E114 indentation is not a multiple of four (comment) E115 expected an indented block (comment) E116 unexpected indentation (comment) E117 over-indented E121 continuation line under-indented for hanging indent E122 continuation line missing indentation or outdented E124 closing bracked does not match visual indentaion E127 continuation line over-indented for visual indent E128 continuation line under-indented for visual indent E131 continuation line unaligned for hanging indent git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8994 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix trailing whitespace (flake warnings W293, W391).milde2022-01-292-3/+3
| | | | | | | W293 blank line contains whitespace W391 blank line at end of file git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8993 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix trailing whitespace (flake warning W291).milde2022-01-292-3/+3
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8992 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* New style classes no longer need to inherit from `object`.milde2022-01-261-1/+1
| | | | | | Patch by Adam Turner. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8984 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Drop string prefix "u".milde2022-01-262-9/+9
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8983 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Skip assigning to a variable when immediately returningmilde2022-01-261-2/+1
| | | | | | Patch by Adam Turner git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8980 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove unused importsmilde2022-01-266-10/+0
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8979 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove redundant parenthesesmilde2022-01-262-3/+3
| | | | | | Patch by Adam Turner. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8976 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Small fixes and clean-ups by Adam Turner.milde2022-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Remove duplicate definitions in language modules. Import locale_encoding from `docutils.io` Use decorator for staticmethod Use True/False over 1/0. `collections.OrderedDict` no longer required, all dictionaries are ordered from Python 3.7 Remove obsolete `__cmp__` method cf. https://docs.python.org/3/whatsnew/3.0.html#ordering-comparisons Use str instead of type(''). Zero-argument ``super()`` Simplify test support module as "u" prefix isn't used by repr in Python 3. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8973 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Code modernisation. Use literals.milde2022-01-261-2/+2
| | | | | | Merger of 2 patches by Adam Turner. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8969 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Change http://docutils.sourceforge.net -> https://docutils.sourceforge.iomilde2022-01-201-4/+4
| | | | | | Patch by Adam Turner. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8956 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Change http://docutils.sf.net -> https://docutils.sourceforge.iomilde2022-01-201-3/+3
| | | | | | Patch by Adam Turner. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8954 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Change removal warnings to "minor + 2" where appropriate.milde2022-01-141-2/+2
| | | | | | | | | | | | The version number of the next release(s) may be "1.0, 1.1, ...", "0.19, 1.0, ...", or "0.19, 0.20, ...". Lower announced removal version to "0.21 or later" for DeprecationWarnings that did not include a removal version in the last release and for DeprecationWarnings that were added after the last release. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8949 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Refer to the "pycmark" CommonMark parser and other documentation fixes.milde2022-01-111-3/+4
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8942 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Drop (most) special-casing for Python 2.x.milde2022-01-032-11/+3
| | | | | | Simplifications for nodes.py and error_reporting.py will follow. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8928 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove "coding:" slugmilde2022-01-032-2/+0
| | | | | | Only required with Python 2.x. Encoding in Py3k is utf8 by default. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8926 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Deprecate transforms.writer_aux.Compound.milde2021-12-231-0/+11
| | | | | | | This transform is not used since the retirement of the "newlatex" writer in Dec 2010. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8913 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Small documentation updates and fixes.milde2021-12-231-2/+8
| | | | | | | Also change the priority of the SmartQuotes transform to a level not already in use. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8912 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Node.traverse() returns a list again to restore backwards compatibility.milde2021-11-115-24/+24
| | | | | | | | | | | | | Although the documented API only promised an "iterable" as return value, the implementation returned a list. Because Sphinx < 4.0.0 relies on this and Sphinx < 3.5.4 places no upper limit to the Docutils dependency, this led to many errors "in the wild". Fixes bug #431. New method Node.findall(): like Node.traverse() but returns an iterator. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8885 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix spellingmilde2021-10-221-6/+6
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8860 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Skip system_messages when propagating targets. Fixes bug #425.milde2021-09-201-34/+37
| | | | | | | Testing with "alltests.py" is currently impossible due to caching (see itest_hyperlinks_de.py) git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8831 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* LaTeX writer: revise Docutils-generated table of contentsmilde2021-09-111-2/+2
| | | | | | | Improve spacing, allow customization. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8826 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Small documentation fixes and additions.milde2021-07-121-8/+9
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8801 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Do not use deprecated "rawsource" argument when creating node.Text instances.milde2021-06-302-4/+2
| | | | | | | | The "rawsource" argument of ``nodes.Text.__init__`` is ignored and deprecated. Fix the documentation of nodes.Text.__new__(). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8782 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Insert "meta" nodes at begin of document.milde2021-06-171-1/+1
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8767 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Make "meta" a standard node.milde2021-06-171-6/+11
| | | | | | Fixes also bug #241. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8766 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* ``nodes.Node.traverse()`` now returns an iterator instead of a list.milde2021-05-181-2/+2
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8730 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Small documentation update.milde2021-05-181-3/+8
| | | | | | | | | restructuredtext.txt: Clarify which elements may come before the docinfo. Add missing classes in "transforms.universal" docstring. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8727 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* smartquotes: update comment.milde2021-05-021-0/+1
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8718 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Provide fallbacks for parser config settings.milde2021-04-073-9/+8
| | | | | | | | | | | | | | | | | | | | | Some 3rd party applications fail with AttributeError due to missing values in the document.settings object. a) because they don't follow the requirement documented in utils.new_document: If you will use the document object with any Docutils components, you must provide their default settings as well. b) because they may provide a hard-coded set missing new settings. This should fix bug #415 and https://github.com/readthedocs/recommonmark/issues/220. See also the sphinx issue with Docutils 0.13.1 https://github.com/sphinx-doc/sphinx/issues/3951. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8671 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Make "meta" elements available for "latex" and "odt".milde2021-01-081-4/+7
| | | | | | | | | | Basic "odt" support exists, "latex" support is planned. In future, the `meta directive`__ may insert <meta> instead of pending nodes, `making transforms/components.Filter` obsolete (solves bug #241). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8603 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Limit length of input lines and substitution expansion.milde2020-09-141-2/+10
| | | | | | | | | | | | | | | | | | Mitigate the danger of DoS attacs using specially crafted rST input (cf. bug #381). The default value of 10 000 characters should suffice for legitimate use cases (e.g. long paragraphs in auto-wrapping editors or extensive creative use of substitutions). Applications processing untrusted rST might wish to lower this limitation (together with other safety measures described in docs/howto/security.txt). Unsupervised processing of untrusted rST input should always be safeguarded with limits on processing time and memory use. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8565 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Flat is better than nested.milde2020-09-081-60/+60
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8559 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* fix typogrubert2020-08-241-1/+1
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8543 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix #395.milde2020-07-141-3/+6
| | | | | | | | | | Use the empty string as document["source"] value, when there is no known source. Also ensure there is no error when a PEP is written not from a file. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8527 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* More descriptive auto-IDsmilde2019-10-111-1/+2
| | | | | | | | | | | | | | | | | | | | | Generate unique ids adding a running number to prefixes based on a) the node "name" (if existing but not unique), b) the new optional argument "suggested_prefix" (used for toc entries), c) the tagname of the object (e.g. footnote, citation, footnote-reference, system-message, ...) Advantages: * Meaningfully named links to ToC entries, footnotes, citations, error messages, and sections with duplicate title. * More stable links (a new footnote does not change backlinks to the ToC, say). For backwards compatibility, this only applies if `settings.auto_id_prefix` ends with a percent sign ("%"). This may become the default in the future. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8403 929543f6-e4f2-0310-98a6-ba3bd3dd1d04