diff options
author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2023-04-17 20:26:41 +0000 |
---|---|---|
committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2023-04-17 20:26:41 +0000 |
commit | 56f82a735b1e864d4fe498e31e3a6c5495e600c0 (patch) | |
tree | b29dc11713d7ce7dea50b47bdfeeba0250261853 | |
parent | 1a859be41be1f96d08ac96ef2ce1d5140562ecb5 (diff) | |
download | docutils-56f82a735b1e864d4fe498e31e3a6c5495e600c0.tar.gz |
The "null" writer will generate an empty string in Docutils 0.22.
Update writer documentation to Python 3 terminology.
Format multi-line docstrings according to policies.
Writers generate `str` or `bytes` output.
In future, the "null" writer will also generate `str` output
for consistency with other writers and the documentation.
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9352 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r-- | docutils/RELEASE-NOTES.txt | 2 | ||||
-rw-r--r-- | docutils/docutils/writers/__init__.py | 14 | ||||
-rw-r--r-- | docutils/docutils/writers/null.py | 4 |
3 files changed, 15 insertions, 5 deletions
diff --git a/docutils/RELEASE-NOTES.txt b/docutils/RELEASE-NOTES.txt index c4b09106d..a7e9144e7 100644 --- a/docutils/RELEASE-NOTES.txt +++ b/docutils/RELEASE-NOTES.txt @@ -133,6 +133,8 @@ Drop support for Python 3.7 and 3.8 in Docutils 0.21. - Remove ``use_verbatim_when_possible`` setting (use literal_block_env_: verbatim) in Docutils 2.0. +* "null" writer: output will change to the empty string in Docutils 0.22. + * The default value of the `auto_encode` argument of `core.publish_str()`, `core.publish_from_doctree()`, and `core.publish_programmatically()` will change to ``False`` in Docutils 0.22. diff --git a/docutils/docutils/writers/__init__.py b/docutils/docutils/writers/__init__.py index 84be8f6a2..d15ccd29f 100644 --- a/docutils/docutils/writers/__init__.py +++ b/docutils/docutils/writers/__init__.py @@ -36,18 +36,22 @@ class Writer(Component): universal.StripClassesAndElements] document = None - """The document to write (Docutils doctree); set by `write`.""" + """The document to write (Docutils doctree); set by `write()`.""" output = None - """Final translated form of `document` (Unicode string for text, binary - string for other forms); set by `translate`.""" + """Final translated form of `document` + + (`str` for text, `bytes` for binary formats); set by `translate()`. + """ language = None - """Language module for the document; set by `write`.""" + """Language module for the document; set by `write()`.""" destination = None """`docutils.io` Output object; where to write the document. - Set by `write`.""" + + Set by `write()`. + """ def __init__(self): diff --git a/docutils/docutils/writers/null.py b/docutils/docutils/writers/null.py index 6c30627e2..7b303f8d7 100644 --- a/docutils/docutils/writers/null.py +++ b/docutils/docutils/writers/null.py @@ -4,6 +4,9 @@ """ A do-nothing Writer. + +`self.output` will change from ``None`` to the empty string +in Docutils 0.22. """ from docutils import writers @@ -18,4 +21,5 @@ class Writer(writers.UnfilteredWriter): config_section_dependencies = ('writers',) def translate(self): + # output = None # TODO in 0.22 pass |