|
From: <mi...@us...> - 2021-09-11 11:17:47
|
Revision: 8821
http://sourceforge.net/p/docutils/code/8821
Author: milde
Date: 2021-09-11 11:17:44 +0000 (Sat, 11 Sep 2021)
Log Message:
-----------
Add "class" option to "raw" directive.
Classe values may already be specified via a preceding
"class" directive. This commit provides the concise alternative
known from other directives.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/ref/rst/directives.txt
trunk/docutils/docutils/parsers/rst/directives/misc.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2021-09-07 21:02:50 UTC (rev 8820)
+++ trunk/docutils/HISTORY.txt 2021-09-11 11:17:44 UTC (rev 8821)
@@ -40,6 +40,8 @@
- `Meta` directive class (moved from html.py) inserts `meta`
(instead of `pending`) nodes.
+ - Add `class` option to `Raw` directive.
+
* docutils/tools/math/math2html.py,
docutils/tools/math/tex2unicode.py,
docutils/writers/html5/math.css
Modified: trunk/docutils/docs/ref/rst/directives.txt
===================================================================
--- trunk/docutils/docs/ref/rst/directives.txt 2021-09-07 21:02:50 UTC (rev 8820)
+++ trunk/docutils/docs/ref/rst/directives.txt 2021-09-11 11:17:44 UTC (rev 8821)
@@ -1484,7 +1484,7 @@
:Directive Type: "raw"
:Doctree Element: raw_
:Directive Arguments: One or more, required (output format types).
-:Directive Options: Possible.
+:Directive Options: Possible (see below).
:Directive Content: Stored verbatim, uninterpreted. None (empty) if a
"file" or "url" option given.
:Configuration Setting: raw_enabled_
@@ -1554,6 +1554,9 @@
The text encoding of the external raw data (file or URL).
Defaults to the document's encoding (if specified).
+and the common option `:class:`_.
+
+
.. _"raw" role: roles.html#raw
Modified: trunk/docutils/docutils/parsers/rst/directives/misc.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/misc.py 2021-09-07 21:02:50 UTC (rev 8820)
+++ trunk/docutils/docutils/parsers/rst/directives/misc.py 2021-09-11 11:17:44 UTC (rev 8821)
@@ -216,7 +216,8 @@
final_argument_whitespace = True
option_spec = {'file': directives.path,
'url': directives.uri,
- 'encoding': directives.encoding}
+ 'encoding': directives.encoding,
+ 'class': directives.class_option}
has_content = True
def run(self):
@@ -288,7 +289,8 @@
else:
# This will always fail because there is no content.
self.assert_has_content()
- raw_node = nodes.raw('', text, **attributes)
+ raw_node = nodes.raw('', text, classes=self.options.get('class', []),
+ **attributes)
(raw_node.source,
raw_node.line) = self.state_machine.get_source_and_line(self.lineno)
return [raw_node]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|