|
From: <mi...@us...> - 2021-06-17 14:33:10
|
Revision: 8766
http://sourceforge.net/p/docutils/code/8766
Author: milde
Date: 2021-06-17 14:33:09 +0000 (Thu, 17 Jun 2021)
Log Message:
-----------
Make "meta" a standard node.
Fixes also bug #241.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docs/ref/doctree.txt
trunk/docutils/docs/ref/docutils.dtd
trunk/docutils/docs/ref/rst/directives.txt
trunk/docutils/docs/ref/rst/restructuredtext.txt
trunk/docutils/docs/ref/transforms.txt
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/nodes.py
trunk/docutils/docutils/parsers/rst/directives/__init__.py
trunk/docutils/docutils/parsers/rst/directives/misc.py
trunk/docutils/docutils/transforms/components.py
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
trunk/docutils/test/test_parsers/test_rst/test_directives/test_meta.py
Removed Paths:
-------------
trunk/docutils/docutils/parsers/rst/directives/html.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/HISTORY.txt 2021-06-17 14:33:09 UTC (rev 8766)
@@ -18,6 +18,20 @@
- ``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.
+
+ __ docs/ref/doctree.html#meta
+
+* docutils/parsers/rst/directives/html.py
+
+ - Removed. (Meta directive moved to ``misc.py``.)
+
+* docutils/parsers/rst/directives/misc.py
+
+ - `Meta` directive class (moved from html.py) inserts `meta`
+ (instead of `pending`) nodes.
+
* docutils/tools/math/math2html, docutils/writers/html5_polyglot/math.css
- Fix bug #244 Wrong subscript/superscript order with
@@ -58,6 +72,7 @@
- Remove IE 6 compatibility workarounds ``iepngfix.htc`` and
``blank.gif`` (fixes bug #169).
+
Release 0.17.1 (2021-04-16)
===========================
@@ -80,6 +95,7 @@
- Apply patch #160: move macro defs above ``.TH``
(thanks Willie and sorry for the delay).
+
Release 0.17 (2021-04-03)
=========================
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/RELEASE-NOTES.txt 2021-06-17 14:33:09 UTC (rev 8766)
@@ -38,17 +38,6 @@
* `htm4css1` writer: Support the embed_images_ option.
-* Make <meta> a standard Docutils doctree node.
-
- The `meta directive`__ will insert <meta> instead of pending nodes.
- Writers may ignore some or all <meta> elements if they are not
- supported by the output format.
-
- The ``transforms/components.Filter`` class will become obsolete by
- this change and may be removed in future.
-
- __ docs/ref/rst/directives.html#meta
-
* Remove the "rawsource" attribute and argument from nodes.Text:
we store the null-escaped text in Text nodes since 0.16 so there is no
additional information in the rawsource.
@@ -108,7 +97,11 @@
* ``nodes.Node.traverse()`` returns an iterator instead of a list.
+* Make meta__ a standard Docutils doctree node.
+ __ docs/ref/doctree.html#meta
+
+
Release 0.17.1 (2021-04-16)
===========================
Modified: trunk/docutils/docs/ref/doctree.txt
===================================================================
--- trunk/docutils/docs/ref/doctree.txt 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/docs/ref/doctree.txt 2021-06-17 14:33:09 UTC (rev 8766)
@@ -111,7 +111,7 @@
Simple structuctural subelements (title_, subtitle_) contain text
data; the others are compound and do not directly contain text data.
-Category members: title_, subtitle_, decoration_, docinfo_,
+Category members: title_, subtitle_, decoration_, docinfo_, meta_,
transition_
@@ -1607,10 +1607,11 @@
``docinfo``
===========
-The ``docinfo`` element is a container for document bibliographic
+The ``docinfo`` element is a container for displayed document bibliographic
data, or meta-data (data about the document). It corresponds to the
front matter of a book, such as the title page and copyright page.
+See also the meta_ element (for "hidden" meta-data).
Details
-------
@@ -1839,12 +1840,9 @@
:Attributes:
The ``document`` element contains the `common attributes`_ (ids_,
- names_, dupnames_, source_, and classes_), plus an optional title__
- attribute which stores the document title metadata.
+ names_, dupnames_, source_, and classes_), plus an optional
+ `title attribute`_ which stores the document title metadata.
- __ `title (attribute)`_
-
-
Examples
--------
@@ -2705,7 +2703,6 @@
Examples
--------
-reStructuredText uses a directive to indicate a ``line_block``.
Example source::
Take it away, Eric the Orchestra Leader!
@@ -3006,7 +3003,56 @@
The ``math`` element contains the `common attributes`_
(ids_, names_, dupnames_, source_, and classes_).
+``meta``
+========
+The ``meta`` element is a container for "hidden" document
+bibliographic data, or meta-data (data about the document).
+It corresponds to HTML META tags.
+
+See also the docinfo_ element for displayed meta-data.
+The document's `title attribute`_ stores the metadate document title.
+
+
+Details
+-------
+
+:Category:
+ `Structural Subelements`_
+
+:Parents:
+ Only the document_ element contains ``meta``.
+
+:Children:
+ None.
+
+:Analogues:
+ ``meta`` is analogous to the HTML "meta" element
+ or the file properties in ODT or PDF documents.
+
+:Processing:
+ The ``meta`` element is stored as metadata if the export format
+ supports this. It is typically invisible and may be omitted from
+ the processed output.
+
+ Meta-data may also be extracted from docinfo_ children
+ or the document_ attributes (title).
+
+The `"meta" directive`_ is used to create a ``meta`` element.
+reStructuredText_ source::
+
+ .. meta::
+ :description lang=en: An amusing story
+ :description lang=fr: Un histoire amusant
+
+Pseudo-XML_ fragment from simple parsing::
+
+ <meta content="An amusing story" lang="en" name="description">
+ <meta content="Un histoire amusant" lang="fr" name="description">
+
+.. _"meta" directive: rst/directives.html#meta
+
+
``note``
========
@@ -4537,9 +4583,8 @@
_`number`
The attribute value must be a number. Resolves to ``NMTOKEN``.
- Used in the `level`_, `morecols`_, `scale`_, and `start`_ attributes.
+ Used in the `scale`_, and `start`_ attributes.
-
_`measure`
A number which may be immediately followed by a unit or percent sign.
Resolves to CDATA.
@@ -4887,6 +4932,18 @@
The ``suffix`` attribute is used in the enumerated_list_ element.
+.. _title attribute:
+
+``title``
+=========
+
+Attribute type: `CDATA`_. Default value: none.
+
+The ``title`` attribute stores the title metadata of a document_. This
+title is typically not part of the rendered document. It may for
+example be used in HTML's ``title`` element.
+
+
``width``
==========
@@ -4910,18 +4967,6 @@
instance.
-.. _title (attribute):
-
-``title``
-=========
-
-Attribute type: `CDATA`_. Default value: none.
-
-The ``title`` attribute stores the title metadata of a document. This
-title is typically not part of the rendered document. It may for
-example be used in HTML's ``title`` element.
-
-
----------------------------
Parameter Entity Reference
----------------------------
@@ -5252,7 +5297,7 @@
An additional restriction, which cannot be expressed in the language
of DTDs, is imposed by software:
-
+
* A transition may not occur at the end of a document or section.
The `%structure.model;`_ parameter entity is directly employed in the
Modified: trunk/docutils/docs/ref/docutils.dtd
===================================================================
--- trunk/docutils/docs/ref/docutils.dtd 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/docs/ref/docutils.dtd 2021-06-17 14:33:09 UTC (rev 8766)
@@ -254,6 +254,7 @@
<!ELEMENT document
( (title, subtitle?)?,
decoration?,
+ meta?,
(docinfo, transition?)?,
%structure.model; )>
<!ATTLIST document
@@ -281,7 +282,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
-<!-- Container for bibliographic elements. May not be empty. -->
+<!-- Container for bibliographic elements. Must not be empty. -->
<!ELEMENT docinfo (%bibliographic.elements;)+>
<!ATTLIST docinfo %basic.atts;>
@@ -322,6 +323,10 @@
<!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;>
+
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Decoration Elements
Modified: trunk/docutils/docs/ref/rst/directives.txt
===================================================================
--- trunk/docutils/docs/ref/rst/directives.txt 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/docs/ref/rst/directives.txt 2021-06-17 14:33:09 UTC (rev 8766)
@@ -76,7 +76,7 @@
:Directive Types: "attention", "caution", "danger", "error", "hint",
"important", "note", "tip", "warning", "admonition"
:Doctree Elements: attention, caution, danger, error, hint, important,
- note, tip, warning, admonition_, title
+ note, tip, warning, admonition_, title_
:Directive Arguments: None.
:Directive Options: `:class:`_, `:name:`_
:Directive Content: Interpreted as body elements.
@@ -128,7 +128,7 @@
==================
:Directive Type: "admonition"
-:Doctree Elements: admonition_, title
+:Doctree Elements: admonition_, title_
:Directive Arguments: One, required (admonition title)
:Directive Options: `:class:`_, `:name:`_
:Directive Content: Interpreted as body elements.
@@ -512,7 +512,7 @@
The following options are recognized:
-``number-lines`` : [integer]
+``number-lines`` : [integer] (start line number)
Precede every line with a line number.
The optional argument is the number of the first line (defaut 1).
@@ -1853,7 +1853,7 @@
========
:Directive Type: "meta"
-:Doctree Element: pending_, meta (non-standard)
+:Doctree Element: meta_
:Directive Arguments: None.
:Directive Options: None.
:Directive Content: Must contain a flat field list.
@@ -1866,7 +1866,7 @@
.. note:: Data from some `bibliographic fields`_ is automatically
extracted and stored as metadata, too. However, Bibliographic
- Fields are also visible in the document's screen rendering or
+ Fields are also displayed in the document's screen rendering or
printout.
For an "invisible" *document title*, see the `metadata document
@@ -1912,13 +1912,11 @@
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
-
.. [#] "Metadata" is data about data, in this case data about the
document. Metadata is, e.g., used to describe and classify web
pages in the World Wide Web, in a form that is easy for search
engines to extract and collate.
-
.. _HTML meta elements:
https://html.spec.whatwg.org/multipage/semantics.html#the-meta-element
.. _ODT file properties:
@@ -1931,16 +1929,19 @@
=======================
:Directive Type: "title"
-:Doctree Element: None.
+:Doctree Element: Sets the document's `title attribute`_.
:Directive Arguments: One, required (the title text).
:Directive Options: None.
:Directive Content: None.
The "title" directive specifies the document title as metadata, which
-does not become part of the document body. It overrides a
-document-supplied title. For example, in HTML output the metadata
-document title appears in the title bar of the browser window.
+does not become part of the document body. It overrides the
+document-supplied `document title`_ and the `"title" configuration
+setting`_. For example, in HTML output the metadata document title
+appears in the title bar of the browser window.
+.. _document title: restructuredtext.html#document-title
+.. _"title" configuration setting: ../../user/config.html#title
Restructuredtext-Test-Directive
===============================
@@ -2017,6 +2018,7 @@
.. _length: restructuredtext.html#length-units
.. _line_block: ../doctree.html#line-block
.. _math_block: ../doctree.html#math-block
+.. _meta: ../doctree.html#meta
.. _pending: ../doctree.html#pending
.. _percentage: restructuredtext.html#percentage-units
.. _raw: ../doctree.html#raw
@@ -2024,6 +2026,7 @@
.. _sidebar: ../doctree.html#sidebar
.. _table: ../doctree.html#table
.. _title: ../doctree.html#title
+.. _title attribute: ../doctree.html#title-attribute
.. _topic: ../doctree.html#topic
Modified: trunk/docutils/docs/ref/rst/restructuredtext.txt
===================================================================
--- trunk/docutils/docs/ref/rst/restructuredtext.txt 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/docs/ref/rst/restructuredtext.txt 2021-06-17 14:33:09 UTC (rev 8766)
@@ -359,7 +359,7 @@
In `URI context` [#uri-context]_, backslash-escaped whitespace
represents a single space.
-
+
Backslashes have no special meaning in `literal context` [#literal-context]_.
Here, a single backslash represents a literal backslash, without having
to double up. [#caveat]_
@@ -474,9 +474,11 @@
the sections are then lifted up a level or two. See the `DocTitle
transform`_ for details.
-.. [#] The `title configuration setting`__ and the `title directive`__
- set a document title that does not become part of the document body.
+.. [#] The `"title" configuration setting`__ and the `"title"
+ directive`__ set the document's `title attribute`_ that does not
+ become part of the document body.
+ .. _title attribute: ../doctree.html#title-attribute
__ ../../user/config.html#title
__ directives.html#metadata-document-title
Modified: trunk/docutils/docs/ref/transforms.txt
===================================================================
--- trunk/docutils/docs/ref/transforms.txt 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/docs/ref/transforms.txt 2021-06-17 14:33:09 UTC (rev 8766)
@@ -92,7 +92,7 @@
peps.PEPZero peps.Headers (t/p) 760
-components.Filter "meta" (d/p) 780
+components.Filter *not used* 780
universal.Decorations Reader (r) 820
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/docs/user/config.txt 2021-06-17 14:33:09 UTC (rev 8766)
@@ -559,14 +559,19 @@
title
-----
-The `document title`_ as metadata, which does not become part of the
-document body. It overrides a document-supplied title. For
-example, in HTML output the metadata document title appears in the
-title bar of the browser window.
+The `document title` as metadata which does not become part of the
+document body. Stored as the document's `title attribute`_.
+For example, in HTML output the metadata document title
+appears in the title bar of the browser window.
+This setting overrides a displayed `document title`_ and
+is overridden by a `"title" directive`_.
+
Default: none. Option: ``--title``.
+.. _title attribute: ../ref/doctree.html#title-attribute
.. _document title: ../ref/rst/restructuredtext.html#document-title
+.. _"title" directive: ../ref/rst/directives.html#metadata-document-title
toc_backlinks
-------------
@@ -1092,7 +1097,7 @@
With the "html4css1" writer, the resulting HTML document does
not validate, as there is no DTD for `MathML + XHTML Transitional`.
However, MathML-enabled browsers will render it fine.
-
+
__ https://developer.mozilla.org/en-US/docs/Web/MathML
#browser_compatibility
__ ../ref/rst/mathematics.html
Modified: trunk/docutils/docutils/nodes.py
===================================================================
--- trunk/docutils/docutils/nodes.py 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/docutils/nodes.py 2021-06-17 14:33:09 UTC (rev 8766)
@@ -40,7 +40,6 @@
# ==============================
class Node(object):
-
"""Abstract base class of nodes in a document tree."""
parent = None
@@ -1590,6 +1589,13 @@
class rubric(Titular, TextElement): pass
+# ==================
+# Meta-Data Element
+# ==================
+
+class meta(PreBibliographic, Element):
+ """Container for "invisible" bibliographic data, or meta-data."""
+
# ========================
# Bibliographic Elements
# ========================
@@ -1914,7 +1920,7 @@
header hint
image important inline
label legend line line_block list_item literal literal_block
- math math_block
+ math math_block meta
note
option option_argument option_group option_list option_list_item
option_string organization
@@ -1945,9 +1951,9 @@
"``depart_`` + node class name", resp.
This is a base class for visitors whose ``visit_...`` & ``depart_...``
- methods should be implemented for *all* node types encountered (such as
- for `docutils.writers.Writer` subclasses). Unimplemented methods will
- raise exceptions.
+ methods must be implemented for *all* compulsory node types encountered
+ (such as for `docutils.writers.Writer` subclasses).
+ Unimplemented methods will raise exceptions (except for optional nodes).
For sparse traversals, where only certain node types are of interest, use
subclass `SparseNodeVisitor` instead. When (mostly or entirely) uniform
@@ -1958,7 +1964,7 @@
1995.
"""
- optional = ()
+ optional = (meta)
"""
Tuple containing node class names (as strings).
Modified: trunk/docutils/docutils/parsers/rst/directives/__init__.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/__init__.py 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/docutils/parsers/rst/directives/__init__.py 2021-06-17 14:33:09 UTC (rev 8766)
@@ -57,7 +57,7 @@
#'footnotes': ('parts', 'footnotes'),
#'citations': ('parts', 'citations'),
'target-notes': ('references', 'TargetNotes'),
- 'meta': ('html', 'Meta'),
+ 'meta': ('misc', 'Meta'),
#'imagemap': ('html', 'imagemap'),
'raw': ('misc', 'Raw'),
'include': ('misc', 'Include'),
Deleted: trunk/docutils/docutils/parsers/rst/directives/html.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/html.py 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/docutils/parsers/rst/directives/html.py 2021-06-17 14:33:09 UTC (rev 8766)
@@ -1,88 +0,0 @@
-# $Id$
-# Author: David Goodger <go...@py...>
-# Copyright: This module has been placed in the public domain.
-
-"""
-Directives for typically HTML-specific constructs.
-"""
-
-__docformat__ = 'reStructuredText'
-
-import sys
-from docutils import nodes, utils
-from docutils.parsers.rst import Directive
-from docutils.parsers.rst import states
-from docutils.transforms import components
-
-
-class MetaBody(states.SpecializedBody):
-
- class meta(nodes.Special, nodes.PreBibliographic, nodes.Element):
- """HTML-specific "meta" element."""
- pass
-
- def field_marker(self, match, context, next_state):
- """Meta element."""
- node, blank_finish = self.parsemeta(match)
- self.parent += node
- return [], next_state, []
-
- def parsemeta(self, match):
- name = self.parse_field_marker(match)
- name = utils.unescape(utils.escape2null(name))
- indented, indent, line_offset, blank_finish = \
- self.state_machine.get_first_known_indented(match.end())
- node = self.meta()
- pending = nodes.pending(components.Filter,
- {'component': 'writer',
- 'format': 'html,latex,odt',
- 'nodes': [node]})
- node['content'] = utils.unescape(utils.escape2null(
- ' '.join(indented)))
- if not indented:
- line = self.state_machine.line
- msg = self.reporter.info(
- 'No content for meta tag "%s".' % name,
- nodes.literal_block(line, line))
- return msg, blank_finish
- tokens = name.split()
- try:
- attname, val = utils.extract_name_value(tokens[0])[0]
- node[attname.lower()] = val
- except utils.NameValueError:
- node['name'] = tokens[0]
- for token in tokens[1:]:
- try:
- attname, val = utils.extract_name_value(token)[0]
- node[attname.lower()] = val
- except utils.NameValueError as detail:
- line = self.state_machine.line
- msg = self.reporter.error(
- 'Error parsing meta tag attribute "%s": %s.'
- % (token, detail), nodes.literal_block(line, line))
- return msg, blank_finish
- self.document.note_pending(pending)
- return pending, blank_finish
-
-
-class Meta(Directive):
-
- has_content = True
-
- SMkwargs = {'state_classes': (MetaBody,)}
-
- def run(self):
- self.assert_has_content()
- node = nodes.Element()
- new_line_offset, blank_finish = self.state.nested_list_parse(
- self.content, self.content_offset, node,
- initial_state='MetaBody', blank_finish=True,
- state_machine_kwargs=self.SMkwargs)
- if (new_line_offset - self.content_offset) != len(self.content):
- # incomplete parse of block?
- error = self.state_machine.reporter.error(
- 'Invalid meta directive.',
- nodes.literal_block(self.block_text, self.block_text),
- line=self.lineno)
- node += error
- return node.children
Modified: trunk/docutils/docutils/parsers/rst/directives/misc.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/misc.py 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/docutils/parsers/rst/directives/misc.py 2021-06-17 14:33:09 UTC (rev 8766)
@@ -506,6 +506,71 @@
return []
+class MetaBody(states.SpecializedBody):
+
+ def field_marker(self, match, context, next_state):
+ """Meta element."""
+ node, blank_finish = self.parsemeta(match)
+ self.parent += node
+ return [], next_state, []
+
+ def parsemeta(self, match):
+ name = self.parse_field_marker(match)
+ name = utils.unescape(utils.escape2null(name))
+ indented, indent, line_offset, blank_finish = \
+ self.state_machine.get_first_known_indented(match.end())
+ node = nodes.meta()
+ node['content'] = utils.unescape(utils.escape2null(
+ ' '.join(indented)))
+ if not indented:
+ line = self.state_machine.line
+ msg = self.reporter.info(
+ 'No content for meta tag "%s".' % name,
+ nodes.literal_block(line, line))
+ return msg, blank_finish
+ tokens = name.split()
+ try:
+ attname, val = utils.extract_name_value(tokens[0])[0]
+ node[attname.lower()] = val
+ except utils.NameValueError:
+ node['name'] = tokens[0]
+ for token in tokens[1:]:
+ try:
+ attname, val = utils.extract_name_value(token)[0]
+ node[attname.lower()] = val
+ except utils.NameValueError as detail:
+ line = self.state_machine.line
+ msg = self.reporter.error(
+ 'Error parsing meta tag attribute "%s": %s.'
+ % (token, detail), nodes.literal_block(line, line))
+ return msg, blank_finish
+ # self.document.note_pending(pending)
+ return node, blank_finish
+
+
+class Meta(Directive):
+
+ has_content = True
+
+ SMkwargs = {'state_classes': (MetaBody,)}
+
+ def run(self):
+ self.assert_has_content()
+ node = nodes.Element()
+ new_line_offset, blank_finish = self.state.nested_list_parse(
+ self.content, self.content_offset, node,
+ initial_state='MetaBody', blank_finish=True,
+ state_machine_kwargs=self.SMkwargs)
+ if (new_line_offset - self.content_offset) != len(self.content):
+ # incomplete parse of block?
+ error = self.state_machine.reporter.error(
+ 'Invalid meta directive.',
+ nodes.literal_block(self.block_text, self.block_text),
+ line=self.lineno)
+ node += error
+ return node.children
+
+
class Date(Directive):
has_content = True
Modified: trunk/docutils/docutils/transforms/components.py
===================================================================
--- trunk/docutils/docutils/transforms/components.py 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/docutils/transforms/components.py 2021-06-17 14:33:09 UTC (rev 8766)
@@ -32,13 +32,18 @@
``details['nodes']`` (a list of nodes); otherwise, the "pending" element
is removed.
- For example, the reStructuredText "meta" directive creates a "pending"
- element containing a "meta" element (in ``pending.details['nodes']``).
- Only writers (``pending.details['component'] == 'writer'``) supporting the
- "html", latex, or "odf" formats
- (``pending.details['format'] == 'html,latex,odf'``) will include the
- "meta" element; it will be deleted from the output of all other writers.
+ For example, up to version 0.17, the reStructuredText "meta"
+ directive created a "pending" element containing a "meta" element
+ (in ``pending.details['nodes']``).
+ Only writers (``pending.details['component'] == 'writer'``)
+ supporting the "html", "latex", or "odf" formats
+ (``pending.details['format'] == 'html,latex,odf'``) included the
+ "meta" element; it was deleted from the output of all other writers.
+
+ This transform is no longer used by Docutils, it may be removed in future.
"""
+ # TODO: clean up or keep this for 3rd party (or possible future) use?
+ # (GM 2021-05-18)
default_priority = 780
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2021-06-17 14:33:09 UTC (rev 8766)
@@ -2586,6 +2586,7 @@
self.pdfinfo.append(' addtopdfproducer={%s},'%content)
else:
# generic interface (case sensitive!)
+ # TODO: filter irrelevant nodes ("http-equiv", ...)?
self.pdfinfo.append(' pdfinfo={%s={%s}},'%(name, content))
def depart_meta(self, node):
Modified: trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml 2021-06-17 14:33:09 UTC (rev 8766)
@@ -1365,6 +1365,10 @@
<title auto="1" refid="toc-entry-53"><generated classes="sectnum">2.14.11 </generated>Meta</title>
<paragraph>The <reference anonymous="1" name="“meta” directive" refuri="https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata">“meta” directive</reference> <footnote_reference auto="1" ids="footnote-reference-17" refid="footnote-10">9</footnote_reference> is used to specify metadata to be stored in,
e.g., HTML META tags or ODT file properties.</paragraph>
+ <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>
<target anonymous="1" ids="target-6" refuri="https://docutils.sourceforge.io/docs/ref/rst/directives.html#metadata"></target>
</section>
</section>
Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2021-06-17 14:33:09 UTC (rev 8766)
@@ -47,6 +47,8 @@
}{}
\hypersetup{
pdftitle={reStructuredText Test Document},
+ pdfkeywords={reStructuredText, test, parser},
+ pdfinfo={description={A test document, containing at least one example of each reStructuredText construct.}},
pdfauthor={David Goodger;Me;Myself;I}
}
Modified: trunk/docutils/test/test_parsers/test_rst/test_directives/test_meta.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_directives/test_meta.py 2021-06-17 09:59:43 UTC (rev 8765)
+++ trunk/docutils/test/test_parsers/test_rst/test_directives/test_meta.py 2021-06-17 14:33:09 UTC (rev 8766)
@@ -29,22 +29,8 @@
""",
"""\
<document source="test data">
- <pending>
- .. internal attributes:
- .transform: docutils.transforms.components.Filter
- .details:
- component: 'writer'
- format: 'html,latex,odt'
- nodes:
- <meta content="The reStructuredText plaintext markup language" name="description">
- <pending>
- .. internal attributes:
- .transform: docutils.transforms.components.Filter
- .details:
- component: 'writer'
- format: 'html,latex,odt'
- nodes:
- <meta content="plaintext,markup language" name="keywords">
+ <meta content="The reStructuredText plaintext markup language" name="description">
+ <meta content="plaintext,markup language" name="keywords">
"""],
["""\
.. meta::
@@ -53,22 +39,8 @@
""",
"""\
<document source="test data">
- <pending>
- .. internal attributes:
- .transform: docutils.transforms.components.Filter
- .details:
- component: 'writer'
- format: 'html,latex,odt'
- nodes:
- <meta content="An amusing story" lang="en" name="description">
- <pending>
- .. internal attributes:
- .transform: docutils.transforms.components.Filter
- .details:
- component: 'writer'
- format: 'html,latex,odt'
- nodes:
- <meta content="Un histoire amusant" lang="fr" name="description">
+ <meta content="An amusing story" lang="en" name="description">
+ <meta content="Un histoire amusant" lang="fr" name="description">
"""],
["""\
.. meta::
@@ -76,14 +48,7 @@
""",
"""\
<document source="test data">
- <pending>
- .. internal attributes:
- .transform: docutils.transforms.components.Filter
- .details:
- component: 'writer'
- format: 'html,latex,odt'
- nodes:
- <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
+ <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
"""],
["""\
.. meta::
@@ -92,14 +57,7 @@
""",
"""\
<document source="test data">
- <pending>
- .. internal attributes:
- .transform: docutils.transforms.components.Filter
- .details:
- component: 'writer'
- format: 'html,latex,odt'
- nodes:
- <meta content="content over multiple lines" name="name">
+ <meta content="content over multiple lines" name="name">
"""],
["""\
Paragraph
@@ -111,14 +69,7 @@
<document source="test data">
<paragraph>
Paragraph
- <pending>
- .. internal attributes:
- .transform: docutils.transforms.components.Filter
- .details:
- component: 'writer'
- format: 'html,latex,odt'
- nodes:
- <meta content="content" name="name">
+ <meta content="content" name="name">
"""],
["""\
.. meta::
@@ -164,14 +115,7 @@
""",
"""\
<document source="test data">
- <pending>
- .. internal attributes:
- .transform: docutils.transforms.components.Filter
- .details:
- component: 'writer'
- format: 'html,latex,odt'
- nodes:
- <meta content="content" name="name">
+ <meta content="content" name="name">
<system_message level="3" line="1" source="test data" type="ERROR">
<paragraph>
Invalid meta directive.
@@ -189,22 +133,8 @@
""",
"""\
<document source="test data">
- <pending>
- .. internal attributes:
- .transform: docutils.transforms.components.Filter
- .details:
- component: 'writer'
- format: 'html,latex,odt'
- nodes:
- <meta content="content" name="name">
- <pending>
- .. internal attributes:
- .transform: docutils.transforms.components.Filter
- .details:
- component: 'writer'
- format: 'html,latex,odt'
- nodes:
- <meta content="content" name="name">
+ <meta content="content" name="name">
+ <meta content="content" name="name">
<system_message level="3" line="1" source="test data" type="ERROR">
<paragraph>
Invalid meta directive.
@@ -234,22 +164,8 @@
""",
"""\
<document source="test data">
- <pending>
- .. internal attributes:
- .transform: docutils.transforms.components.Filter
- .details:
- component: 'writer'
- format: 'html,latex,odt'
- nodes:
- <meta content="escaped linebreak" name="name:with:colons">
- <pending>
- .. internal attributes:
- .transform: docutils.transforms.components.Filter
- .details:
- component: 'writer'
- format: 'html,latex,odt'
- nodes:
- <meta content="content" name="unescaped:embedded:colons">
+ <meta content="escaped linebreak" name="name:with:colons">
+ <meta content="content" name="unescaped:embedded:colons">
"""],
]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|