From 8ee3b5c9bd76c76a8b5010bcfdd6fc2731635a03 Mon Sep 17 00:00:00 2001 From: milde Date: Fri, 6 Mar 2015 15:43:11 +0000 Subject: [PATCH] New CSS 2.1 style-sheet for xhtml11 writer. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7809 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- HISTORY.txt | 7 +- docs/user/rst/images/biohazard-bitmap.svg | 50 +++ docutils/writers/html4css1/__init__.py | 14 +- docutils/writers/xhtml11/__init__.py | 200 ++++++--- docutils/writers/xhtml11/html-base.css | 492 ++++++++++++++++++++ docutils/writers/xhtml11/xhtml11.css | 493 +++++---------------- .../expected/standalone_rst_xhtml11.xhtml | 194 ++++---- test/functional/input/data/html-base.css | 1 + test/functional/input/data/svg_images.txt | 38 +- test/functional/input/standalone_rst_xhtml11.txt | 52 ++- test/functional/tests/standalone_rst_xhtml11.py | 4 +- 11 files changed, 959 insertions(+), 586 deletions(-) create mode 100644 docs/user/rst/images/biohazard-bitmap.svg create mode 100644 docutils/writers/xhtml11/html-base.css rewrite docutils/writers/xhtml11/xhtml11.css (73%) create mode 120000 test/functional/input/data/html-base.css diff --git a/HISTORY.txt b/HISTORY.txt index 0b73bd5af..44f25ee83 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -43,14 +43,9 @@ Changes Since 0.12 * docutils/writers/xhtml11/ - - New HTML writer generating `XHTML1.1`_ styled with CSS2. + - New HTML writer generating `XHTML1.1`_ styled with CSS2.1 Moved to the docutils core from sandbox/html4strict. - - Wrap SVG images in tags not . - Addresses bug [ 247 ], but rendering problems remain - (see test/functional/expected/standalone_rst_xhtml11.xhtml), - so we might need a config setting. - .. _XHTML1.1: http://www.w3.org/TR/xhtml11/ * docutils/writers/latex2e/__init__.py diff --git a/docs/user/rst/images/biohazard-bitmap.svg b/docs/user/rst/images/biohazard-bitmap.svg new file mode 100644 index 000000000..8b92ff1b6 --- /dev/null +++ b/docs/user/rst/images/biohazard-bitmap.svg @@ -0,0 +1,50 @@ + + + + + + + + image/svg+xml + + + + + + + + turned + diff --git a/docutils/writers/html4css1/__init__.py b/docutils/writers/html4css1/__init__.py index 9ceb7fde1..e031367b3 100644 --- a/docutils/writers/html4css1/__init__.py +++ b/docutils/writers/html4css1/__init__.py @@ -305,7 +305,8 @@ class HTMLTranslator(nodes.NodeVisitor): # A heterogenous stack used in conjunction with the tree traversal. # Make sure that the pops correspond to the pushes: self.context = [] - self.topic_classes = [] + + self.topic_classes = [] # TODO: replace with self_in_contents self.colspecs = [] self.compact_p = True self.compact_simple = False @@ -568,6 +569,7 @@ class HTMLTranslator(nodes.NodeVisitor): and 'open' not in node['classes'] and (self.compact_simple or self.topic_classes == ['contents'] + # TODO: self.in_contents or self.check_simple_list(node)))) def visit_bullet_list(self, node): @@ -964,11 +966,10 @@ class HTMLTranslator(nodes.NodeVisitor): self.context.append('' % backrefs[0]) else: - i = 1 - for backref in backrefs: + # Python 2.4 fails with enumerate(backrefs, 1) + for (i, backref) in enumerate(backrefs): backlinks.append('%s' - % (backref, i)) - i += 1 + % (backref, i+1)) self.context.append('(%s) ' % ', '.join(backlinks)) self.context += ['', ''] else: @@ -1676,10 +1677,13 @@ class HTMLTranslator(nodes.NodeVisitor): 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('\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/writers/xhtml11/__init__.py b/docutils/writers/xhtml11/__init__.py index e95d75e97..f28a98d9c 100644 --- a/docutils/writers/xhtml11/__init__.py +++ b/docutils/writers/xhtml11/__init__.py @@ -40,12 +40,13 @@ class Writer(html4css1.Writer): 'xhtml11', 'xhtml1css2') """Formats this writer supports.""" - default_stylesheets = ['html4css1.css', 'xhtml11.css'] + default_stylesheets = ['html-base.css', 'xhtml11.css'] default_stylesheet_dirs = ['.', os.path.abspath(os.path.dirname(__file__)), + # for math.css: os.path.abspath(os.path.join( os.path.dirname(os.path.dirname(__file__)), 'html4css1')) - ] + ] config_section = 'xhtml11 writer' config_section_dependencies = ('writers', 'html4css1 writer') @@ -97,6 +98,9 @@ class HTMLTranslator(html4css1.HTMLTranslator): ' xml:lang="%(lang)s">\n\n') lang_attribute = 'xml:lang' # changed from 'lang' in XHTML 1.0 + def __init__(self, document): + html4css1.HTMLTranslator.__init__(self, document) + self.in_footnote_list = False # Do not mark the first child with 'class="first"' and the last # child with 'class="last"' in definitions, table cells, field @@ -108,9 +112,10 @@ class HTMLTranslator(html4css1.HTMLTranslator): # Compact lists # ------------ - # Include field lists (in addition to ordered and unordered lists) - # in the test if a list is "simple" (cf. the html4css1.HTMLTranslator - # docstring and the SimpleListChecker class at the end of this file). + # Include definition lists and field lists (in addition to ordered + # and unordered lists) in the test if a list is "simple" (cf. the + # html4css1.HTMLTranslator docstring and the SimpleListChecker class at + # the end of this file). def is_compactable(self, node): # print "is_compactable %s ?" % node.__class__, @@ -122,8 +127,9 @@ class HTMLTranslator(html4css1.HTMLTranslator): # print "explicitely open" return False # check config setting: - if (isinstance(node, nodes.field_list) and - not self.settings.compact_field_lists): + if (isinstance(node, nodes.field_list) or + isinstance(node, nodes.definition_list) + ) and not self.settings.compact_field_lists: # print "`compact-field-lists` is False" return False if (isinstance(node, nodes.enumerated_list) or @@ -132,8 +138,7 @@ class HTMLTranslator(html4css1.HTMLTranslator): # print "`compact-lists` is False" return False # more special cases: - if (self.compact_simple or self.topic_classes == ['contents']): - # print "self.compact_simple is True" + if (self.topic_classes == ['contents']): # TODO: self.in_contents return True # check the list items: visitor = SimpleListChecker(self.document) @@ -146,25 +151,74 @@ class HTMLTranslator(html4css1.HTMLTranslator): # print "simple list" return True + # address, literal block, and doctest block: no newline after
 tag
+    # (leads to blank line in XHTML1.1)
+    def visit_address(self, node):
+        self.visit_docinfo_item(node, 'address', meta=False)
+        self.body.append(self.starttag(node, 'pre',suffix='',
+                                       CLASS='address'))
+
+    # author, authors
+    # ---------------
+    # Use paragraphs instead of hard-coded linebreaks.
+
+    def visit_author(self, node):
+        if not(isinstance(node.parent, nodes.authors)):
+            self.visit_docinfo_item(node, 'author')
+        self.body.append('

') + + def depart_author(self, node): + self.body.append('

') + if isinstance(node.parent, nodes.authors): + self.body.append('\n') + else: + self.depart_docinfo_item() + + def visit_authors(self, node): + self.visit_docinfo_item(node, 'authors') + + def depart_authors(self, node): + self.depart_docinfo_item() + # citations # --------- # Use definition list instead of table for bibliographic references. # Join adjacent citation entries. def visit_citation(self, node): - if self.body[-1] == '<-- next citation -->': - del(self.body[-1]) - else: - self.body.append('
') - self.context.append(self.starttag(node, 'dd')) - self.footnote_backrefs(node) + if not self.in_footnote_list: + self.body.append('
\n') + self.in_footnote_list = True def depart_citation(self, node): self.body.append('\n') - if isinstance(node.next_node(), nodes.citation): - self.body.append('<-- next citation -->') - else: + if not isinstance(node.next_node(descend=False, siblings=True), + nodes.citation): self.body.append('
\n') + self.in_footnote_list = False + + # classifier + # ---------- + # don't insert classifier-delimiter here (done by CSS) + + def visit_classifier(self, node): + self.body.append(self.starttag(node, 'span', '', CLASS='classifier')) + + def depart_classifier(self, node): + self.body.append('') + + # definition list + # --------------- + # check for simple/complex list and set class attribute + + def visit_definition_list(self, node): + classes = node.setdefault('classes', []) + if self.is_compactable(node): + classes.append('simple') + self.body.append(self.starttag(node, 'dl')) + + def depart_definition_list(self, node): + self.body.append('
\n') # docinfo # ------- @@ -178,7 +232,7 @@ class HTMLTranslator(html4css1.HTMLTranslator): def depart_docinfo(self, node): self.body.append('\n') - + def visit_docinfo_item(self, node, name, meta=True): if meta: meta_tag = '\n' \ @@ -191,6 +245,14 @@ class HTMLTranslator(html4css1.HTMLTranslator): def depart_docinfo_item(self): self.body.append('\n') + # doctest-block + # ------------- + # no line-break + # TODO: RSt-parser should treat this as code-block with class "pycon". + + def visit_doctest_block(self, node): + self.body.append(self.starttag(node, 'pre', suffix='', + CLASS='code pycon doctest-block')) # enumerated lists # ---------------- @@ -200,18 +262,17 @@ class HTMLTranslator(html4css1.HTMLTranslator): def visit_enumerated_list(self, node): atts = {} if 'start' in node: - atts['style'] = 'counter-reset: item %d;' % ( - node['start'] - 1) + atts['style'] = 'counter-reset: item %d;' % (node['start'] - 1) classes = node.setdefault('classes', []) if 'enumtype' in node: classes.append(node['enumtype']) - if self.is_compactable(node) and not self.compact_simple: + if self.is_compactable(node): classes.append('simple') - # @@@ To do: prefix, suffix. (?) - self.context.append((self.compact_simple, self.compact_p)) - self.compact_p = False self.body.append(self.starttag(node, 'ol', **atts)) + def depart_enumerated_list(self, node): + self.body.append('\n') + # field-list # ---------- # set as definition list, styled with CSS @@ -219,16 +280,12 @@ class HTMLTranslator(html4css1.HTMLTranslator): def visit_field_list(self, node): # Keep simple paragraphs in the field_body to enable CSS # rule to start body on new line if the label is too long - self.context.append((self.compact_field_list, self.compact_p)) - self.compact_field_list, self.compact_p = False, False - # classes = 'field-list' if (self.is_compactable(node)): classes += ' simple' self.body.append(self.starttag(node, 'dl', CLASS=classes)) def depart_field_list(self, node): - self.compact_field_list, self.compact_p = self.context.pop() self.body.append('\n') def visit_field(self, node): @@ -254,22 +311,16 @@ class HTMLTranslator(html4css1.HTMLTranslator): # use definition list instead of table for footnote text def visit_footnote(self, node): - if self.body[-1] == '<-- next footnote -->': - del(self.body[-1]) - else: - self.body.append('
') - self.context.append(self.starttag(node, 'dd')) - self.footnote_backrefs(node) + if not self.in_footnote_list: + self.body.append('
\n') + self.in_footnote_list = True def depart_footnote(self, node): self.body.append('\n') - next_siblings = node.traverse(descend=False, siblings=True, - include_self=False) - next = next_siblings and next_siblings[0] - if isinstance(next, nodes.footnote): - self.body.append('<-- next footnote -->') - else: + if not isinstance(node.next_node(descend=False, siblings=True), + nodes.footnote): self.body.append('
\n') + self.in_footnote_list = False # footnote and citation label def label_delim(self, node, bracket, superscript): @@ -279,25 +330,33 @@ class HTMLTranslator(html4css1.HTMLTranslator): return bracket else: return superscript - else: - assert isinstance(node.parent, nodes.citation) - return bracket + assert isinstance(node.parent, nodes.citation) + return bracket def visit_label(self, node): - # Context added in footnote_backrefs. - suffix = '%s%s' % (self.context.pop(), - self.label_delim(node, '[', '')) - self.body.append(self.starttag(node, 'dt', suffix, CLASS='label')) + # pass parent node to get id into starttag: + self.body.append(self.starttag(node.parent, 'dt', '', CLASS='label')) + # footnote/citation backrefs: + if self.settings.footnote_backlinks: + backrefs = node.parent['backrefs'] + if len(backrefs) == 1: + self.body.append('' + % backrefs[0]) + self.body.append(self.label_delim(node, '[', '')) def depart_label(self, node): - delim = self.label_delim(node, ']', '') - # Context added in footnote_backrefs. - backref = self.context.pop() - text = self.context.pop() - #
starttag added in visit_footnote() / visit_citation() - starttag = self.context.pop() - self.body.append('%s%s\n%s%s' % (delim, backref, starttag, text)) - + self.body.append(self.label_delim(node, ']', '')) + if self.settings.footnote_backlinks: + backrefs = node.parent['backrefs'] + if len(backrefs) == 1: + self.body.append('') + elif len(backrefs) > 1: + # Python 2.4 fails with enumerate(backrefs, 1) + backlinks = ['%s' % (ref, i+1) + for (i, ref) in enumerate(backrefs)] + self.body.append('(%s)' + % ','.join(backlinks)) + self.body.append('\n
') def visit_generated(self, node): if 'sectnum' in node['classes']: @@ -315,7 +374,7 @@ class HTMLTranslator(html4css1.HTMLTranslator): # Image types to place in an element # SVG as supported since IE version 9 # (but rendering problems remain (see standalonge_rst2xhtml11.xhtml test output) - object_image_types = {'.swf': 'application/x-shockwave-flash'} + # object_image_types = {'.swf': 'application/x-shockwave-flash'} # Do not mark the first child with 'class="first"' def visit_list_item(self, node): @@ -352,16 +411,10 @@ class HTMLTranslator(html4css1.HTMLTranslator): # skipped unless literal element is from "code" role: self.body.append('') - # literal block and doctest block: no newline after
 tag
-    # (leads to blank line in XHTML1.1)
     def visit_literal_block(self, node,):
         self.body.append(self.starttag(node, 'pre', suffix='',
                                        CLASS='literal-block'))
 
-    def visit_doctest_block(self, node):
-        self.body.append(self.starttag(node, 'pre', suffix='',
-                                       CLASS='doctest-block'))
-
     # Meta tags: 'lang' attribute replaced by 'xml:lang' in XHTML 1.1
     def visit_meta(self, node):
         if node.hasattr('lang'):
@@ -419,10 +472,10 @@ class HTMLTranslator(html4css1.HTMLTranslator):
     # * In XHTML 1.1, e.g. a 
element may not contain # character data, so you cannot drop the

tags. # * Keeping simple paragraphs in the field_body enables a CSS - # rule to start the field-body on new line if the label is too long + # rule to start the field-body on a new line if the label is too long # * it makes the code simpler. # - # TODO: omit paragraph tags in simple table cells. + # TODO: omit paragraph tags in simple table cells? def visit_paragraph(self, node): self.body.append(self.starttag(node, 'p', '')) @@ -430,7 +483,6 @@ class HTMLTranslator(html4css1.HTMLTranslator): def depart_paragraph(self, node): self.body.append('

') if not (isinstance(node.parent, (nodes.list_item, nodes.entry)) and - # (node is node.parent[-1]) (len(node.parent) == 1) ): self.body.append('\n') @@ -480,10 +532,8 @@ class SimpleListChecker(html4css1.SimpleListChecker): def visit_list_item(self, node): # print "visiting list item", node.__class__ - children = [] - for child in node.children: - if not isinstance(child, nodes.Invisible): - children.append(child) + children = [child for child in node.children + if not isinstance(child, nodes.Invisible)] # print "has %s visible children" % len(children) if (children and isinstance(children[0], nodes.paragraph) and (isinstance(children[-1], nodes.bullet_list) or @@ -509,11 +559,17 @@ class SimpleListChecker(html4css1.SimpleListChecker): visit_status = _simple_node visit_version = visit_list_item - # Field list items + # Definition list: + visit_definition_list = _pass_node + visit_definition_list_item = _pass_node + visit_term = _pass_node + visit_classifier = _pass_node + visit_definition = visit_list_item + + # Field list: visit_field_list = _pass_node visit_field = _pass_node # the field body corresponds to a list item - # visit_field_body = html4css1.SimpleListChecker.visit_list_item visit_field_body = visit_list_item visit_field_name = html4css1.SimpleListChecker.invisible_visit diff --git a/docutils/writers/xhtml11/html-base.css b/docutils/writers/xhtml11/html-base.css new file mode 100644 index 000000000..8dc320729 --- /dev/null +++ b/docutils/writers/xhtml11/html-base.css @@ -0,0 +1,492 @@ +/* Basic 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. */ +/* :License: Released under the terms of the `2-Clause BSD license`_, */ +/* in short: */ +/* */ +/* Copying and distribution of this file, with or without modification, */ +/* are permitted in any medium without royalty provided the copyright */ +/* notice and this notice are preserved. */ +/* */ +/* This file is offered as-is, without any warranty. */ +/* */ +/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause */ + + +/* This stylesheet contains basic rules for the output of the */ +/* Docutils HTML writers. It validates_ as CSS2.1_ */ +/* */ +/* .. _CSS2.1: http://www.w3.org/TR/CSS2 */ +/* .. _validates: http://jigsaw.w3.org/css-validator/validator$link */ + + +/* Document Structure */ +/* ****************** */ + +/* Document */ + +body { + padding: 0 5%; + margin: 8px 0; +} + +div.document { + line-height:1.3; + counter-reset: table; + /* counter-reset: figure; */ + /* avoid long lines --> better reading */ + /* OTOH: lines should not be too short because of missing hyphenation, */ + max-width: 50em; + margin: auto; +} + +.align-left { text-align: left; } +.align-right { text-align: right; } +.align-center { + clear: both; + text-align: center; +} + +/* Sections */ + +h1.title, h2.subtitle { + text-align: center; +} +h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, +h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { + margin-top: -0.25em; +} +span.section-subtitle { + /* font-size relative to parent (h1..h6 element) */ + font-size: 75%; +} + +a.toc-backref { + color: black; + text-decoration: none; +} + +/* Stop floating sidebars, images and figures at section level 1,2,3 */ +h1, h2, h3 { clear: both; } + +/* Transitions */ + +hr.docutils { + width: 80%; + margin-top: 1em; + margin-bottom: 1em; +} + +/* Paragraphs */ +/* ========== */ + +/* vertical space (parskip) */ +p, ol, ul, dl, +div.line-block, +table{ + margin-top: 0.5em; + margin-bottom: 0.5em; +} +h1, h2, h3, h4, h5, h6, +dl > dd { + margin-bottom: 0.5em; +} + +/* titles */ +p.admonition-title, +p.topic-title, +p.sidebar-title, +p.sidebar-subtitle, +p.system-message-title { + font-weight: bold; +} + +/* Warnings, Errors */ +div.caution p.admonition-title, +div.attention p.admonition-title, +div.danger p.admonition-title, +div.error p.admonition-title, +div.warning p.admonition-title, +div.system-messages h1, +div.error, +span.problematic, +p.system-message-title { + color: red; +} + +/* Lists */ +/* ========== */ + +/* compact and simple lists: no margin between items */ +dl.simple > dd, dl.compact > dd, +.compact li, .compact ul, .compact ol +.simple li, .simple ul, .simple ol, +.simple > li p, .compact > li p { + margin-top: 0; + margin-bottom: 0; +} + +/* Enumerated Lists */ + +ol.arabic { list-style: decimal } +ol.loweralpha { list-style: lower-alpha } +ol.upperalpha { list-style: upper-alpha } +ol.lowerroman { list-style: lower-roman } +ol.upperroman { list-style: upper-roman } + +/* Definition Lists */ + +dl > dd p:first-child { margin-top: 0; } +/* :last-child is not part of CSS 2.1 (introduced in CSS 3) */ +/* dl > dd p:last-child { margin-bottom: 0; } */ + +/* lists nested in definition lists */ +dd > ul, dd > ol { padding-left: 0pt; } + +dt span.classifier { font-style: italic } +dt span.classifier:before { + font-style: normal; + margin: 0.5em; + content: ":"; +} + +/* Field Lists */ + +/* bold field name, content starts on the same line */ +dl.field-list > dt, +dl.option-list > dt, +dl.docinfo > dt, +dl.footnote > dt, +dl.citation > dt, +dl.description > dt { + font-weight: bold; + clear: left; + float: left; + margin: 0; + padding: 0; + padding-right: 0.5em; +} +/* Offset for field content (corresponds to the --field-name-limit option) */ +dl.field-list > dd, +dl.option-list > dd, +dl.docinfo > dd { + margin-left: 9em; /* ca. 14 chars in the test examples */ +/* padding-left: 0.5em; */ +} +/* start field-body on a new line after long field names */ +dl.field-list > dd > *:first-child, +dl.option-list > dd > *:first-child, +dl.docinfo > dd > *:first-child { + display: inline-block; + width: 100%; + margin: 0; +} +/* field names followed by a colon */ +dl.field-list > dt:after, +dl.docinfo > dt:after { + content: ":"; +} + +/* Bibliographic Fields */ + +/* use special field-list dl.docinfo */ + +pre.address { + margin-bottom: 0; + margin-top: 0; + font: inherit; +} +dd.authors > p { margin: 0; } + +div.abstract p.topic-title { + text-align: center; +} + +div.dedication { + margin: 2em 5em; + text-align: center; + font-style: italic; +} +div.dedication p.topic-title { + font-style: normal; +} + +/* Option Lists */ + +dl.option-list { + margin-left: 1em; +} +dl.option-list > dt { + font-weight: normal; +} +span.option { + white-space: nowrap; +} + +/* Text Blocks */ +/* ============ */ + +/* Line Blocks */ + +div.line-block { + display: block; +} +div.line-block div.line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +/* Literal Blocks */ + +pre.literal-block, pre.doctest-block, +pre.math, pre.code { + margin-left: 1.5em; + margin-right: 1.5em +} + +/* Block Quotes */ + +blockquote, +div.topic { + margin-left: 1.5em; + margin-right: 1.5em +} +blockquote > table, +div.topic > table { + margin-top: 0; + margin-bottom: 0; +} +blockquote p.attribution, +div.topic p.attribution { + text-align: right; + margin-left: 20%; +} + +/* Tables */ +/* ====== */ + +/* margins and borders for "normal" tables */ +table { + border-collapse: collapse; +} + +td, th { + border-style: solid; + border-color: silver; + padding: 0 1ex; +/* some borders missing at some magnifications +/* in Firefox 31.5.0 and opera 10.63 */ + border-width: thin; +} + +td > p:first-child, th > p:first-child { + margin-top: 0; +} +td > p, th > p { + margin-bottom: 0; +} + +table > caption { + text-align: left; + margin-bottom: 0.25em +} + +table.borderless td, table.borderless th { + border: 0; + padding: 0; + padding-right: 0.5em /* separate table cells */ +} + +/* "booktabs" style (no vertical lines) */ +table.booktabs { + border: 0; + border-top: 2px solid; + border-bottom: 2px solid; + border-collapse: collapse; +} + +table.booktabs * { + border: 0; +} +table.booktabs th { + border-bottom: thin solid; + text-align: left; +} + +/* numbered tables (counter defined in div.document) */ +table.numbered > caption:before { + counter-increment: table; + content: "Table " counter(table) ": "; + font-weight: bold; +} + +/* Explicit Markup Blocks */ +/* ====================== */ + +/* Footnotes and Citations */ +/* ----------------------- */ + +/* line on the left */ +dl.footnote { + padding-left: 1ex; + border-left: solid; + border-left-width: thin; +} + +dl > dt.label { + font-weight: normal; +} +dt.label > span.fn-backref { + margin: 0.2em; +} +dt.label > span.fn-backref > a { + font-style: italic; +} + +/* Directives */ +/* ---------- */ + +/* Admonitions */ +/* System Messages */ + +div.admonition, +div.system-message { + margin: 2em; + border: medium outset; + padding-right: 1em; + padding-left: 1em; +} + +/* Body Elements */ +/* ~~~~~~~~~~~~~ */ + +/* Image and Figure */ + +img.align-left, +.figure.align-left, +object.align-left { + clear: left; + float: left; + margin-right: 1em +} +img.align-right, +.figure.align-right, +object.align-right { + clear: right; + float: right; + margin-left: 1em +} +img.align-center, +.figure.align-center, +object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} +/* reset inner alignment in figures */ +div.align-right { + text-align: inherit } + +/* Topic */ + +div.topic { margin: 2em } + +/* Sidebar */ + +/* in a layout with fixed margins, */ +/* the sidebar can be moved into the margin completely */ +div.sidebar { + border: medium outset; + padding-right: 1em; + padding-left: 1em; + width: 30%; + max-width: 26em; + float: right; + clear: right; + margin-left: 1em; + margin-right: -5.5%; + background-color: #ffffee ; +} +p.sidebar-title { font-size: larger; } + +/* Code */ + +pre.code, code { background-color: #eeeeee } +pre.code .ln { color: gray; } /* line numbers */ +/* basic highlighting: for a complete scheme, see */ +/* http://docutils.sourceforge.net/sandbox/stylesheets/ */ +pre.code .comment, code .comment { color: #5C6576 } +pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } +pre.code .literal.string, code .literal.string { color: #0C5404 } +pre.code .name.builtin, code .name.builtin { color: #352B84 } +pre.code .deleted, code .deleted { background-color: #DEB0A1} +pre.code .inserted, code .inserted { background-color: #A3D289} + +/* Math */ +/* styled separately (see math.css for math-output=HTML) */ + +/* Rubric */ + +p.rubric { + font-weight: bold; + font-size: larger; + color: maroon; +} + +/* Epigraph */ +/* Highlights */ +/* Pull-Quote */ +/* Compound Paragraph */ +/* Container */ + +/* can be styled in a custom stylesheet */ + +/* Document Header & Footer */ + +div.footer, div.header { + clear: both; + font-size: smaller; +} + +/* Contents */ + +div.topic.contents { + margin: 0; /* don't indent like a topic */ +} +ul.auto-toc { + list-style-type: none; +} + +/* Inline Markup */ +/* ============= */ + +/* Emphasis */ +/* em */ +/* Strong Emphasis */ +/* strong */ +/* Interpreted Text */ +/* span.interpreted */ +/* Title Reference */ +/* cite */ +/* Inline Literals */ + +/* possible values: normal, nowrap, pre, pre-wrap, pre-line */ +tt.literal, span.literal { white-space: pre-wrap; } +/* do not wraph a hyphens and similar: */ +.literal > span.pre { white-space: nowrap; } + +/* Hyperlink References */ + +a { text-decoration: none; } + +/* External Targets */ +/* span.target.external */ +/* Internal Targets */ +/* span.target.internal */ +/* Footnote References */ +/* a.footnote-reference */ +/* Citation References */ +/* a.citation-reference */ diff --git a/docutils/writers/xhtml11/xhtml11.css b/docutils/writers/xhtml11/xhtml11.css dissimilarity index 73% index 4fca761cc..4be88b6f4 100644 --- a/docutils/writers/xhtml11/xhtml11.css +++ b/docutils/writers/xhtml11/xhtml11.css @@ -1,371 +1,122 @@ -/* html4css2.css: Cascading style sheet for Docutils' html4strict writer. */ -/* */ -/* :Author: Günter Milde */ -/* :Copyright: © 2009 Günter Milde. */ -/* Released without warranties or conditions of any kind */ -/* under the terms of the Apache License, Version 2.0 */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* This stylesheet supplements the Docutils standard style 'html4css1.css'. */ -/* It uses CSS 2.1 elements (supported by up-to-date versions of popular */ -/* browsers). */ - -/* General rules */ -/* ============= */ - -body { - padding: 0 5%; - margin: 8px 0; - line-height:1.3; - /* http://ilovetypography.com/2008/02/28/a-guide-to-web-typography/ - recommends "line-spacing that’s at least 140% of your text size" */ - counter-reset: table; - /* counter-reset: figure; */ -} - -/* avoid long lines --> better reading */ -/* OTOH: lines should not be too short because of missing hyphenation, */ -div.document { - max-width: 45em; - margin: auto; -} - -/* separate items except for compact lists */ -dl > dd { - margin-bottom: 1em; -} -.compact li, .compact p, .compact ul, .compact ol -dl.simple > dd, .simple li, .simple p, .simple ul, .simple ol { - margin-top: 0; - margin-bottom: 0; -/* background: magenta; */ -} -dl.simple, dl.compact, dl.simple > dd, dl.compact > dd { - margin-top: 0; - margin-bottom: 0; -/* background: lightgreen; */ -} - -/* space around paragraphs */ -dl > dd p:first-child, td > p { - margin: 0; -} - -/* Sidebar */ -/* ------- */ - -div.sidebar { - margin-right: -5%; -} - -/* Special definition lists */ -/* ======================== */ - -/* bold definition term on the same line as the label */ -dl.field-list > dt, dl.option-list > dt, dl.docinfo > dt, -dl.footnote > dt, dl.citation > dt, dl.description > dt { - clear: left; - float: left; - margin: 0; - padding: 0; - padding-right: 0.5em; - font-weight: bold; -} -/* except for these */ -dl.option-list > dt, dl.footnote > dt { - font-weight: normal; -} - - - -/* Field Lists */ -/* ----------- */ - -/* field names followed by a colon */ -dl.field-list > dt:after, dl.docinfo > dt:after { - content: ":"; -} - -/* Offset for field content (corresponds to the --field-name-limit option) */ -dl.field-list > dd { - margin-left: 9em; /* ca. 14 chars in the test examples */ - padding-left: 0.5em; -} - -/* start field-body on a new line after long field names */ -dl.field-list > dd p { - width: 100%; -/* display: inline-block; */ -/* background: yellow; */ -} - -dl.field-list > dd > p:first-child, -/* dl.field-list > dd > ol:first-child, */ -/* dl.field-list > dd > ul:first-child, */ -dl.field-list > dd > dl:first-child { - display: inline-block; -} - -/* field-list variants:: */ - -/* example for custom field-name width */ -dl.field-list.narrow > dd { - margin-left: 5em; -} - -/* start field-body on same line after long field names */ -dl.field-list.run-in > dd p { - display: block; -} - -/* wrap or truncate long field names */ -dl.field-list.fix-labelwidth > dt { - width: 8em; /* set to dl.field-list > dd margin-left - padding-left */ - overflow: hidden; -} -dl.field-list.fix-labelwidth > dd:after { - /* a "stopper" to prevent next dd floating up too far */ - content: ''; - display: block; - clear: left; -} - -/* docinfo */ - -dl.docinfo > dd { - margin-left: 8em; -/* margin-bottom: 0.5em; */ -} - - -/* option list */ - -dl.option-list { - margin-left: 1em; - padding-left: 0; -} - -dl.option-list > dd { - margin-left: 8em; - /* margin-bottom: 0.5em; */ -} - -/* start description on a new line after long options */ -dl.option-list > dd p { - width: 100%; - display: inline-block; -} - -/* footnotes */ - -a.footnote-reference, a.fn-backref { - text-decoration: inherit; /* do not underline footnote links */ -} - -dl.footnote { - /* line on the left */ - padding-left: 1ex; - border-left: solid; - border-left-width: thin; - /* border-color: black; */ -} - -/* paragraph on same line as backrefs */ -dd > em { -/* background: green; */ - float: left; - margin-right: 1ex -} - - -/* -Ordered List (Enumeration) --------------------------- - -Use counters to replace the deprecated start attribute. Make sure the -resulting list resembles the list-style 'outside' with a hanging indent. -*/ - -/* New ordered list: reset counter, suppress the default label */ -ol, ol.arabic, ol.loweralpha, ol.upperalpha, -ol.lowerroman, ol.upperroman { - counter-reset: item; - list-style: none -} - -/* Set the negative indent of the list label as feature of the list item */ -ol > li { - text-indent: -40px; /* Mozillas default indent */ -} -/* reset for child elements */ -ol > li > * { - text-indent: 0px; - text-indent: 0; - margin-top: 0; - /* background: lightgreen; */ -} - -/* Label */ -ol > li:before { - /* increment and typeset counter(s), */ - counter-increment: item; - content: counter(item) "."; - /* display next to the content (aligned top-right), */ - display: inline-block; - text-align: right; - vertical-align: top; - /* sum must match ol>li {text-indent:} (40px is Mozillas default) */ - width: 35px; - padding-right: 5px; -/* background: yellow; */ -} - -/* The list item's first line starts next to the label, without indent */ -ol > li > p:first-child, -ol > li > ol:first-child, -ol > li > ul:first-child, -ol > li > dl:first-child { - display: inline-block; - /* background: lightblue; */ -} - -/* default separator variants */ -ol.loweralpha > li:before { - content: counter(item, lower-alpha) ")"; -} -ol.upperalpha > li:before { - content: counter(item, upper-alpha) "."; -} -ol.lowerroman > li:before { - content: "(" counter(item, lower-roman) ")"; -} -ol.upperroman > li:before { - content: counter(item, upper-roman) ")"; -} -/* nested counters (1, 1.1, 1.1.1, etc) */ -/* nested enumerated lists "inherit" the class attribute, other lists not */ -ol.nested > li:before, ol.nested ol > li:before { - content: counters(item, ".") " "; -} - -/* lists nested in definition list */ - -dd > ul, dd > ol { - padding-left: 0pt; -} - -/* TODO: prefix, suffix? */ - -/* smaller font for super- and subscripts */ -/* sub, sup {font-size: 70%;} */ /* Mozilla default is `smaller` */ - - -/* Tables */ -/* ====== */ - -/* margins and borders for "normal" tables */ -table { -/* background: magenta; */ - margin-top: 1em ; - margin-bottom: 1em; -/* border-style: outset; */ - border-style: solid; - border-color: silver; - border-width: thin; - border-collapse: collapse; -} -blockquote > table { - margin-top: 0em ; - margin-bottom: 0em; -} - -td, th { - border-style: solid; - border-width: thin; - border-color: silver; - /* text-align: left; */ - padding: 0 1ex; -} - -td > p:first-child, th > p:first-child { - margin-top: 0; -} -td > p, th > p { - margin-bottom: 0; -} - -/* no borders for "borderless" tables */ -table.borderless, table.borderless * { - border-style: none; -} - -/* "booktabs" style (no vertical lines) */ -table.booktabs { - border: 0; - border-top: 2px solid; - border-bottom: 2px solid; - border-collapse: collapse; -} - -table.booktabs * { - border: 0; -} -table.booktabs th { - border-bottom: thin solid; - text-align: left; -} - -table > caption { - text-align: left; - margin-bottom: 0.25em -/* padding: 2em 0 1em 0; */ -} - -/* numbered tables*/ -table.numbered > caption:before { - counter-increment: table; /* defined/re-set in body */ - content: "Table " counter(table) ": "; - font-weight: bold; -} - - -/* literal text - ------------ -*/ -/* whitespace and wrapping in inline literals */ -/* possible values: normal, nowrap, pre, pre-wrap, pre-line */ -tt.literal { - white-space: pre-wrap; -} - -/* /* compensate for initial line-break (which is literal with XHTML 1.1) */ */ -/* pre.literal-block, pre.doctest-block { */ -/* margin-top: 0em ; */ -/* } */ - -/* Table of Contents */ - -/* don't indent like a topic */ -div.topic.contents { - margin: 0; -} -/* div.topic.contents ul { */ -/* list-style: none; */ -/* } */ - -div.topic.contents a { - text-decoration: none; /* no underline for links */ -} - -/* section numbers */ - -span.sectnum { - padding-right: 1ex; -} - -/* admonitions */ - -/* no padding for top and bottom */ -div.admonition, div.attention, div.caution, div.danger, div.error, -div.hint, div.important, div.note, div.tip, div.warning { - padding: 0px 1em } +/* xhtml11.css: Cascading style sheet for Docutils' xhtml11 writer. */ +/* */ +/* :Author: Günter Milde */ +/* :Copyright: © 2009, 2014 Günter Milde. */ +/* :License: Released under the terms of the `2-Clause BSD license`_, */ +/* in short: */ +/* */ +/* Copying and distribution of this file, with or without modification, */ +/* are permitted in any medium without royalty provided the copyright */ +/* notice and this notice are preserved. */ +/* This file is offered as-is, without any warranty. */ +/* */ +/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause */ + +/* This stylesheet contains rules specific to the output of the */ +/* XHTML 1.1 writer. It supplements the "html-base.css" stylesheet. */ +/* It validates_ as CSS2.1_ */ +/* */ +/* .. _CSS2.1: http://www.w3.org/TR/CSS2 */ +/* .. _validates: http://jigsaw.w3.org/css-validator/validator$link */ + + +/* Ordered List (Enumeration) */ +/* -------------------------- */ + +/* XHTML 1.1 removed the "start" argument form ordered lists (It */ +/* resurfaces in HTML5). */ +/* */ +/* Use custom counters to replace the deprecated start attribute. Make */ +/* sure the resulting list resembles the list-style 'outside' with a */ +/* hanging indent. */ + +/* New ordered list: reset counter, suppress the default label */ +ol, ol.arabic, ol.loweralpha, ol.upperalpha, +ol.lowerroman, ol.upperroman { + counter-reset: item; + list-style: none +} + +/* Set the negative indent of the list label as feature of the list item */ +ol > li { + text-indent: -40px; /* Mozillas default indent */ +} +/* reset for child elements */ +ol > li > * { + text-indent: 0px; + text-indent: 0; + margin-top: 0; + /* background: lightgreen; */ +} + +/* Label */ +ol > li:before { + /* increment and typeset counter(s), */ + counter-increment: item; + content: counter(item) "."; + /* display next to the content (aligned top-right), */ + display: inline-block; + text-align: right; + vertical-align: top; + /* sum must match ol>li {text-indent:} (40px is Mozillas default) */ + width: 35px; + padding-right: 5px; +/* background: yellow; */ +} + +/* The list item's first line starts next to the label, without indent */ +ol > li > p:first-child, +ol > li > ol:first-child, +ol > li > ul:first-child, +ol > li > dl:first-child { + display: inline-block; + /* background: lightblue; */ +} + +/* default separator variants */ +ol.loweralpha > li:before { + content: counter(item, lower-alpha) ")"; +} +ol.upperalpha > li:before { + content: counter(item, upper-alpha) "."; +} +ol.lowerroman > li:before { + content: "(" counter(item, lower-roman) ")"; +} +ol.upperroman > li:before { + content: counter(item, upper-roman) ")"; +} +/* nested counters (1, 1.1, 1.1.1, etc) */ +/* nested enumerated lists "inherit" the class attribute, other lists not */ +ol.nested > li:before, ol.nested ol > li:before { + content: counters(item, ".") " "; +} + + + +/* Field Lists */ +/* ----------- */ + +/* field-list variants:: */ + +/* example for custom field-name width */ +dl.field-list.narrow > dd { + margin-left: 5em; +} + +/* start field-body on same line after long field names */ +dl.field-list.run-in > dd p { + display: block; +} + +/* wrap or truncate long field names */ +dl.field-list.fix-labelwidth > dt { + width: 8em; /* set to dl.field-list > dd margin-left - padding-left */ + overflow: hidden; +} +dl.field-list.fix-labelwidth > dd:after { + /* a "stopper" to prevent next dd floating up too far */ + content: ''; + display: block; + clear: left; +} diff --git a/test/functional/expected/standalone_rst_xhtml11.xhtml b/test/functional/expected/standalone_rst_xhtml11.xhtml index 90b33f964..acb17516e 100644 --- a/test/functional/expected/standalone_rst_xhtml11.xhtml +++ b/test/functional/expected/standalone_rst_xhtml11.xhtml @@ -12,7 +12,7 @@ - + @@ -28,10 +28,9 @@
Author
-
David Goodger
+

David Goodger

Address
-
-123 Example Street
+
123 Example Street
 Example, EX  Canada
 A1B 2C3
 
@@ -39,9 +38,10 @@ A1B 2C3
Contact
goodger@python.org
Authors
-
Me -
Myself -
I
+

Me

+

Myself

+

I

+
Organization
humankind
Date
@@ -276,18 +276,18 @@ live link to PEP 258 here.

2.4 Definition Lists

-
+
Term

Definition

-
Term : classifier
+
Termclassifier

Definition paragraph 1.

Definition paragraph 2.

Term

Definition

-
Term : classifier one : classifier two
+
Termclassifier oneclassifier two

Definition

@@ -461,7 +461,7 @@ notamment dans la documentation du langage Python.

2.10 Doctest Blocks

-
>>> print 'Python-specific usage examples; begun with ">>>"'
+
>>> print 'Python-specific usage examples; begun with ">>>"'
 Python-specific usage examples; begun with ">>>"
 >>> print '(cut and pasted from interactive Python sessions)'
 (cut and pasted from interactive Python sessions)
@@ -469,47 +469,42 @@ Python-specific usage examples; begun with ">>>"
 

2.11 Footnotes

-
[1]
-
-(1, 2, 3)

A footnote contains body elements, consistently indented by at +

+
[1](1,2,3)
+

A footnote contains body elements, consistently indented by at least 3 spaces.

-

This is the footnote's second paragraph.

+

This is the footnote's second paragraph.

-
[2]
-
-(1, 2)

Footnotes may be numbered, either manually (as in [1]) or +

[2](1,2)
+

Footnotes may be numbered, either manually (as in [1]) or automatically using a "#"-prefixed label. This footnote has a label so it can be referred to from multiple places, both as a footnote reference ([2]) and as a hyperlink reference.

-
[3]
-
-

This footnote is numbered automatically and anonymously using a +

[3]
+

This footnote is numbered automatically and anonymously using a label of "#" only.

This is the second paragraph.

-

And this is the third paragraph.

+

And this is the third paragraph.

-
[*]
-
-

Footnotes may also use symbols, specified with a "*" label. +

[*]
+

Footnotes may also use symbols, specified with a "*" label. Here's a reference to the next footnote: [†].

-
[†]
-
-

This footnote shows the next symbol in the sequence.

+
[†]
+

This footnote shows the next symbol in the sequence.

-
[4]
-
-

Here's an unreferenced footnote, with a reference to a +

[4]
+

Here's an unreferenced footnote, with a reference to a nonexistent footnote: [5]_.

2.12 Citations

-
[CIT2002]
-
-(1, 2)

Citations are text-labeled footnotes. They may be +

+
[CIT2002](1,2)
+

Citations are text-labeled footnotes. They may be rendered separately and differently from footnotes.

@@ -732,25 +727,21 @@ allowed (e.g. inside a directive).

@@ -1077,34 +1068,49 @@ crunchy, now would it?

2.24 SVG Images

-../../../docs/user/rst/images/biohazard.svg + +../../../docs/user/rst/images/biohazard.svg

Scalable vector graphics (SVG) images are not supported by all backends. Rendering depends partially on the backend, especially if the size is not explicitely given.

-../../../docs/user/rst/images/title-scaling.svg -

A scaling image occupying 50% of the line width (scales with the -browser window).

+ +../../../docs/user/rst/images/title-scaling.svg +

A scaling image occupying 50% of the line width (scales with the browser +window).

Whether an SVG image is scaled or clipped/padded cannot be set in the -containing HTML. It depends on the viewport declaration inside its -root <svg> element.

-

An inline SVG image inline-svg scaled to a height of 0.8 em.

-../../../docs/user/rst/images/title-scaling.svg +containing HTML. If the image is wrapped in <object> tags, it +depends on the viewport declaration inside its root <svg> element, if it is +wrapped in <img> it depends on the browser.

+ +../../../docs/user/rst/images/title.svg +

A fixed-size image in a box with 50% of the line width, 15 pixles high.

+ +../../../docs/user/rst/images/title-scaling.svg

A scaling image occupying 50% of the line width and 1.2 em high, right aligned (this SVG image keeps the aspect ratio):

-../../../docs/user/rst/images/biohazard-scaling.svg +
    +
  • An inline SVG image inline-svg scaled to a height of 0.8 em.

  • +
+ +../../../docs/user/rst/images/biohazard-scaling.svg

A scaling image 1 em high, left aligned.

A scaling image 5 mm x 5 mm, centered, with hyperlink reference:

-../../../docs/user/rst/images/biohazard-scaling.svg -../../../docs/user/rst/images/biohazard.svg +../../../docs/user/rst/images/biohazard-scaling.svg + +../../../docs/user/rst/images/biohazard.svg

A fixed-size image in a 4 cm x 2 em box.

-../../../docs/user/rst/images/title.svg -

A fixed-size image in a box 50% the line width and 15 pixle high.

-reStructuredText, the markup syntax + +reStructuredText, the markup syntax

SVG image in a figure.

-../../../docs/user/rst/images/biohazard-bitmap.svg -

An SVG image with embedded bitmap. Should be 3 em wide, right aligned.

+ +../../../docs/user/rst/images/biohazard-bitmap.svg +

An SVG image with embedded bitmap, 3 em wide, right aligned. +Older versions of webkit based browsers (chromium, safari, midori, +konqueror) cannot display the contained bitmap image if the SVG is wrapped +in <img> tags. The image does not scale properly if wrapped in +<object> tags.

2.25 SWF Images

@@ -1139,7 +1145,7 @@ wrapping in this kind of lists.

  • Unordered list nested in enumeration.

-
+
Definition list

nested in top-level enumeration

@@ -1150,16 +1156,17 @@ wrapping in this kind of lists.

3.2 Description list

-

Definition lists are styled like in most dictionaries, encyclopedias -etc. (as well as the LaTeX description environment) if given the -description class argument:

-
-
The label
-

is bold.

+

Definition lists with the description class argument:

+
+
description lists
+

Lists that are styled like in most dictionaries, encyclopedias +etc. (as well as the LaTeX description environment).

-
The description
-

starts on the same line. If it is longer, you will see that it has a -hanging indent.

+
label
+

The term to be described. Put in boldface.

+
+
content
+

starts on the same line and has a hanging indent.

@@ -1186,7 +1193,7 @@ with the default setting of field-name-limit: 14.

previous one but regarded "short" by html4css1.

-

With html4css2, the field list is typeset as CSS-styled definition +

With html4css2, a field list is typeset as CSS-styled definition list. The default layout is similar to the look with html4css1:

A long field name
@@ -1205,9 +1212,9 @@ example:

3.4 Table styling with class arguments

+

The html-base.css style sheet provides rules for easy styling of tables +with the "class" directive or directive argument.

Numbered tables can be achieved with the numbered class option

@@ -1330,6 +1340,8 @@ prevented by a dummy dd:after element in the CSS. -->
truth values
+

Currently, referencing to the table by number is not supported. This is a +common request and already on the TODO list.

In addition to the "borderless" table-style [7], the style sheet also defines "booktabs", that will be rendered similar to the style from the booktabs [8] LaTeX package.

@@ -1391,7 +1403,7 @@ the headers:

-

Of course, also booktabs style tables can be numbered:

+

Of course, also "booktabs" style tables can be numbered:

@@ -1430,8 +1442,8 @@ the headers:

3.5 Math

-

The W3C consortium provides a DTD for XHTML 1.1 plus MathML 2.0, so -that documents embedding formulas as MathML can be validated.

+

The html-output setting defaults to »MathML«. If there is mathematical +content in MathML format, the document type is XHTML 1.1 plus MathML 2.0.

The linear mapping f: N diff --git a/test/functional/input/data/html-base.css b/test/functional/input/data/html-base.css new file mode 120000 index 000000000..636c2dd03 --- /dev/null +++ b/test/functional/input/data/html-base.css @@ -0,0 +1 @@ +/home/milde/Code/Python/docutils-svn/docutils/docutils/writers/xhtml11/html-base.css \ No newline at end of file diff --git a/test/functional/input/data/svg_images.txt b/test/functional/input/data/svg_images.txt index 856dd1ff2..2bb4cba81 100644 --- a/test/functional/input/data/svg_images.txt +++ b/test/functional/input/data/svg_images.txt @@ -4,6 +4,7 @@ SVG Images .. image:: ../../../docs/user/rst/images/biohazard.svg :width: 48 px :height: 48 px + :align: left Scalable vector graphics (SVG) images are not supported by all backends. Rendering depends partially on the backend, especially if the size is @@ -13,26 +14,34 @@ not explicitely given. :width: 50% :align: left -A scaling image occupying 50% of the line width (scales with the -browser window). +A scaling image occupying 50% of the line width (scales with the browser +window). Whether an SVG image is scaled or clipped/padded cannot be set in the -containing HTML. It depends on the viewport declaration inside its -root element. +containing HTML. If the image is wrapped in ```` tags, it +depends on the viewport declaration inside its root element, if it is +wrapped in ```` it depends on the browser. -.. |inline-svg| image:: ../../../docs/user/rst/images/biohazard-scaling.svg - :height: 0.8 em +.. image:: ../../../docs/user/rst/images/title.svg + :width: 50% + :height: 15 px + :align: left -An inline SVG image |inline-svg| scaled to a height of 0.8 em. +A fixed-size image in a box with 50% of the line width, 15 pixles high. .. image:: ../../../docs/user/rst/images/title-scaling.svg :width: 50 % :height: 1.2 em :align: right - + A scaling image occupying 50% of the line width and 1.2 em high, right aligned (this SVG image keeps the aspect ratio): +.. |inline-svg| image:: ../../../docs/user/rst/images/biohazard-scaling.svg + :height: 0.8 em + +* An inline SVG image |inline-svg| scaled to a height of 0.8 em. + .. image:: ../../../docs/user/rst/images/biohazard-scaling.svg :height: 1 em :align: left @@ -54,13 +63,6 @@ A scaling image 5 mm x 5 mm, centered, with hyperlink reference: A fixed-size image in a 4 cm x 2 em box. -.. image:: ../../../docs/user/rst/images/title.svg - :width: 50% - :height: 15 px - :align: left - -A fixed-size image in a box 50% the line width and 15 pixle high. - .. figure:: ../../../docs/user/rst/images/title.svg :alt: reStructuredText, the markup syntax :width: 290 px @@ -72,4 +74,8 @@ A fixed-size image in a box 50% the line width and 15 pixle high. :width: 3em :align: right -An SVG image with embedded bitmap. Should be 3 em wide, right aligned. +An SVG image with embedded bitmap, 3 em wide, right aligned. +Older versions of `webkit` based browsers (chromium, safari, midori, +konqueror) cannot display the contained bitmap image if the SVG is wrapped +in ```` tags. The image does not scale properly if wrapped in +```` tags. diff --git a/test/functional/input/standalone_rst_xhtml11.txt b/test/functional/input/standalone_rst_xhtml11.txt index 693324284..05a763c57 100644 --- a/test/functional/input/standalone_rst_xhtml11.txt +++ b/test/functional/input/standalone_rst_xhtml11.txt @@ -39,18 +39,17 @@ Enumerated lists with nested counters Description list ---------------- -Definition lists are styled like in most dictionaries, encyclopedias -etc. (as well as the LaTeX `description` environment) if given the -``description`` class argument: +Definition lists with the ``description`` class argument: .. class:: description -The label - is bold. - -The description - starts on the same line. If it is longer, you will see that it has a - hanging indent. +description lists + Lists that are styled like in most dictionaries, encyclopedias + etc. (as well as the LaTeX `description` environment). +label + The term to be described. Put in boldface. +content + starts on the same line and has a hanging indent. Field list handling @@ -72,7 +71,7 @@ characters" but the field name uses a proportional font. :MMMMMMMMMMMMMM: a field name that is actually longer than the previous one but regarded "short" by html4css1. -With `html4css2`, the field list is typeset as CSS-styled `definition +With `html4css2`, a `field list` is typeset as CSS-styled `definition list`. The default layout is similar to the look with `html4css1`: .. class:: open @@ -92,8 +91,8 @@ list`. The default layout is similar to the look with `html4css1`: Styling with class arguments ```````````````````````````` -The default style sheet ``html4css2.css`` supports the following class -arguments for alternative styles: +The ``xhtml11.css`` style sheet supports the following class arguments +for alternative styles: *compact* .. class:: compact @@ -136,7 +135,8 @@ arguments for alternative styles: :A long field name: sticks into the field body which continues on the same line. - :The next field name: and field body should align. + :The next field name: and field body should align. Long text in the field + body is wrapped and aligns with other fields. .. _`fix-labelwidth`: @@ -146,11 +146,6 @@ arguments for alternative styles: :Feature: The width of the field name (label) is fixed. Long labels wrap. - :Problem: Non-wrappable field names are truncated. - - :a_very_long_field_name: - is truncated if it can not wrap. - :this long field name: will wrap. :the next field name: and field body should align. @@ -159,10 +154,18 @@ arguments for alternative styles: one line, following field bodies "float up" if not prevented by a dummy dd:after element in the CSS. + :Problem: Non-wrappable field names are truncated. + + :a_very_long_field_name: + is truncated if it can not wrap. + Table styling with class arguments ---------------------------------- +The ``html-base.css`` style sheet provides rules for easy styling of tables +with the "class" directive or directive argument. + Numbered tables can be achieved with the ``numbered`` class option .. table:: truth values @@ -177,6 +180,9 @@ Numbered tables can be achieved with the ``numbered`` class option True True True ======= ======= ========== +Currently, referencing to the table by number is not supported. This is a +common request and already on the `TODO list`. + In addition to the "borderless" table-style_, the style sheet also defines "booktabs", that will be rendered similar to the style from the booktabs_ LaTeX package. @@ -210,7 +216,7 @@ True True True ===== ===== ======= -Of course, also booktabs style tables can be numbered: +Of course, also "booktabs" style tables can be numbered: .. table:: I/O values :class: numbered booktabs @@ -227,11 +233,11 @@ Of course, also booktabs style tables can be numbered: ===== ===== ====== -Math ----- +Maths +----- -The W3C consortium provides a DTD for XHTML 1.1 plus MathML 2.0, so -that documents embedding formulas as MathML can be validated. +The ``html-output`` setting defaults to »MathML«. If there is mathematical +content in `MathML` format, the document type is XHTML 1.1 plus MathML 2.0. The linear mapping :math:`f: \mathbb{C}^{N}\longmapsto\mathbb{C}^{N}` with diff --git a/test/functional/tests/standalone_rst_xhtml11.py b/test/functional/tests/standalone_rst_xhtml11.py index b51fc8ab9..1a13a64e4 100644 --- a/test/functional/tests/standalone_rst_xhtml11.py +++ b/test/functional/tests/standalone_rst_xhtml11.py @@ -13,6 +13,6 @@ writer_name = "xhtml11" # Settings # local copy of default stylesheet: # (test runs in ``docutils/test/``, we need relative path from there.) -settings_overrides['stylesheet_path'] = ( - 'functional/input/data/html4css1.css,' +settings_overrides['stylesheet_path'] = ( + 'functional/input/data/html-base.css,' 'functional/input/data/xhtml11.css') -- 2.11.4.GIT

I/O values