Menu

Commit [r9691]  Maximize  Restore  History

Doctree validation: new functions to validate Element attribute values.

Attribute validate functions:

* convert string representations to correct data type,
* normalize values,
* raise ValueError for invalid attribute names or values.

The `nodes.Element.validate()` function reports a warning
for validity problems if `self.document.reporter` is available
and raises a ValueError if not.

Testing revealed problems with the "recommonmark_wrapper" parser:

* Validating should be done *after* the "clean up" operations.

* One test case uses an invalid class argument (underscore not allowed
by Docutils). As this sample tests an "only Sphinx" feature,
we just drop it from the Docutils test suite.

milde 2024-05-07

changed /trunk/docutils/HISTORY.txt
changed /trunk/docutils/docs/ref/doctree.txt
changed /trunk/docutils/docutils/nodes.py
changed /trunk/docutils/docutils/parsers/recommonmark_wrapper.py
changed /trunk/docutils/test/test_nodes.py
changed /trunk/docutils/test/test_parsers/test_recommonmark/test_literal_blocks.py
/trunk/docutils/HISTORY.txt Diff Switch to side-by-side view
Loading...
/trunk/docutils/docs/ref/doctree.txt Diff Switch to side-by-side view
Loading...
/trunk/docutils/docutils/nodes.py Diff Switch to side-by-side view
Loading...
/trunk/docutils/docutils/parsers/recommonmark_wrapper.py Diff Switch to side-by-side view
Loading...
/trunk/docutils/test/test_nodes.py Diff Switch to side-by-side view
Loading...
/trunk/docutils/test/test_parsers/test_recommonmark/test_literal_blocks.py Diff Switch to side-by-side view
Loading...
MongoDB Logo MongoDB