diff options
author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2023-04-17 20:26:33 +0000 |
---|---|---|
committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2023-04-17 20:26:33 +0000 |
commit | 1a859be41be1f96d08ac96ef2ce1d5140562ecb5 (patch) | |
tree | 58e56a529d0e9d4c753a6c47feba82a91430e7c6 | |
parent | 93bbf92b92034c1ebb04fba09f5dc8306ecdd121 (diff) | |
download | docutils-1a859be41be1f96d08ac96ef2ce1d5140562ecb5.tar.gz |
Fix test failure introduced in [r9348].
Reword and wrap warning message for incompatible content
of the bibliographic field "author".
Adapt "frontmatter" unit test cases.
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9351 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r-- | docutils/docutils/transforms/frontmatter.py | 17 | ||||
-rwxr-xr-x | docutils/test/test_transforms/test_docinfo.py | 28 |
2 files changed, 33 insertions, 12 deletions
diff --git a/docutils/docutils/transforms/frontmatter.py b/docutils/docutils/transforms/frontmatter.py index 08fcea387..eea11ea3f 100644 --- a/docutils/docutils/transforms/frontmatter.py +++ b/docutils/docutils/transforms/frontmatter.py @@ -513,14 +513,15 @@ class DocInfo(Transform): raise TransformError except TransformError: field[-1] += self.document.reporter.warning( - 'Bibliographic field "%s" incompatible with extraction: ' - '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. Remember that leading initials can cause ' - '(mis)recognizing names as enumerated lists.' - % (name, ''.join(self.language.author_separators)), - base_node=field) + f'Cannot extract "{name}" from bibliographic field:\n' + f'Bibliographic field "{name}" must contain either\n' + ' a single paragraph (with author names separated by one of ' + f'"{"".join(self.language.author_separators)}"),\n' + ' multiple paragraphs (one per author),\n' + ' or a bullet list with one author name per item.\n' + 'Note: Leading initials can cause (mis)recognizing names ' + 'as enumerated list.', + base_node=field) raise def authors_from_one_paragraph(self, field): diff --git a/docutils/test/test_transforms/test_docinfo.py b/docutils/test/test_transforms/test_docinfo.py index b925518fb..73a0ff46f 100755 --- a/docutils/test/test_transforms/test_docinfo.py +++ b/docutils/test/test_transforms/test_docinfo.py @@ -358,7 +358,12 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ Shaw <system_message level="2" line="3" source="test data" type="WARNING"> <paragraph> - Bibliographic field "Authors" incompatible with extraction: it must contain either a single paragraph (with authors separated by one of ";,"), multiple paragraphs (one per author), or a bullet list with one paragraph (one author) per item. Remember that leading initials can cause (mis)recognizing names as enumerated lists. + Cannot extract "Authors" from bibliographic field: + Bibliographic field "Authors" must contain either + a single paragraph (with author names separated by one of ";,"), + multiple paragraphs (one per author), + or a bullet list with one author name per item. + Note: Leading initials can cause (mis)recognizing names as enumerated list. <field classes="authors"> <field_name> Authors @@ -368,7 +373,12 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ <list_item> <system_message level="2" line="6" source="test data" type="WARNING"> <paragraph> - Bibliographic field "Authors" incompatible with extraction: it must contain either a single paragraph (with authors separated by one of ";,"), multiple paragraphs (one per author), or a bullet list with one paragraph (one author) per item. Remember that leading initials can cause (mis)recognizing names as enumerated lists. + Cannot extract "Authors" from bibliographic field: + Bibliographic field "Authors" must contain either + a single paragraph (with author names separated by one of ";,"), + multiple paragraphs (one per author), + or a bullet list with one author name per item. + Note: Leading initials can cause (mis)recognizing names as enumerated list. <field classes="authors"> <field_name> Authors @@ -381,7 +391,12 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ Two <system_message level="2" line="10" source="test data" type="WARNING"> <paragraph> - Bibliographic field "Authors" incompatible with extraction: it must contain either a single paragraph (with authors separated by one of ";,"), multiple paragraphs (one per author), or a bullet list with one paragraph (one author) per item. Remember that leading initials can cause (mis)recognizing names as enumerated lists. + Cannot extract "Authors" from bibliographic field: + Bibliographic field "Authors" must contain either + a single paragraph (with author names separated by one of ";,"), + multiple paragraphs (one per author), + or a bullet list with one author name per item. + Note: Leading initials can cause (mis)recognizing names as enumerated list. <field classes="authors"> <field_name> Authors @@ -394,7 +409,12 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ Two <system_message level="2" line="15" source="test data" type="WARNING"> <paragraph> - Bibliographic field "Authors" incompatible with extraction: it must contain either a single paragraph (with authors separated by one of ";,"), multiple paragraphs (one per author), or a bullet list with one paragraph (one author) per item. Remember that leading initials can cause (mis)recognizing names as enumerated lists. + Cannot extract "Authors" from bibliographic field: + Bibliographic field "Authors" must contain either + a single paragraph (with author names separated by one of ";,"), + multiple paragraphs (one per author), + or a bullet list with one author name per item. + Note: Leading initials can cause (mis)recognizing names as enumerated list. """], ["""\ .. RCS keyword extraction. |