diff options
author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2017-10-06 09:00:00 +0000 |
---|---|---|
committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2017-10-06 09:00:00 +0000 |
commit | c431f3482c62b0a217a5a5940d4b59dcf12e1a89 (patch) | |
tree | 7da5e07a084869b72aad8f2f8ffec5e3a4ea76af /docutils | |
parent | 524ee9a506b22dcd04cf6c1583a43f9711501388 (diff) | |
download | docutils-c431f3482c62b0a217a5a5940d4b59dcf12e1a89.tar.gz |
Add field name as class argument to generic docinfo fields unconditionally.
Also add the field name, if the DocInfo tranform fails to
converts a bibliographic field list into a docinfo element.
This allows styling of, e.g., a "copyright" element that also contains
a license as separate paragraph when suppressing the warning (cf. Bug [325]).
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8183 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
-rw-r--r-- | docutils/HISTORY.txt | 4 | ||||
-rw-r--r-- | docutils/docutils/transforms/frontmatter.py | 8 | ||||
-rwxr-xr-x | docutils/test/test_transforms/test_docinfo.py | 18 |
3 files changed, 17 insertions, 13 deletions
diff --git a/docutils/HISTORY.txt b/docutils/HISTORY.txt index c315372f0..89059f27a 100644 --- a/docutils/HISTORY.txt +++ b/docutils/HISTORY.txt @@ -34,6 +34,10 @@ Changes Since 0.14 - Fix [ 281 ] Remove escaping backslashes in meta directive content. +* docutils/transforms/frontmatter.py + + - Add field name as class argument to generic docinfo fields unconditionally. + * docutils/writers/html5_polyglot/ - automatically add HTML5-compatible meta tags for docinfo items diff --git a/docutils/docutils/transforms/frontmatter.py b/docutils/docutils/transforms/frontmatter.py index 1b5f552dd..147ebe65b 100644 --- a/docutils/docutils/transforms/frontmatter.py +++ b/docutils/docutils/transforms/frontmatter.py @@ -433,10 +433,10 @@ class DocInfo(Transform): and isinstance(field[-1][0], nodes.paragraph): utils.clean_rcs_keywords( field[-1][0], self.rcs_keyword_substitutions) - if normedname not in bibliofields: - classvalue = nodes.make_id(normedname) - if classvalue: - field['classes'].append(classvalue) + # if normedname not in bibliofields: + classvalue = nodes.make_id(normedname) + if classvalue: + field['classes'].append(classvalue) docinfo.append(field) nodelist = [] if len(docinfo) != 0: diff --git a/docutils/test/test_transforms/test_docinfo.py b/docutils/test/test_transforms/test_docinfo.py index bab166d56..d29633517 100755 --- a/docutils/test/test_transforms/test_docinfo.py +++ b/docutils/test/test_transforms/test_docinfo.py @@ -95,7 +95,7 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ me@my.org <version> 1 - <field> + <field classes="abstract"> <field_name> Abstract <field_body> @@ -133,7 +133,7 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ """\ <document source="test data"> <docinfo> - <field> + <field classes="author"> <field_name> Author <field_body> @@ -149,7 +149,7 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ <emphasis> simple paragraph - <field> + <field classes="date"> <field_name> Date <field_body> @@ -160,7 +160,7 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ <system_message level="2" line="3" source="test data" type="WARNING"> <paragraph> Cannot extract compound bibliographic field "Date". - <field> + <field classes="version"> <field_name> Version <field_body> @@ -253,14 +253,14 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ """\ <document source="test data"> <docinfo> - <field> + <field classes="authors"> <field_name> Authors <field_body> <system_message level="2" line="1" source="test data" type="WARNING"> <paragraph> Cannot extract empty bibliographic field "Authors". - <field> + <field classes="authors"> <field_name> Authors <field_body> @@ -274,7 +274,7 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ <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. - <field> + <field classes="authors"> <field_name> Authors <field_body> @@ -284,7 +284,7 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ <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. - <field> + <field classes="authors"> <field_name> Authors <field_body> @@ -297,7 +297,7 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ <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. - <field> + <field classes="authors"> <field_name> Authors <field_body> |