9741 Commits

Author SHA1 Message Date
grubert
df6b4e5742 version 0.22.3b1.dev
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10252 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-24 16:22:33 +00:00
milde
3435086033 rST parser: allow for combining characters in grid tables.
Ignore combining characters when extracting a grid table block and
when parsing the grid table structure.
Allow for combining characters when extracting 2d-block with cell content.

Missing part of the fixes in [r7231].

Fixes [bugs:#128] and [bugs:#512].

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10251 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-22 21:00:13 +00:00
milde
3acf13898c Simplify utils.column_indices().
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10250 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-22 20:59:57 +00:00
milde
834efc7ee0 Documentation fixes.
Drop *rc1 release entries from HISTORY and RELEASE NOTES.
Add missing period.
Fix link target. Thanks to Dmitry Shachnev for reporting and patch #215.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10249 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-20 22:08:37 +00:00
grubert
8724201660 release 0.22.2
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10248 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-20 18:28:24 +00:00
grubert
1fd58b487b version 0.22.3b1.dev
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10247 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-20 18:25:13 +00:00
grubert
e3b9fbe996 version 0.22.2
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10245 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-20 17:45:20 +00:00
grubert
91d5b401d2 Fix: commented out py2 code
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10244 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-18 01:29:47 +00:00
grubert
eac6113acc update version to 0.22.2b1.dev
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10243 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-17 18:40:34 +00:00
grubert
377215d817 0.22.1 release
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10242 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-17 18:38:06 +00:00
grubert
c65b453450 version 0.22.2b1.dev
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10241 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-17 18:37:21 +00:00
grubert
db645dc354 release 0.22.1
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10239 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-17 17:54:28 +00:00
milde
f1cd0aa771 Announce change for label writing in latex writer.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10238 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-17 10:38:42 +00:00
milde
42bfaceaa9 Document the <target> element.
Add the last missing element reference section to the Document Tree documentation.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10237 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-15 22:57:17 +00:00
grubert
c49d0cd45b version 0.22.1b1.dev
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10236 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-14 17:26:51 +00:00
grubert
2c0111e357 0.22.1rc1 release
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10235 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-13 17:27:36 +00:00
grubert
e438395a93 version 0.22.1b2.dev
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10234 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-13 17:26:32 +00:00
grubert
9f74e390a4 0.22.1rc1
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10233 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-13 17:01:48 +00:00
milde
c210e76a91 Documentation amendments.
Announce removement of `memo.section_level` in Docutils 2.0.

Add some missing element descriptions to The Docutils Document Tree.

Revert section level changes in restructuredtext.rst doc. Move section
"Implicite Hyperlink Targets" to the end.

Mention Roles Defined in Standard Definition Files in
"reStructuredText Interpreted Text Roles".

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10232 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-13 16:01:09 +00:00
milde
951f9da20e Small editorial changes.
Add type info, shorten function call, merge repetitive commands.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10231 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-11 14:16:33 +00:00
grubert
694dcebac0 Fix release date
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10230 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-11 09:29:43 +00:00
milde
ffc679b3d7 rST parser: Use section_level_offset instead of memo.section_level.
Keeping record of the current section level in the state machine's "memo"
is cumbersome and error prone because it needs to be updated with every switch
of the current node.

Store the difference between the intended start level of nested parsing and the
number of parents of the base node in the new attribute `section_level_offset`.
Use it to correct the section level determined via `node.section_hierarchy()`.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10229 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-09 09:54:18 +00:00
milde
376cf44c25 rST parser: simplifications, fixes, and improvements
Define the attribute `parent_state_machine` only in
`parsers.rst.state.NestedStateMachine`.
It does not make sense in other state machines.

More detailled error message for inacessible section parents.

Test with a copy of Sphinx's `_fresh_title_style_context`.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10228 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-08 13:44:23 +00:00
milde
a9cc52bc22 Adjustments for nested_parse().
* Ensure valid output and update the "current node", if the base node is
  the "current node".

  If the base node is the state machine's "current node", we can safely assume
  that it is attached to the document and check if sections are valid. We can
  also update the "current node" of the parent state machine(s) after parsing.
  This prevents invalid or mixed up document trees.

* Make the "current node" the default value for the "node" argument.
  (This allows simple use for content included from external sources.)

* Restore `memo.section_level` after nested parsing into a custom node.
  The calling code must ensure that section_level and current node stay in sync.

* Update unit tests.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10227 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-05 14:07:30 +00:00
milde
570615a844 rST parser: restore backwards compatibility of nested parsing.
* Keep document-wide title style hierarchy in nested parsing.

* Revert to using `document.memo.section_level` (required for nested parsing
  into a detached base node with document-wide title styles).

+ simpler logic
+ backwards compatible
- more bookkeeping effort
- mandating a document-wide section title style hierarchy is ill-suited for
  inclusion of rST blocks from external sources (e.g. extracted docstrings).
  See `sphinx.util.parsing.nested_parse_to_nodes()` for an alternative.

This should restore compatibility with Sphinx's "only" directive broken by [r10204].

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10226 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-09-05 09:10:58 +00:00
milde
f00f836e28 Deprecate the "match_titles" argument of states.RSTState.nested_list_parse().
`nested_list_parse()` is intended for second and subsequent items of lists
and list-like constructs, it does never match section titles.

The argument value was (mis)used in directive classes to check wheter a
`<topic>` or `<sidebar>` element can be returned.
This check is now replaced by testing for a valid parent node.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10225 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-28 22:07:49 +00:00
milde
adfd1ead85 More distict variable name in parsers.rst.states.RSTState.nested_list_parse().
The `RSTState.nested_parse()` method creates/uses a new state machine
that differs from the class instance's `self.state_machine`
(which may be the master state machine or another nested state machine).
Rename the local variable holding the new machine from `state_machine`
to `my_state_machine`.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10224 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-28 22:07:36 +00:00
milde
f8838845eb New attribute to store the parent state machine of nested state machines.
Allows, e.g., passing an updated "current node" to the parent state machine(s)
to fix issues with nested parse with section support (cf. [bugs:#511]).

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10223 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-28 16:15:22 +00:00
milde
f7cf15197d Element after a section from nested parsing may be invalid.
`parsers.rst.RSTSTate.nested_parse()` with `match_titles=True`
(i.e. support for sections) leads to an invalid document tree,
if the nested block contains a section but the element following
the nested block is not a section.

The "structure model" ony allows a `<section>` as sibling after a `<section>`.
https://docutils.sourceforge.io/docs/ref/doctree.html#structure-model

An invalid doctree can be prevented if the following content
is appended to the last nested section instead of its parent.
The "nested" directive attempts this but fails if it is called from
another nested state machine:
In a nested state_machine we cannot access/change the `node` attribute
("insertion point") of the calling state_machine.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10222 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-26 08:06:11 +00:00
milde
2899f85f4a Use a "property" for parsers.rst.states.RSTState.parent.
Using a property attribute instead of runtime initialization ensures
the "insertion point"/"current node" is synchronised across the
statemachine and all state instances.

This may allow support for nested parsing with document-wide section title styles.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10221 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-25 08:33:52 +00:00
milde
b48050c4e8 Fix/Update tests for nested parsing with sections.
Add error messages for invalid sections to the sample directives.

Update the sample text to mirror the current behaviour.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10220 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-22 11:14:54 +00:00
milde
1ea29dcb25 LaTeX writer: write "label" commands for elements with "ids".
Fix [bugs:#503].

Currently, internal cross-references to most body elements (admonitions, lists,
block_quotes, container, compound, ...) fail, because the "ids"
attribute of these elements is ignored.

Calls `ids_to_labels()` for (almost) all elements that may have one or more IDs.

TODO:
* test/revise citations and footnotes
* class handling for image and list items
  (use DUclass environment or DUrole function?)
* Currently, there is no way to specify a target name or custom class for
  the "docinfo" in the rST source.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10219 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-21 15:18:05 +00:00
milde
02cfab2b1e LaTeX writer: dont add \phantomsection for subtitle labels.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10218 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-20 12:04:54 +00:00
milde
4430777211 LaTeX writer: Simplify code for nested image.
Simplify logic for the insertion of newlines around
the image inclusion macro.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10217 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-20 12:04:42 +00:00
milde
2752a6d1d0 LaTeX writer: fix anchor placement for figures, images, literal blocks, tables.
New attribute "pre_nl" for `ids_to_labels()`: prepend newline to label
definitions if there are labels.

Move anchor and label definition(s) for images, figures, literal blocks,
and tables before class wrappers and element.
Now, after activating a link to the element, it is fully visible
in the PDF viewer.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10216 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-20 12:04:32 +00:00
milde
ac7562cbab LaTeX writer: set anchor for math-block with target/label.
The "hyperref" LaTeX package sets an anchor for hyperlinks to math blocks,
if they are numbered. The "math" directive generates unnumbered math blocks.
Prepend a `\phantomsection` to manually set an anchor so that hyperlinks
go to the right place.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10215 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-20 12:04:19 +00:00
milde
357763714d Documentation fixes.
Fix docstring: `directives.misc.Include.insert_into_input_lines()`
returns None. (The empty list is returned by `Include.run()`.)

Small edits in the Document Tree Guide.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10214 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-20 09:39:58 +00:00
grubert
4e75703fc9 version string 0.23b.dev
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10213 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-20 08:32:28 +00:00
grubert
65483b8d8b set path to docutils dev code
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10212 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-20 08:31:29 +00:00
milde
b526dd4450 Better error reports for hyperlinks with embedded URI or alias.
Check and report for common typos when an undefined referencname
contains a `<` or `>`.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10211 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-19 20:28:48 +00:00
milde
3abeaf340f latex writer: Fix/simplify footnote handling.
In Docutils, reference names for footnotes, citations, and
hyperlinks use the same namespace.

Change the definitions of `\DUfootnotemark` and `\DUfootnotetext`
(use `\label` and `\hyperref` instead of `\hypertarget`
and `\hyperlink`) to get corresponding behaviour in LaTeX.

This allows to remove the additional creation of a `\label` for
footnotes with "autonumber-label".

Adapt tests.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10210 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-19 18:38:11 +00:00
milde
1568d581a4 Use True/False instead of 1/0 for boolean blank_finish.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10209 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-19 18:37:57 +00:00
milde
2f0407e18e Better error reporting for table markup.
Based on [patches:#214] by Jynn Nelson.
Solves [bugs:#504].

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10208 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-19 18:37:49 +00:00
milde
010a5ed2b8 Simplify the determination of table opening LaTeX code.
No change to the output.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10207 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-19 17:03:49 +00:00
milde
dac488cd29 rST parser: ensure that nested parsing only appends to the provided base node.
* Always start a new title style hierarchy for nested parsing.
* Append sections to the base node also if it is not a `<document>`
  or `<section>` (revert [r10203]).

This change makes the behaviour of nested parsing more uniform and predictable
(independent of type and possible parents of the base node).

It prevents problems with silently dropped higher level sections
in Docutils < 0.22 (because the legacy "raise error and retry" algorithm
of section parsing fails with nested parsing).
It also prevents a wrong node order for sections in Docutils 0.22
(because the calling parser has no means to know the new "insertion point"
and continues where it left before the nested parsing).

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10206 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-19 16:53:27 +00:00
milde
b0d106051f Test nested parsing in a directive.
Define/use sample directives to test nested parsing with section support.
Advantages:

* The tests are simpler and easier to comprehend.
* Emulate possible use cases. Provide template for extension developers.
* More comprehensive testing.
* Allows test/comparision with the legacy section parsing algorithm
  (used up to 0.22).

Tests revealed problems with section styles matching existing styles:

legacy section parsing:
  DATA LOSS:
  Sections with a level outside the nested parsing are silently dropped!
  This happens also with a base node attached to the document.

new section parsing:
  After nested parsing, the "insertion point" is restored to what it was
  before. If sibling sections or parent sections are attached according to
  their level, the insertion point after parsing is before these sections
  (the order of the nodes is mixed up).

  In a block-quote or other body element the current node is not attached to
  the document because the content is parsed with nested_parse into node that
  is appended after parsing.
  If the current node is used as base node, the section style hierarchy may be
  document-wide or local, depending on the placement of the directive.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10205 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-19 15:07:47 +00:00
milde
242c50ae60 rST parser: new title-style hierarchy for nested parsing with detached base node.
Use a separate section title style hierarchy for nested parsing
if the base node is not attached to the document.

With a detached base, the parser can not move up in the section hierarchy, so it
does not make sense to enforce the document-wide title style hierarchy.

Separate title styles also fit better with directives that fetch their content
from separate sources.
Docutils does not switch on section support in nested parsing.
Sphinx defines and uses a "_fresh_title_style_context" in nested parsing.
Some contributed Sphinx extensions reported regeressions with the new
section parsing algorightm because the old algorithm was forgiving in case
of inconsistent title styles in nested parsing (cf. [bugs:#508]).

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10204 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-15 22:28:45 +00:00
milde
c3a99f65a7 Look for valid parent before appending a section element.
Don't append a `<section>` to an `<admonition>` or other body element,
only to <section>` and `<document>`.
Exception: the base node of a nested parser may become the
new section's parent, if it has no parent (detached node).
It is up to the users (or extension implementing a directive) to
prevent or handle these cases.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10203 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-15 17:38:10 +00:00
milde
4447485ac8 Fixes for the section level determination.
Simplify the fix in [r10200].
  Don't add elements without valid parent to the list returned by
  `nodes.Element.section_hierarchy()` instead of removing them later.

  Remove the check/report for `new_parent is None` (we don't add
  elements with .parent None to the `parent_sections` list any more).

Don't add a new section title style to the list of established title styles
if it is inconsistent.

Annotate and document arguments of `RSTState.nested_parse()`.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10202 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-15 17:37:57 +00:00
milde
a67bfb77a3 Deprecate parsers.rst.states.RSTStateMachine.memo.reporter.
The "reporter" is already attached to "memo.document", so we can
simplify the "memo" a bit.

git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@10201 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
2025-08-15 17:37:47 +00:00