|
From: <mi...@us...> - 2021-06-25 20:56:24
|
Revision: 8772
http://sourceforge.net/p/docutils/code/8772
Author: milde
Date: 2021-06-25 20:56:23 +0000 (Fri, 25 Jun 2021)
Log Message:
-----------
HTML5: small fixes, preparation for footnote handling refactoring.
Modified Paths:
--------------
trunk/docutils/docs/ref/doctree.txt
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/parsers/rst/states.py
trunk/docutils/docutils/writers/_html_base.py
trunk/docutils/docutils/writers/html5_polyglot/math.css
trunk/docutils/docutils/writers/html5_polyglot/minimal.css
trunk/docutils/docutils/writers/html5_polyglot/plain.css
trunk/docutils/docutils/writers/html5_polyglot/responsive.css
Modified: trunk/docutils/docs/ref/doctree.txt
===================================================================
--- trunk/docutils/docs/ref/doctree.txt 2021-06-18 18:55:08 UTC (rev 8771)
+++ trunk/docutils/docs/ref/doctree.txt 2021-06-25 20:56:23 UTC (rev 8772)
@@ -2379,16 +2379,27 @@
``footnote`` is similar to the `DocBook "footnote"`_ element but does
not create a footnote_reference_.
- There is `no equivalent in HTML`__. The ARIA_ role `"note"`__, or the
- DPub-ARIA role `"doc-footnote"`__ may be used semantically represent
- footnotes in HTML. As the spatial positioning is not determined,
- the corresponding `epub:type`__ is the deprecated "note" (rather
- than "footnote" or "endnote").
+ There is `no equivalent in HTML`__. The ARIA role `"note"`__ may be
+ used to mark an `<aside> or <section> element`__ as "a section whose
+ content is parenthetic or ancillary to the main content of the
+ resource".
+ ``footnote`` elements can be used for both,
+
+ * notes that occur within the body of the document (`epub:type`__
+ *footnote* or DPub-ARIA role `"doc-footnote"`__) or
+
+ * collections of notes that occur at the end of a section or the
+ document (`epub:type` *endnote*,DPub-ARIA role
+ `"doc-endnotes"`__).
+
+
__ https://www.w3.org/TR/html51/common-idioms-without-dedicated-elements.html#footnotes
__ https://www.w3.org/TR/wai-aria-1.1/#note
+ __ https://www.w3.org/TR/html-aria/#docconformance
+ __ https://idpf.github.io/epub-vocabs/structure/#notes
__ https://www.w3.org/TR/dpub-aria-1.0/#doc-footnote
- __ https://idpf.github.io/epub-vocabs/structure/#notes
+ __ https://www.w3.org/TR/dpub-aria-1.0/#doc-endnotes
:Processing:
A ``footnote`` element should be set off from the rest of the
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2021-06-18 18:55:08 UTC (rev 8771)
+++ trunk/docutils/docs/user/config.txt 2021-06-25 20:56:23 UTC (rev 8772)
@@ -215,7 +215,6 @@
.. _identifier normalization:
../ref/rst/directives.html#identifier-normalization
-__ ../../RELEASE-NOTES.html#future-changes
datestamp
---------
Modified: trunk/docutils/docutils/parsers/rst/states.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/states.py 2021-06-18 18:55:08 UTC (rev 8771)
+++ trunk/docutils/docutils/parsers/rst/states.py 2021-06-25 20:56:23 UTC (rev 8772)
@@ -328,7 +328,7 @@
def check_subsection(self, source, style, lineno):
"""
- Check for a valid subsection header. Return 1 (true) or None (false).
+ Check for a valid subsection header. Return True or False.
When a new section is reached that isn't a subsection of the current
section, back up the line count (use ``previous_line(-x)``), then
@@ -350,10 +350,10 @@
except ValueError: # new title style
if len(title_styles) == memo.section_level: # new subsection
title_styles.append(style)
- return 1
+ return True
else: # not at lowest level
self.parent += self.title_inconsistent(source, lineno)
- return None
+ return False
if level <= mylevel: # sibling or supersection
memo.section_level = level # bubble up to parent section
if len(style) == 2:
@@ -362,10 +362,10 @@
self.state_machine.previous_line(len(style) + 1)
raise EOFError # let parent section re-evaluate
if level == mylevel + 1: # immediate subsection
- return 1
+ return True
else: # invalid subsection
self.parent += self.title_inconsistent(source, lineno)
- return None
+ return False
def title_inconsistent(self, sourcetext, lineno):
error = self.reporter.severe(
Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py 2021-06-18 18:55:08 UTC (rev 8771)
+++ trunk/docutils/docutils/writers/_html_base.py 2021-06-25 20:56:23 UTC (rev 8772)
@@ -335,7 +335,6 @@
self.compact_field_list = False
self.in_docinfo = False
self.in_sidebar = False
- self.in_footnote_list = False
self.title = []
self.subtitle = []
self.header = []
@@ -624,22 +623,10 @@
self.body.append('</p>\n')
def visit_citation(self, node):
- # Use definition list for bibliographic references.
- # Join adjacent citation entries.
- # TODO: use <aside>.
- if not self.in_footnote_list:
- listnode = node.copy()
- listnode['ids'] = []
- self.body.append(self.starttag(listnode, 'dl', CLASS='citation'))
- # self.body.append('<dl class="citation">\n')
- self.in_footnote_list = True
+ self.visit_footnote(node)
def depart_citation(self, node):
- self.body.append('</dd>\n')
- if not isinstance(node.next_node(descend=False, siblings=True),
- nodes.citation):
- self.body.append('</dl>\n')
- self.in_footnote_list = False
+ self.depart_footnote(node)
def visit_citation_reference(self, node):
href = '#'
@@ -935,7 +922,6 @@
def depart_figure(self, node):
self.body.append('</div>\n')
- # use HTML 5 <footer> element?
def visit_footer(self, node):
self.context.append(len(self.body))
@@ -950,19 +936,21 @@
del self.body[start:]
def visit_footnote(self, node):
- if not self.in_footnote_list:
+ previous_node = node.parent[node.parent.index(node)-1]
+ if not isinstance(previous_node, type(node)):
listnode = node.copy()
listnode['ids'] = []
- classes = 'footnote ' + self.settings.footnote_references
+ if isinstance(node, nodes.citation):
+ classes = 'citation'
+ else:
+ classes = 'footnote ' + self.settings.footnote_references
self.body.append(self.starttag(listnode, 'dl', CLASS=classes))
- self.in_footnote_list = True
def depart_footnote(self, node):
self.body.append('</dd>\n')
if not isinstance(node.next_node(descend=False, siblings=True),
- nodes.footnote):
+ type(node)):
self.body.append('</dl>\n')
- self.in_footnote_list = False
def visit_footnote_reference(self, node):
href = '#' + node['refid']
Modified: trunk/docutils/docutils/writers/html5_polyglot/math.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/math.css 2021-06-18 18:55:08 UTC (rev 8771)
+++ trunk/docutils/docutils/writers/html5_polyglot/math.css 2021-06-25 20:56:23 UTC (rev 8772)
@@ -88,7 +88,7 @@
padding: 0ex;
border-top: thin solid;
}
-sub, sup {
+math sub, math sup {
font-size: 80%;
}
sup.numerator, sup.unit {
Modified: trunk/docutils/docutils/writers/html5_polyglot/minimal.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/minimal.css 2021-06-18 18:55:08 UTC (rev 8771)
+++ trunk/docutils/docutils/writers/html5_polyglot/minimal.css 2021-06-25 20:56:23 UTC (rev 8772)
@@ -1,8 +1,8 @@
/* Minimal style sheet for the HTML output of Docutils. */
/* */
/* :Author: Günter Milde, based on html4css1.css by David Goodger */
-/* :Id: $Id$ */
-/* :Copyright: © 2015 Günter Milde. */
+/* :Id: $Id$ */
+/* :Copyright: © 2015, 2021 Günter Milde. */
/* :License: Released under the terms of the `2-Clause BSD license`_, */
/* in short: */
/* */
@@ -14,11 +14,10 @@
/* */
/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause */
-/* This CSS2.1_ stylesheet defines rules for Docutils elements without */
-/* HTML equivalent. It is required to make the document semantic visible. */
-/* */
-/* .. _CSS2.1: http://www.w3.org/TR/CSS2 */
-/* .. _validates: http://jigsaw.w3.org/css-validator/validator$link */
+/* This CSS3 stylesheet defines rules for Docutils elements without */
+/* HTML equivalent. It is required to make the document semantics visible. */
+/* */
+/* .. _validates: http://jigsaw.w3.org/css-validator/validator$link */
/* titles */
p.topic-title,
@@ -76,7 +75,6 @@
/* Nested Paragraphs */
p:first-child { margin-top: 0; }
p:last-child { margin-bottom: 0; }
-td > p, th > p { margin-bottom: 0; }
/* Table of Contents */
.topic.contents { margin: 0.5em 0; }
Modified: trunk/docutils/docutils/writers/html5_polyglot/plain.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/plain.css 2021-06-18 18:55:08 UTC (rev 8771)
+++ trunk/docutils/docutils/writers/html5_polyglot/plain.css 2021-06-25 20:56:23 UTC (rev 8772)
@@ -27,7 +27,7 @@
--field-indent: 9em; /* default indent of fields in field lists */
}
main, footer, header {
- line-height:1.3;
+ line-height:1.6;
/* avoid long lines --> better reading */
/* optimum is 45…75 characters/line <http://webtypography.net/2.1.2> */
/* OTOH: lines should not be too short because of missing hyphenation, */
@@ -59,14 +59,12 @@
p, ol, ul, dl, li,
div.line-block,
div.topic,
+.footnote, .citation,
div > math,
table {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
-p:first-child { margin-top: 0; }
-/* (:last-child is new in CSS 3) */
-p:last-child { margin-bottom: 0; }
h1, h2, h3, h4, h5, h6, dd {
margin-bottom: 0.5em;
@@ -278,6 +276,8 @@
/* Inline Markup */
/* ============= */
+sup, sub { line-height: 0.8; } /* do not add leading for lines with sup/sub */
+
/* Inline Literals */
/* possible values: normal, nowrap, pre, pre-wrap, pre-line */
/* span.docutils.literal { white-space: pre-wrap; } */
Modified: trunk/docutils/docutils/writers/html5_polyglot/responsive.css
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/responsive.css 2021-06-18 18:55:08 UTC (rev 8771)
+++ trunk/docutils/docutils/writers/html5_polyglot/responsive.css 2021-06-25 20:56:23 UTC (rev 8772)
@@ -40,11 +40,15 @@
margin: auto;
max-width: 100rem;
}
+sup, sub { /* avoid additional inter-line space for lines with sup/sub */
+ line-height: 1;
+}
/* Vertical Space (Parskip) */
p, ol, ul, dl, li,
div.line-block,
div.topic,
+.footnote, .citation,
div > math,
table {
margin-top: 0.5em;
@@ -173,17 +177,10 @@
}
/* Footnotes and Citations */
-dl.footnote {
+.footnote {
font-size: small;
- padding-left: 0.5em;
- border-left: solid;
- border-left-width: thin;
}
-dl.citation > dt.label span.fn-bracket {
- display: none;
-}
-
/* Images, Figures, and Tables */
img {
display: block;
@@ -281,10 +278,10 @@
overflow-wrap: inherit;
}
/* Undecorated Links */
-/* a.footnote-reference, a.fn-backref, .fn-backref a, */
/* a.citation-reference, */
+/* .contents a, */
.citation a.fn-backref,
-.contents a, a.toc-backref {
+a.toc-backref {
color: inherit;
}
a:link:hover {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|