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
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
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
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
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
* 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
* 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
`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
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
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
`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
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
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
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
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
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
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
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
* 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
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
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
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
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