#15543: glossary entry for and 'universal newlines', and links to it.
Patch by Chris Jerdonek.
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index e1fa155..bb7c34f 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -92,7 +92,7 @@
``'b'`` binary mode
``'t'`` text mode (default)
``'+'`` open a disk file for updating (reading and writing)
- ``'U'`` universal newline mode (for backwards compatibility; should
+ ``'U'`` universal newlines mode (for backwards compatibility; should
not be used in new code)
========= ===============================================================
@@ -141,14 +141,18 @@
used. Any other error handling name that has been registered with
:func:`codecs.register_error` is also valid.
- *newline* controls how universal newlines works (it only applies to text
+ .. index::
+ single: universal newlines; open() (in module io)
+
+ *newline* controls how :term:`universal newlines` works (it only applies
+ to text
mode). It can be ``None``, ``''``, ``'\n'``, ``'\r'``, and ``'\r\n'``. It
works as follows:
* On input, if *newline* is ``None``, universal newlines mode is enabled.
Lines in the input can end in ``'\n'``, ``'\r'``, or ``'\r\n'``, and these
are translated into ``'\n'`` before being returned to the caller. If it is
- ``''``, universal newline mode is enabled, but line endings are returned to
+ ``''``, universal newlines mode is enabled, but line endings are returned to
the caller untranslated. If it has any of the other legal values, input
lines are only terminated by the given string, and the line ending is
returned to the caller untranslated.
@@ -754,13 +758,17 @@
sequences) can be used. Any other error handling name that has been
registered with :func:`codecs.register_error` is also valid.
+ .. index::
+ single: universal newlines; io.TextIOWrapper class
+
*newline* controls how line endings are handled. It can be ``None``,
``''``, ``'\n'``, ``'\r'``, and ``'\r\n'``. It works as follows:
- * On input, if *newline* is ``None``, universal newlines mode is enabled.
+ * On input, if *newline* is ``None``, :term:`universal newlines` mode is
+ enabled.
Lines in the input can end in ``'\n'``, ``'\r'``, or ``'\r\n'``, and these
are translated into ``'\n'`` before being returned to the caller. If it is
- ``''``, universal newline mode is enabled, but line endings are returned to
+ ``''``, universal newlines mode is enabled, but line endings are returned to
the caller untranslated. If it has any of the other legal values, input
lines are only terminated by the given string, and the line ending is
returned to the caller untranslated.
@@ -817,10 +825,13 @@
output.close()
+.. index::
+ single: universal newlines; io.IncrementalNewlineDecoder class
+
.. class:: IncrementalNewlineDecoder
- A helper codec that decodes newlines for universal newlines mode. It
- inherits :class:`codecs.IncrementalDecoder`.
+ A helper codec that decodes newlines for :term:`universal newlines` mode.
+ It inherits :class:`codecs.IncrementalDecoder`.
Advanced topics