From d7fb654524149faaa278b340bde6d1fc46f9d15d Mon Sep 17 00:00:00 2001 From: milde Date: Sat, 4 May 2024 08:58:36 +0000 Subject: [PATCH] New SubStructural element category class. Fix categories: (cf. docs/ref/doctree.txt) `` is SubStructural, not Bibliographic. `` is SubStructural, not Structural. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@9683 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- docutils/HISTORY.txt | 17 +++++++++++++++-- docutils/docutils/nodes.py | 20 ++++++++++++++------ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/docutils/HISTORY.txt b/docutils/HISTORY.txt index fb2d28c10..a917e95c1 100644 --- a/docutils/HISTORY.txt +++ b/docutils/HISTORY.txt @@ -17,8 +17,21 @@ Release 0.22b.dev (unpublished) =============================== -* Add tox.ini to pyproject.toml to be in sdist (bug #486). -* Fix license issue (bug #487). +* General + + - Add tox.ini to pyproject.toml to be in sdist (bug #486). + - Fix license issue (bug #487). + +* docutils/nodes.py + + - New `SubStructural` element category class. + - Fix element categories. + +* docutils/transforms/frontmatter.py + + - Adapt `DocInfo` to fixed element categories. + + Release 0.21.2 (2024-04-23) =========================== diff --git a/docutils/docutils/nodes.py b/docutils/docutils/nodes.py index ef5f3527d..fad6903e0 100644 --- a/docutils/docutils/nodes.py +++ b/docutils/docutils/nodes.py @@ -1127,6 +1127,14 @@ class Structural: """ +class SubStructural: + """`Structural Subelements`__ are valid children of Structural Elements. + + __ https://docutils.sourceforge.io/docs/ref/doctree.html + #structural-subelements + """ + + class Body: """`Body elements`__. @@ -1583,8 +1591,8 @@ class document(Root, Structural, Element): # Title Elements # ================ -class title(Titular, PreBibliographic, TextElement): pass -class subtitle(Titular, PreBibliographic, TextElement): pass +class title(Titular, PreBibliographic, SubStructural, TextElement): pass +class subtitle(Titular, PreBibliographic, SubStructural, TextElement): pass class rubric(Titular, General, TextElement): pass @@ -1592,7 +1600,7 @@ class rubric(Titular, General, TextElement): pass # Meta-Data Element # ================== -class meta(PreBibliographic, Element): +class meta(PreBibliographic, SubStructural, Element): """Container for "invisible" bibliographic data, or meta-data.""" @@ -1600,7 +1608,7 @@ class meta(PreBibliographic, Element): # Bibliographic Elements # ======================== -class docinfo(Bibliographic, Element): pass +class docinfo(SubStructural, Element): pass class author(Bibliographic, TextElement): pass class organization(Bibliographic, TextElement): pass class address(Bibliographic, FixedTextElement): pass @@ -1620,7 +1628,7 @@ class authors(Bibliographic, Element): # Decorative Elements # ===================== -class decoration(PreBibliographic, Element): +class decoration(PreBibliographic, SubStructural, Element): """Container for header and footer.""" def get_header(self): @@ -1676,7 +1684,7 @@ class sidebar(Structural, Element): """ -class transition(Structural, Element): +class transition(SubStructural, Element): """Transitions are breaks between untitled text parts. A transition may not begin or end a section or document, nor may two -- 2.11.4.GIT