summaryrefslogtreecommitdiff
path: root/docutils
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2021-03-20 23:47:07 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2021-03-20 23:47:07 +0000
commit0160cfcb5dcd51113106e63002b53345a9b57abc (patch)
treeabc8e04ddc07e1a090cf64bf684bb610f8273a88 /docutils
parentb0f7fde9a7f9b64f82d030e6d7d92b7fa8ce87aa (diff)
downloaddocutils-0160cfcb5dcd51113106e63002b53345a9b57abc.tar.gz
Update comments and advertised future changes.
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8638 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
-rw-r--r--docutils/RELEASE-NOTES.txt10
-rw-r--r--docutils/docutils/writers/_html_base.py20
-rw-r--r--docutils/docutils/writers/html4css1/__init__.py13
3 files changed, 24 insertions, 19 deletions
diff --git a/docutils/RELEASE-NOTES.txt b/docutils/RELEASE-NOTES.txt
index 0a3141c35..e3659b560 100644
--- a/docutils/RELEASE-NOTES.txt
+++ b/docutils/RELEASE-NOTES.txt
@@ -26,8 +26,14 @@ Future changes
and/or ``\DUtitle`` or set to "True".
* `html5` writer:
- Use <aside> instad of <dl> for footnote text and citations
- and <nav> instead of <div> for the Table of Contents.
+ Semantic tags:
+ Use <aside> instad of <dl> for footnote text and citations,
+ <aside> for topics (except abstract), admonitions, and system messages,
+ and <nav> for the Table of Contents.
+
+ Write footnote brackets and field term colons to HTML, so that
+ they are present also without CSS and when copying text.
+ Hide with CSS if required.
Use <summary> and <details> tags for term and definition of a
definition list with class value "details".
diff --git a/docutils/docutils/writers/_html_base.py b/docutils/docutils/writers/_html_base.py
index 47154c4cb..67fd54cee 100644
--- a/docutils/docutils/writers/_html_base.py
+++ b/docutils/docutils/writers/_html_base.py
@@ -244,7 +244,7 @@ class HTMLTranslator(nodes.NodeVisitor):
Used by visit_* and depart_* functions in conjunction with the tree
traversal. Make sure that the pops correspond to the pushes."""
- self.topic_classes = [] # TODO: replace with self_in_contents
+ self.topic_classes = []
self.colspecs = []
self.compact_p = True
self.compact_simple = False
@@ -515,7 +515,8 @@ class HTMLTranslator(nodes.NodeVisitor):
and not self.settings.compact_lists):
return False
# more special cases:
- if (self.topic_classes == ['contents']): # TODO: self.in_contents
+ if (self.topic_classes == ['contents']):
+ # TODO: look for "auto-toc" instead and remove self.topic_classes
return True
# check the list items:
return self.check_simple_list(node)
@@ -973,14 +974,16 @@ class HTMLTranslator(nodes.NodeVisitor):
imagedata = imagefile.read()
except IOError as err:
err_msg = str(err)
- if not err_msg:
- # TODO (test mimetype for SVG and insert directly)
+ if not err_msg:
+ # TODO: insert SVG as-is?
+ # if mimetype == 'image/svg+xml':
+ # read/parse, apply arguments,
+ # insert as <svg ....> ... </svg> # (about 1/3 less data)
data64 = base64.b64encode(imagedata).decode()
uri = u'data:%s;base64,%s' % (mimetype, data64)
else:
# raise NotImplementedError(os.getcwd() + err_msg)
self.document.reporter.error("Cannot embed image\n "+err_msg)
-
if mimetype == 'application/x-shockwave-flash':
atts['type'] = mimetype
# do NOT use an empty tag: incorrect rendering in browsers
@@ -1373,7 +1376,6 @@ class HTMLTranslator(nodes.NodeVisitor):
def depart_rubric(self, node):
self.body.append('</p>\n')
- # TODO: use the new HTML 5 element <section>?
def visit_section(self, node):
self.section_level += 1
self.body.append(
@@ -1383,7 +1385,7 @@ class HTMLTranslator(nodes.NodeVisitor):
self.section_level -= 1
self.body.append('</div>\n')
- # TODO: use the new HTML5 element <aside>? (Also for footnote text)
+ # TODO: use the new HTML5 element <aside>
def visit_sidebar(self, node):
self.body.append(
self.starttag(node, 'div', CLASS='sidebar'))
@@ -1586,17 +1588,13 @@ class HTMLTranslator(nodes.NodeVisitor):
def depart_title_reference(self, node):
self.body.append('</cite>')
- # TODO: use the new HTML5 element <aside>? (Also for footnote text)
def visit_topic(self, node):
self.body.append(self.starttag(node, 'div', CLASS='topic'))
self.topic_classes = node['classes']
- # TODO: replace with ::
- # self.in_contents = 'contents' in node['classes']
def depart_topic(self, node):
self.body.append('</div>\n')
self.topic_classes = []
- # TODO self.in_contents = False
def visit_transition(self, node):
self.body.append(self.emptytag(node, 'hr', CLASS='docutils'))
diff --git a/docutils/docutils/writers/html4css1/__init__.py b/docutils/docutils/writers/html4css1/__init__.py
index 4e4a57b29..b49c17bcc 100644
--- a/docutils/docutils/writers/html4css1/__init__.py
+++ b/docutils/docutils/writers/html4css1/__init__.py
@@ -537,13 +537,15 @@ class HTMLTranslator(writers._html_base.HTMLTranslator):
def visit_generated(self, node):
pass
- # Use <object> instead of <img> for some image types:
-
- # SVG not supported by IE up to version 8
- # (html4css1 strives for IE6 compatibility)
+ # Backwards-compatibility implementation:
+ # * Do not use <video>,
+ # * don't embed images,
+ # * use <object> instead of <img> for SVG.
+ # (SVG not supported by IE up to version 8,
+ # html4css1 strives for IE6 compatibility.)
object_image_types = {'.svg': 'image/svg+xml',
'.swf': 'application/x-shockwave-flash'}
-
+ #
def visit_image(self, node):
atts = {}
uri = node['uri']
@@ -621,7 +623,6 @@ class HTMLTranslator(writers._html_base.HTMLTranslator):
def depart_label(self, node):
self.body.append(']%s</td><td>%s' % (self.context.pop(), self.context.pop()))
-
# ersatz for first/last pseudo-classes
def visit_list_item(self, node):
self.body.append(self.starttag(node, 'li', ''))