|
From: <mi...@us...> - 2023-12-06 20:48:45
|
Revision: 9497
http://sourceforge.net/p/docutils/code/9497
Author: milde
Date: 2023-12-06 20:48:38 +0000 (Wed, 06 Dec 2023)
Log Message:
-----------
Validate and fix `docutils XML` output.
Fix "xml" writer:
The <meta> element must be empty (no whitespace allowed inside).
Fix definition of <meta> in the DTD.
<meta> does *not* take the basic attributes, instead a long list
of custom ones similar to it's HTML role model.
Modified Paths:
--------------
trunk/docutils/docs/dev/testing.txt
trunk/docutils/docs/ref/docutils.dtd
trunk/docutils/docutils/writers/docutils_xml.py
trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
Modified: trunk/docutils/docs/dev/testing.txt
===================================================================
--- trunk/docutils/docs/dev/testing.txt 2023-12-01 13:25:40 UTC (rev 9496)
+++ trunk/docutils/docs/dev/testing.txt 2023-12-06 20:48:38 UTC (rev 9497)
@@ -286,9 +286,5 @@
``functional/expected/`` (overwriting the old expected output), and
commit the change.
-.. [#] The validity of `Docutils XML` can be tested with
- ``xmllint <document-referencing-local-Docutils-DTD>.xml --valid --noout``.
-
- .. note: the ``--dtdvalid`` and ``--nonet`` options do not help override
- a reference to the PUBLIC "docutils.dtd" if there is a local version
- on the system (e.g. /usr/share/xml/docutils/docutils.dtd in Debian).
+.. [#] `Docutils XML` can be validated with
+ ``xmllint --dtdvalid docs/ref/docutils.dtd --noout *.xml``.
Modified: trunk/docutils/docs/ref/docutils.dtd
===================================================================
--- trunk/docutils/docs/ref/docutils.dtd 2023-12-01 13:25:40 UTC (rev 9496)
+++ trunk/docutils/docs/ref/docutils.dtd 2023-12-06 20:48:38 UTC (rev 9497)
@@ -132,7 +132,7 @@
resolve to either an internal or external reference.
-->
<!ENTITY % refname.att
- " refname %refname.type; #IMPLIED ">
+ " refname %refname.type; #IMPLIED ">
<!ENTITY % additional.reference.atts "">
<!-- Collected hyperlink reference attributes. -->
@@ -167,8 +167,7 @@
<!ENTITY % additional.bibliographic.elements "">
<!ENTITY % bibliographic.elements
" author | authors | organization | address | contact
- | version | revision | status | date | copyright
- | field
+ | version | revision | status | date | copyright | field
%additional.bibliographic.elements; ">
<!ENTITY % additional.section.elements "">
@@ -227,7 +226,7 @@
<!-- These parameter entities customize the table model DTD. -->
<!ENTITY % bodyatt " %basic.atts; "> <!-- table elt -->
<!-- 1 colspec element is expected per table column: -->
-<!ENTITY % tbl.tgroup.mdl "colspec+,thead?,tbody">
+<!ENTITY % tbl.tgroup.mdl "colspec+,thead?,tbody">
<!ENTITY % tbl.tgroup.att " %basic.atts; ">
<!ENTITY % tbl.thead.att " %basic.atts; ">
<!ENTITY % tbl.tbody.att " %basic.atts; ">
@@ -253,7 +252,7 @@
<!-- Optional elements may be generated by internal processing. -->
<!ELEMENT document
( (title, subtitle?)?,
- meta?,
+ meta*,
decoration?,
(docinfo, transition?)?,
%structure.model; )>
@@ -323,9 +322,17 @@
<!ELEMENT copyright %text.model;>
<!ATTLIST copyright %basic.atts;>
-<!-- Container for "hidden" meta-data. Must not be empty. -->
-<!ELEMENT meta (field_list+)>
-<!ATTLIST meta %basic.atts;>
+<!-- Container for "hidden" meta-data. Attributes follow HTML -->
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ name NMTOKEN #IMPLIED
+ content CDATA #REQUIRED
+ http-equiv CDATA #IMPLIED
+ scheme CDATA #IMPLIED
+ lang CDATA #IMPLIED
+ dir (ltr | rtl | auto) #IMPLIED
+ media CDATA #IMPLIED
+ >
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Modified: trunk/docutils/docutils/writers/docutils_xml.py
===================================================================
--- trunk/docutils/docutils/writers/docutils_xml.py 2023-12-01 13:25:40 UTC (rev 9496)
+++ trunk/docutils/docutils/writers/docutils_xml.py 2023-12-06 20:48:38 UTC (rev 9497)
@@ -111,7 +111,7 @@
# generic visit and depart methods
# --------------------------------
- simple_nodes = (nodes.TextElement,
+ simple_nodes = (nodes.TextElement, nodes.meta,
nodes.image, nodes.colspec, nodes.transition)
def default_visit(self, node):
Modified: trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml 2023-12-01 13:25:40 UTC (rev 9496)
+++ trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml 2023-12-06 20:48:38 UTC (rev 9497)
@@ -4,10 +4,8 @@
<document ids="restructuredtext-test-document doctitle" names="restructuredtext\ test\ document doctitle" source="functional/input/standalone_rst_docutils_xml.txt" title="reStructuredText Test Document">
<title>reStructuredText Test Document</title>
<subtitle ids="examples-of-syntax-constructs subtitle" names="examples\ of\ syntax\ constructs subtitle">Examples of Syntax Constructs</subtitle>
- <meta content="reStructuredText, test, parser" name="keywords">
- </meta>
- <meta content="A test document, containing at least one example of each reStructuredText construct." lang="en" name="description">
- </meta>
+ <meta content="reStructuredText, test, parser" name="keywords"></meta>
+ <meta content="A test document, containing at least one example of each reStructuredText construct." lang="en" name="description"></meta>
<decoration>
<header>
<paragraph>Document header</paragraph>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|