|
From: <mi...@us...> - 2021-06-18 18:54:15
|
Revision: 8770
http://sourceforge.net/p/docutils/code/8770
Author: milde
Date: 2021-06-18 18:54:14 +0000 (Fri, 18 Jun 2021)
Log Message:
-----------
nodes.document.make_id(): keep leading numbers and hyphens if possible.
I.e. if the id_prefix setting is non-empty.
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 2021-06-17 19:25:04 UTC (rev 8769)
+++ trunk/docutils/HISTORY.txt 2021-06-18 18:54:14 UTC (rev 8770)
@@ -16,11 +16,14 @@
* docutils/nodes.py
- - ``Node.traverse()`` returns an iterator instead of a list.
-
- Make meta__ a standard Docutils doctree node. Writers may ignore
"meta" nodes if they are not supported by the output format.
+ - ``Node.traverse()`` returns an iterator instead of a list.
+
+ - document.make_id(): Keep leading number and hyphen characters from `name`
+ if the id_prefix setting is non-empty.
+
__ docs/ref/doctree.html#meta
* docutils/parsers/rst/directives/html.py
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2021-06-17 19:25:04 UTC (rev 8769)
+++ trunk/docutils/RELEASE-NOTES.txt 2021-06-18 18:54:14 UTC (rev 8770)
@@ -30,8 +30,8 @@
definition list with class value "details".
- Move attribution behind the blockquote to comply with the
- __`"living standard"`?
- HTML5__ allows <cite> elements inside a blockquote (cf. Example 16).
+ `"living standard"`__?
+ (HTML5__ allows <cite> elements inside a blockquote, cf. Example 16.)
__ https://html.spec.whatwg.org/#the-blockquote-element
__ https://www.w3.org/TR/html52/grouping-content.html#the-blockquote-element
@@ -42,14 +42,6 @@
we store the null-escaped text in Text nodes since 0.16 so there is no
additional information in the rawsource.
-* If the id_prefix_ setting is non-empty, leading number and hyphen characters
- will not be stripped from a `reference name`_ during `identifier
- normalization`_. This may change generated `identifier keys`.
-
- Example: with ``--id-prefix="DU-"``, a section with title "34. May"
- currently gets the identifier key ``DU-may`` and after the change the
- identifier key ``DU-34-may``.
-
* The default value for auto_id_prefix_ will change to "%". This means
auto-generated IDs will use the tag name as prefix. Set auto_id_prefix_ to
"id" if you want unchanged auto-IDs or to "%" if you want the new
@@ -72,8 +64,6 @@
.. _auto_id_prefix: docs/user/config.html#auto-id-prefix
.. _rst2html.py: docs/user/tools.html#rst2html-py
.. _reference name: docs/ref/rst/restructuredtext.html#reference-names
-.. _identifier normalization:
- docs/ref/rst/directives.html#identifier-normalization
.. _html_writer: docs/user/config.html#html-writer
@@ -80,28 +70,44 @@
Release 0.18.dev
================
-* Removed files:
-
- - ``iepngfix.htc`` and ``blank.gif`` (IE 6 workaround for `s5_html`).
+* Output changes:
-* Removed function: ``utils.unique_combinations``
- (obsoleted by ``itertools.combinations``).
+ Identifiers:
+ If the id_prefix_ setting is non-empty, leading number and hyphen
+ characters will not be stripped from a `reference name`_ during
+ `identifier normalization`_.
-* HTML5 writer: changes to HTML output
+ Example: with ``--id-prefix="DU-"``, a section with title "34. May"
+ currently gets the identifier key ``DU-may`` and after the change the
+ identifier key ``DU-34-may``.
- - Write footnote brackets and field term colons to HTML, so that
- they are present also without CSS and when copying text.
+ HTML5:
+ Write footnote brackets and field term colons to HTML, so that they
+ are present also without CSS and when copying text.
-* LaTeX writer: `legacy_class_functions`_ setting default changed to "False".
+ LaTeX:
+ `legacy_class_functions`_ setting default changed to
+ "False", admonitions are now environments.
* ``nodes.Node.traverse()`` returns an iterator instead of a list.
-
* Make meta__ a standard Docutils doctree node.
__ docs/ref/doctree.html#meta
+* Removed files:
+ - ``iepngfix.htc`` and ``blank.gif`` (IE 6 workaround for `s5_html`).
+
+* Removed function: ``utils.unique_combinations``
+ (obsoleted by ``itertools.combinations``).
+
+* Various bugfixes and improvements (see HISTORY_).
+
+.. _identifier normalization:
+ docs/ref/rst/directives.html#identifier-normalization
+
+
Release 0.17.1 (2021-04-16)
===========================
Modified: trunk/docutils/docutils/nodes.py
===================================================================
--- trunk/docutils/docutils/nodes.py 2021-06-17 19:25:04 UTC (rev 8769)
+++ trunk/docutils/docutils/nodes.py 2021-06-18 18:54:14 UTC (rev 8770)
@@ -1363,10 +1363,13 @@
base_id = ''
id = ''
for name in node['names']:
- base_id = make_id(name)
+ if id_prefix:
+ # allow names starting with numbers if `id_prefix`
+ base_id = make_id('x'+name)[1:]
+ else:
+ base_id = make_id(name)
+ # TODO: normalize id-prefix? (would make code simpler)
id = id_prefix + base_id
- # TODO: allow names starting with numbers if `id_prefix`
- # is non-empty: id = make_id(id_prefix + name)
if base_id and id not in self.ids:
break
else:
Modified: trunk/docutils/test/test_nodes.py
===================================================================
--- trunk/docutils/test/test_nodes.py 2021-06-17 19:25:04 UTC (rev 8769)
+++ trunk/docutils/test/test_nodes.py 2021-06-18 18:54:14 UTC (rev 8770)
@@ -701,7 +701,7 @@
self.assertEqual(ids, [['P-test'],
['P-auto1'],
['P-auto2'],
- ['P-auto3']])
+ ['P-2019-10-30']])
def test_set_id_descriptive_auto_id(self):
# Use name or tag-name for auto-id.
@@ -730,7 +730,7 @@
self.assertEqual(ids, [['P:test'],
['P:a-section-1'],
['P:test-1'],
- ['P:a-footnote-1']])
+ ['P:2019-10-30']])
class MiscFunctionTests(unittest.TestCase):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|