|
From: <mi...@us...> - 2017-02-03 14:44:18
|
Revision: 8021
http://sourceforge.net/p/docutils/code/8021
Author: milde
Date: 2017-02-03 14:44:16 +0000 (Fri, 03 Feb 2017)
Log Message:
-----------
Provide default title in metadata.
In HTML5, <title> is a required child of the <head> element
and it must not be empty (found with https://validator.w3.org/check)
If there is no given title, we use the source file name as default and
fall back to "docutils document without title" if there is no source file.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/_html_base.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2017-02-02 16:05:23 UTC (rev 8020)
+++ trunk/docutils/HISTORY.txt 2017-02-03 14:44:16 UTC (rev 8021)
@@ -38,13 +38,17 @@
- Added ``split_escaped_whitespace`` function, support for escaped
whitespace in URI contexts.
-* docutils/utils/smartquotes.py:
+* docutils/utils/smartquotes.py:
- Update quote definitions for languages et, fi, ro, sv, tr, uk.
- New quote definitions for hr, hsb, hu, lv, sl.
-
+
+* docutils/writers/_html_base.py
+
+ - Provide default title in metadata (required by HTML5).
+
* tools/rst2html4.py: New front-end.
-
+
* tools/dev/generate_punctuation_chars.py: New skript
to test and update utils.punctuation_chars.
Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py 2017-02-02 16:05:23 UTC (rev 8020)
+++ trunk/docutils/docutils/writers/_html_base.py 2017-02-03 14:44:16 UTC (rev 8021)
@@ -691,8 +691,9 @@
self.body.append('\n</pre>\n')
def visit_document(self, node):
- self.head.append('<title>%s</title>\n'
- % self.encode(node.get('title', '')))
+ title = (node.get('title', '') or os.path.basename(node['source'])
+ or 'docutils document without title')
+ self.head.append('<title>%s</title>\n' % self.encode(title))
def depart_document(self, node):
self.head_prefix.extend([self.doctype,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|