summaryrefslogtreecommitdiff
path: root/docutils
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2023-04-14 00:12:07 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2023-04-14 00:12:07 +0000
commite2085e51190deb015cc8a55a174985f2b12a395a (patch)
treeb9d5029fb18b6b10986a779ffda91a7f51f4feb7 /docutils
parent2fce05d9733d040b27810d893c4a65431083e45b (diff)
downloaddocutils-e2085e51190deb015cc8a55a174985f2b12a395a.tar.gz
Fix test for spurious enumerated lists in bibliographic fields.
The test for "single line paragraphs" failed for bibliographic fields followed by an empty line. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9348 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
-rw-r--r--docutils/docutils/transforms/frontmatter.py5
-rwxr-xr-xdocutils/test/test_transforms/test_docinfo.py3
2 files changed, 6 insertions, 2 deletions
diff --git a/docutils/docutils/transforms/frontmatter.py b/docutils/docutils/transforms/frontmatter.py
index 2f4384f95..08fcea387 100644
--- a/docutils/docutils/transforms/frontmatter.py
+++ b/docutils/docutils/transforms/frontmatter.py
@@ -466,7 +466,7 @@ class DocInfo(Transform):
# enumerated list
# https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#enumerated-lists
if (isinstance(f_body[0], nodes.enumerated_list)
- and '\n' not in f_body.rawsource):
+ and '\n' not in f_body.rawsource.strip()):
# parse into a dummy document and use created nodes
_document = utils.new_document('*DocInfo transform*',
field.document.settings)
@@ -517,7 +517,8 @@ class DocInfo(Transform):
'it must contain either a single paragraph (with authors '
'separated by one of "%s"), multiple paragraphs (one per '
'author), or a bullet list with one paragraph (one author) '
- 'per item.'
+ 'per item. Remember that leading initials can cause '
+ '(mis)recognizing names as enumerated lists.'
% (name, ''.join(self.language.author_separators)),
base_node=field)
raise
diff --git a/docutils/test/test_transforms/test_docinfo.py b/docutils/test/test_transforms/test_docinfo.py
index 400b7a68e..b1e4f2efc 100755
--- a/docutils/test/test_transforms/test_docinfo.py
+++ b/docutils/test/test_transforms/test_docinfo.py
@@ -75,8 +75,11 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [
It is automatically moved to the end of the other bibliographic elements.
:Author: E. *Xample*
+
:Version: 1
+
:Date: 2001-08-11
+
:Parameter i: integer
""",
"""\