|
From: <mi...@us...> - 2024-06-14 15:03:25
|
Revision: 9756
http://sourceforge.net/p/docutils/code/9756
Author: milde
Date: 2024-06-14 15:03:22 +0000 (Fri, 14 Jun 2024)
Log Message:
-----------
Remove `nodes.Element.set_class()`.
Obsolete. Append to Element['classes'] directly.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docutils/nodes.py
trunk/docutils/test/test_nodes.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2024-06-14 15:03:12 UTC (rev 9755)
+++ trunk/docutils/HISTORY.txt 2024-06-14 15:03:22 UTC (rev 9756)
@@ -47,6 +47,7 @@
convert string representations to correct data type,
normalize values,
raise ValueError for invalid attribute names or values.
+ - Removed `Element.set_class()`.
* docutils/parsers/docutils_xml.py
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2024-06-14 15:03:12 UTC (rev 9755)
+++ trunk/docutils/RELEASE-NOTES.txt 2024-06-14 15:03:22 UTC (rev 9756)
@@ -222,6 +222,11 @@
element does not comply with the `Docutils Document Model`_.
Provisional.
+* Removed objects:
+
+ `docutils.nodes.Element.set_class()`
+ Obsolete. Append to Element['classes'] directly.
+
* Bugfixes and improvements (see HISTORY_).
.. _Docutils Document Model:
Modified: trunk/docutils/docutils/nodes.py
===================================================================
--- trunk/docutils/docutils/nodes.py 2024-06-14 15:03:12 UTC (rev 9755)
+++ trunk/docutils/docutils/nodes.py 2024-06-14 15:03:22 UTC (rev 9756)
@@ -1076,15 +1076,6 @@
copy.extend([child.deepcopy() for child in self.children])
return copy
- def set_class(self, name):
- """Add a new class to the "classes" attribute."""
- warnings.warn('docutils.nodes.Element.set_class() is deprecated; '
- ' and will be removed in Docutils 0.21 or later.'
- "Append to Element['classes'] list attribute directly",
- DeprecationWarning, stacklevel=2)
- assert ' ' not in name
- self['classes'].append(name.lower())
-
def note_referenced_by(self, name=None, id=None):
"""Note that this Element has been referenced by its name
`name` or id `id`."""
@@ -1460,8 +1451,8 @@
class decoration(PreBibliographic, SubStructural, Element):
"""Container for `header` and `footer`."""
content_model = ( # (header?, footer?)
- (header, '?'),
- (footer, '?')) # TODO: empty element does not make sense.
+ (header, '?'), # Empty element does not make sense,
+ (footer, '?')) # but is simpler to define.
def get_header(self):
if not len(self.children) or not isinstance(self.children[0], header):
Modified: trunk/docutils/test/test_nodes.py
===================================================================
--- trunk/docutils/test/test_nodes.py 2024-06-14 15:03:12 UTC (rev 9755)
+++ trunk/docutils/test/test_nodes.py 2024-06-14 15:03:22 UTC (rev 9756)
@@ -464,12 +464,7 @@
self.assertEqual(child4['ids'], ['child4'])
self.assertEqual(len(parent), 5)
- def test_set_class_deprecation_warning(self):
- node = nodes.Element('test node')
- with self.assertWarns(DeprecationWarning):
- node.set_class('parrot')
-
class ElementValidationTests(unittest.TestCase):
def test_validate(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|