diff options
author | smerten <smerten@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2010-07-10 08:13:27 +0000 |
---|---|---|
committer | smerten <smerten@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2010-07-10 08:13:27 +0000 |
commit | e6591cc730072346de7bf909d99a2da9eb56a76f (patch) | |
tree | 83b47abd1b090a64bef638a1f262a31786e1d1ef | |
parent | 0a072083e4c3810408d2413f3652fb08f3d48afb (diff) | |
download | docutils-e6591cc730072346de7bf909d99a2da9eb56a76f.tar.gz |
Standard transformations are done. Tests added. HTML output works.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@6374 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r-- | sandbox/rstdiff/global.log | 91 | ||||
-rwxr-xr-x | sandbox/rstdiff/rstdiff.py | 26 | ||||
-rw-r--r-- | sandbox/rstdiff/tag.log | 2 | ||||
-rw-r--r-- | sandbox/rstdiff/tests/html/expected/contents.html | 327 | ||||
-rw-r--r-- | sandbox/rstdiff/tests/html/expected/footnote.html | 319 | ||||
-rw-r--r-- | sandbox/rstdiff/tests/html/expected/reference.html | 316 | ||||
-rw-r--r-- | sandbox/rstdiff/tests/html/expected/textDifferent.html | 313 | ||||
-rw-r--r-- | sandbox/rstdiff/tests/html/filterunit.cfg | 10 | ||||
-rw-r--r-- | sandbox/rstdiff/tests/html/input/contents.new.rst | 9 | ||||
-rw-r--r-- | sandbox/rstdiff/tests/html/input/contents.old.rst | 9 | ||||
-rw-r--r-- | sandbox/rstdiff/tests/html/input/footnote.new.rst | 3 | ||||
-rw-r--r-- | sandbox/rstdiff/tests/html/input/footnote.old.rst | 3 | ||||
-rw-r--r-- | sandbox/rstdiff/tests/html/input/reference.new.rst | 4 | ||||
-rw-r--r-- | sandbox/rstdiff/tests/html/input/reference.old.rst | 4 | ||||
-rw-r--r-- | sandbox/rstdiff/tests/html/input/textDifferent.new.rst | 1 | ||||
-rw-r--r-- | sandbox/rstdiff/tests/html/input/textDifferent.old.rst | 1 |
16 files changed, 1425 insertions, 13 deletions
diff --git a/sandbox/rstdiff/global.log b/sandbox/rstdiff/global.log index 18566024d..0bd1eb671 100644 --- a/sandbox/rstdiff/global.log +++ b/sandbox/rstdiff/global.log @@ -1,4 +1,95 @@ ************************************** +Date: Fri Jul 9 19:53:45 CEST 2010 +Author: stefan +Tag: rstdiff_1_55 + +-------------------------------------- +Update of /home/stefan/vault/sm/rstdiff/tests +In directory theowa:/home/stefan/free/rstdiff/tests + +Modified Files: + Makefile rules.gmk + +-------------------------------------- +Update of /home/stefan/vault/sm/rstdiff/tests/html +In directory theowa:/home/stefan/free/rstdiff/tests/html + +Modified Files: + filterunit.cfg + +-------------------------------------- +Log Message: +Errors fixed by using proper options. All tests run. +************************************** +Date: Fri Jul 9 19:45:11 CEST 2010 +Author: stefan +Tag: rstdiff_1_54 + +-------------------------------------- +Update of /home/stefan/vault/sm/rstdiff +In directory theowa:/home/stefan/free/rstdiff + +Modified Files: + rstdiff.py + +-------------------------------------- +Log Message: +Standard transformations are applied. Fixes footnote and contents +problem in HTML. +************************************** +Date: Fri Jul 9 19:16:34 CEST 2010 +Author: stefan +Tag: rstdiff_1_53 + +-------------------------------------- +Update of /home/stefan/vault/sm/rstdiff +In directory theowa:/home/stefan/free/rstdiff + +Modified Files: + rstdiff.py + +-------------------------------------- +Log Message: +Debugging. Classes attribute in <inline> is set correct. +************************************** +Date: Fri Jul 9 19:03:48 CEST 2010 +Author: stefan +Tag: rstdiff_1_52 + +-------------------------------------- +Update of /home/stefan/vault/sm/rstdiff/tests +In directory theowa:/home/stefan/free/rstdiff/tests + +Modified Files: + rules.gmk + +-------------------------------------- +Update of /home/stefan/vault/sm/rstdiff/tests/html +In directory theowa:/home/stefan/free/rstdiff/tests/html + +Added Files: + Makefile filterunit.cfg + +-------------------------------------- +Update of /home/stefan/vault/sm/rstdiff/tests/html/input +In directory theowa:/home/stefan/free/rstdiff/tests/html/input + +Added Files: + contents.new.rst contents.old.rst footnote.new.rst + footnote.old.rst reference.new.rst reference.old.rst + textDifferent.new.rst textDifferent.old.rst + +-------------------------------------- +Update of /home/stefan/vault/sm/rstdiff/tests/html/source +In directory theowa:/home/stefan/free/rstdiff/tests/html/source + +Added Files: + contents.rst footnote.rst reference.rst textDifferent.rst + +-------------------------------------- +Log Message: +Added tests for HTML writer decovering errors. All these tests fail. +************************************** Date: Sat Jul 3 18:42:26 CEST 2010 Author: stefan Tag: rstdiff_1_51 diff --git a/sandbox/rstdiff/rstdiff.py b/sandbox/rstdiff/rstdiff.py index 17e08039d..6866d332f 100755 --- a/sandbox/rstdiff/rstdiff.py +++ b/sandbox/rstdiff/rstdiff.py @@ -432,10 +432,7 @@ class DocutilsDispatcher(HashableNodeImpl): return self.dispatchClass('copyChild', node, newType) def copyChild_UNKNOWN(self, node, newType): - copy = node.deepcopy() - if newType: - copy['classes'].append(self.newType2Class(newType)) - return copy + return self.setNewType(node.deepcopy(), newType) def copyChildren(self, head, tail, root, newType): """Return a range of new nodes copied from [ `head` ] + `tail` under @@ -499,9 +496,11 @@ class DocutilsDispatcher(HashableNodeImpl): ########################################################################### # Helpers - def newType2Class(self, newType): - """Return a class name for `newType`.""" - return "change-%s" % ( newType, ) + def setNewType(self, node, newType): + """Set a class on `node` for `newType` if set. Returns `node`.""" + if newType: + node['classes'].append("change-%s" % ( newType, )) + return node ########################################################################### ########################################################################### @@ -547,7 +546,8 @@ class DocutilsDispatcher(HashableNodeImpl): childEq_White = rootEq_White def copyChildren_Text(self, head, tail, root, newType): - inline = nodes.inline(classes=self.newType2Class(newType)) + inline = nodes.inline() + self.setNewType(inline, newType) inline.extend([ head, ] + tail) return [ inline, ] @@ -582,6 +582,7 @@ def processCommandLine(): new_reporter('<cmdline>', pub.settings).severe("Internal error: Mismatch of pre-parsed (%r) and real (%r) writer" % ( preWriter, pub.settings.writer, )) + pub.set_destination() return pub def readTree(pub, sourceName): @@ -589,7 +590,10 @@ def readTree(pub, sourceName): # Reset reader - just in case it keeps state from a previous invocation pub.set_reader('standalone', None, 'restructuredtext') pub.set_source(None, sourceName) - return pub.reader.read(pub.source, pub.parser, pub.settings) + pub.document = None + pub.document = pub.reader.read(pub.source, pub.parser, pub.settings) + pub.apply_transforms() + return pub.document def doDiff(hashableNodeImpl, oldTree, newTree): """Create a difference from `oldTree` to `newTree` using @@ -697,13 +701,11 @@ if __name__ == '__main__': oldTree = readTree(pub, pub.settings._old_source) newTree = readTree(pub, pub.settings._new_source) - # TODO Standard transformations should be run probably - Text2Words(oldTree).apply() Text2Words(newTree).apply() diffDoc = createDiff(oldTree, newTree) Words2Text(diffDoc).apply() - pub.set_destination() pub.writer.write(diffDoc, pub.destination) + pub.writer.assemble_parts() diff --git a/sandbox/rstdiff/tag.log b/sandbox/rstdiff/tag.log index e3ad78805..0add360b9 100644 --- a/sandbox/rstdiff/tag.log +++ b/sandbox/rstdiff/tag.log @@ -1 +1 @@ -rstdiff_1_51 +rstdiff_1_55 diff --git a/sandbox/rstdiff/tests/html/expected/contents.html b/sandbox/rstdiff/tests/html/expected/contents.html new file mode 100644 index 000000000..fa9e52651 --- /dev/null +++ b/sandbox/rstdiff/tests/html/expected/contents.html @@ -0,0 +1,327 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" /> +<title></title> +<style type="text/css"> + +/* +:Author: David Goodger (goodger@python.org) +:Id: $Id$ +:Copyright: This stylesheet has been placed in the public domain. + +Default cascading style sheet for the HTML output of Docutils. + +See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to +customize this style sheet. +*/ + +/* used to remove borders from tables and images */ +.borderless, table.borderless td, table.borderless th { + border: 0 } + +table.borderless td, table.borderless th { + /* Override padding for "table.docutils td" with "! important". + The right padding separates the table cells. */ + padding: 0 0.5em 0 0 ! important } + +.first { + /* Override more specific margin styles with "! important". */ + margin-top: 0 ! important } + +.last, .with-subtitle { + margin-bottom: 0 ! important } + +.hidden { + display: none } + +a.toc-backref { + text-decoration: none ; + color: black } + +blockquote.epigraph { + margin: 2em 5em ; } + +dl.docutils dd { + margin-bottom: 0.5em } + +/* Uncomment (and remove this text!) to get bold-faced definition list terms +dl.docutils dt { + font-weight: bold } +*/ + +div.abstract { + margin: 2em 5em } + +div.abstract p.topic-title { + font-weight: bold ; + text-align: center } + +div.admonition, div.attention, div.caution, div.danger, div.error, +div.hint, div.important, div.note, div.tip, div.warning { + margin: 2em ; + border: medium outset ; + padding: 1em } + +div.admonition p.admonition-title, div.hint p.admonition-title, +div.important p.admonition-title, div.note p.admonition-title, +div.tip p.admonition-title { + font-weight: bold ; + font-family: sans-serif } + +div.attention p.admonition-title, div.caution p.admonition-title, +div.danger p.admonition-title, div.error p.admonition-title, +div.warning p.admonition-title { + color: red ; + font-weight: bold ; + font-family: sans-serif } + +/* Uncomment (and remove this text!) to get reduced vertical space in + compound paragraphs. +div.compound .compound-first, div.compound .compound-middle { + margin-bottom: 0.5em } + +div.compound .compound-last, div.compound .compound-middle { + margin-top: 0.5em } +*/ + +div.dedication { + margin: 2em 5em ; + text-align: center ; + font-style: italic } + +div.dedication p.topic-title { + font-weight: bold ; + font-style: normal } + +div.figure { + margin-left: 2em ; + margin-right: 2em } + +div.footer, div.header { + clear: both; + font-size: smaller } + +div.line-block { + display: block ; + margin-top: 1em ; + margin-bottom: 1em } + +div.line-block div.line-block { + margin-top: 0 ; + margin-bottom: 0 ; + margin-left: 1.5em } + +div.sidebar { + margin: 0 0 0.5em 1em ; + border: medium outset ; + padding: 1em ; + background-color: #ffffee ; + width: 40% ; + float: right ; + clear: right } + +div.sidebar p.rubric { + font-family: sans-serif ; + font-size: medium } + +div.system-messages { + margin: 5em } + +div.system-messages h1 { + color: red } + +div.system-message { + border: medium outset ; + padding: 1em } + +div.system-message p.system-message-title { + color: red ; + font-weight: bold } + +div.topic { + margin: 2em } + +h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, +h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { + margin-top: 0.4em } + +h1.title { + text-align: center } + +h2.subtitle { + text-align: center } + +hr.docutils { + width: 75% } + +img.align-left, .figure.align-left{ + clear: left ; + float: left ; + margin-right: 1em } + +img.align-right, .figure.align-right { + clear: right ; + float: right ; + margin-left: 1em } + +.align-left { + text-align: left } + +.align-center { + clear: both ; + text-align: center } + +.align-right { + text-align: right } + +/* reset inner alignment in figures */ +div.align-right { + text-align: left } + +/* div.align-center * { */ +/* text-align: left } */ + +ol.simple, ul.simple { + margin-bottom: 1em } + +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 } + +p.attribution { + text-align: right ; + margin-left: 50% } + +p.caption { + font-style: italic } + +p.credits { + font-style: italic ; + font-size: smaller } + +p.label { + white-space: nowrap } + +p.rubric { + font-weight: bold ; + font-size: larger ; + color: maroon ; + text-align: center } + +p.sidebar-title { + font-family: sans-serif ; + font-weight: bold ; + font-size: larger } + +p.sidebar-subtitle { + font-family: sans-serif ; + font-weight: bold } + +p.topic-title { + font-weight: bold } + +pre.address { + margin-bottom: 0 ; + margin-top: 0 ; + font: inherit } + +pre.literal-block, pre.doctest-block { + margin-left: 2em ; + margin-right: 2em } + +span.classifier { + font-family: sans-serif ; + font-style: oblique } + +span.classifier-delimiter { + font-family: sans-serif ; + font-weight: bold } + +span.interpreted { + font-family: sans-serif } + +span.option { + white-space: nowrap } + +span.pre { + white-space: pre } + +span.problematic { + color: red } + +span.section-subtitle { + /* font-size relative to parent (h1..h6 element) */ + font-size: 80% } + +table.citation { + border-left: solid 1px gray; + margin-left: 1px } + +table.docinfo { + margin: 2em 4em } + +table.docutils { + margin-top: 0.5em ; + margin-bottom: 0.5em } + +table.footnote { + border-left: solid 1px black; + margin-left: 1px } + +table.docutils td, table.docutils th, +table.docinfo td, table.docinfo th { + padding-left: 0.5em ; + padding-right: 0.5em ; + vertical-align: top } + +table.docutils th.field-name, table.docinfo th.docinfo-name { + font-weight: bold ; + text-align: left ; + white-space: nowrap ; + padding-left: 0 } + +h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, +h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { + font-size: 100% } + +ul.auto-toc { + list-style-type: none } + +</style> +</head> +<body> +<div class="document"> + + +<div class="contents topic" id="contents"> +<p class="topic-title first">Contents</p> +<ul class="auto-toc simple"> +<li><a class="reference internal" href="#header" id="id1">1 Header</a><ul class="auto-toc"> +<li><a class="reference internal" href="#another-header" id="id2">1.1 Another header</a></li> +</ul> +</li> +</ul> +</div> +<div class="section" id="header"> +<h1><a class="toc-backref" href="#id1">1 Header</a></h1> +<div class="section" id="another-header"> +<h2><a class="toc-backref" href="#id2">1.1 Another header</a></h2> +</div> +</div> +</div> +</body> +</html> diff --git a/sandbox/rstdiff/tests/html/expected/footnote.html b/sandbox/rstdiff/tests/html/expected/footnote.html new file mode 100644 index 000000000..5c9e459b1 --- /dev/null +++ b/sandbox/rstdiff/tests/html/expected/footnote.html @@ -0,0 +1,319 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" /> +<title></title> +<style type="text/css"> + +/* +:Author: David Goodger (goodger@python.org) +:Id: $Id$ +:Copyright: This stylesheet has been placed in the public domain. + +Default cascading style sheet for the HTML output of Docutils. + +See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to +customize this style sheet. +*/ + +/* used to remove borders from tables and images */ +.borderless, table.borderless td, table.borderless th { + border: 0 } + +table.borderless td, table.borderless th { + /* Override padding for "table.docutils td" with "! important". + The right padding separates the table cells. */ + padding: 0 0.5em 0 0 ! important } + +.first { + /* Override more specific margin styles with "! important". */ + margin-top: 0 ! important } + +.last, .with-subtitle { + margin-bottom: 0 ! important } + +.hidden { + display: none } + +a.toc-backref { + text-decoration: none ; + color: black } + +blockquote.epigraph { + margin: 2em 5em ; } + +dl.docutils dd { + margin-bottom: 0.5em } + +/* Uncomment (and remove this text!) to get bold-faced definition list terms +dl.docutils dt { + font-weight: bold } +*/ + +div.abstract { + margin: 2em 5em } + +div.abstract p.topic-title { + font-weight: bold ; + text-align: center } + +div.admonition, div.attention, div.caution, div.danger, div.error, +div.hint, div.important, div.note, div.tip, div.warning { + margin: 2em ; + border: medium outset ; + padding: 1em } + +div.admonition p.admonition-title, div.hint p.admonition-title, +div.important p.admonition-title, div.note p.admonition-title, +div.tip p.admonition-title { + font-weight: bold ; + font-family: sans-serif } + +div.attention p.admonition-title, div.caution p.admonition-title, +div.danger p.admonition-title, div.error p.admonition-title, +div.warning p.admonition-title { + color: red ; + font-weight: bold ; + font-family: sans-serif } + +/* Uncomment (and remove this text!) to get reduced vertical space in + compound paragraphs. +div.compound .compound-first, div.compound .compound-middle { + margin-bottom: 0.5em } + +div.compound .compound-last, div.compound .compound-middle { + margin-top: 0.5em } +*/ + +div.dedication { + margin: 2em 5em ; + text-align: center ; + font-style: italic } + +div.dedication p.topic-title { + font-weight: bold ; + font-style: normal } + +div.figure { + margin-left: 2em ; + margin-right: 2em } + +div.footer, div.header { + clear: both; + font-size: smaller } + +div.line-block { + display: block ; + margin-top: 1em ; + margin-bottom: 1em } + +div.line-block div.line-block { + margin-top: 0 ; + margin-bottom: 0 ; + margin-left: 1.5em } + +div.sidebar { + margin: 0 0 0.5em 1em ; + border: medium outset ; + padding: 1em ; + background-color: #ffffee ; + width: 40% ; + float: right ; + clear: right } + +div.sidebar p.rubric { + font-family: sans-serif ; + font-size: medium } + +div.system-messages { + margin: 5em } + +div.system-messages h1 { + color: red } + +div.system-message { + border: medium outset ; + padding: 1em } + +div.system-message p.system-message-title { + color: red ; + font-weight: bold } + +div.topic { + margin: 2em } + +h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, +h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { + margin-top: 0.4em } + +h1.title { + text-align: center } + +h2.subtitle { + text-align: center } + +hr.docutils { + width: 75% } + +img.align-left, .figure.align-left{ + clear: left ; + float: left ; + margin-right: 1em } + +img.align-right, .figure.align-right { + clear: right ; + float: right ; + margin-left: 1em } + +.align-left { + text-align: left } + +.align-center { + clear: both ; + text-align: center } + +.align-right { + text-align: right } + +/* reset inner alignment in figures */ +div.align-right { + text-align: left } + +/* div.align-center * { */ +/* text-align: left } */ + +ol.simple, ul.simple { + margin-bottom: 1em } + +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 } + +p.attribution { + text-align: right ; + margin-left: 50% } + +p.caption { + font-style: italic } + +p.credits { + font-style: italic ; + font-size: smaller } + +p.label { + white-space: nowrap } + +p.rubric { + font-weight: bold ; + font-size: larger ; + color: maroon ; + text-align: center } + +p.sidebar-title { + font-family: sans-serif ; + font-weight: bold ; + font-size: larger } + +p.sidebar-subtitle { + font-family: sans-serif ; + font-weight: bold } + +p.topic-title { + font-weight: bold } + +pre.address { + margin-bottom: 0 ; + margin-top: 0 ; + font: inherit } + +pre.literal-block, pre.doctest-block { + margin-left: 2em ; + margin-right: 2em } + +span.classifier { + font-family: sans-serif ; + font-style: oblique } + +span.classifier-delimiter { + font-family: sans-serif ; + font-weight: bold } + +span.interpreted { + font-family: sans-serif } + +span.option { + white-space: nowrap } + +span.pre { + white-space: pre } + +span.problematic { + color: red } + +span.section-subtitle { + /* font-size relative to parent (h1..h6 element) */ + font-size: 80% } + +table.citation { + border-left: solid 1px gray; + margin-left: 1px } + +table.docinfo { + margin: 2em 4em } + +table.docutils { + margin-top: 0.5em ; + margin-bottom: 0.5em } + +table.footnote { + border-left: solid 1px black; + margin-left: 1px } + +table.docutils td, table.docutils th, +table.docinfo td, table.docinfo th { + padding-left: 0.5em ; + padding-right: 0.5em ; + vertical-align: top } + +table.docutils th.field-name, table.docinfo th.docinfo-name { + font-weight: bold ; + text-align: left ; + white-space: nowrap ; + padding-left: 0 } + +h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, +h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { + font-size: 100% } + +ul.auto-toc { + list-style-type: none } + +</style> +</head> +<body> +<div class="document"> + + +<p>A text <a class="footnote-reference" href="#id2" id="id1">[1]</a>.</p> +<table class="docutils footnote" frame="void" id="id2" rules="none"> +<colgroup><col class="label" /><col /></colgroup> +<tbody valign="top"> +<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>A footnote.</td></tr> +</tbody> +</table> +</div> +</body> +</html> diff --git a/sandbox/rstdiff/tests/html/expected/reference.html b/sandbox/rstdiff/tests/html/expected/reference.html new file mode 100644 index 000000000..ae3e6cd03 --- /dev/null +++ b/sandbox/rstdiff/tests/html/expected/reference.html @@ -0,0 +1,316 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" /> +<title></title> +<style type="text/css"> + +/* +:Author: David Goodger (goodger@python.org) +:Id: $Id$ +:Copyright: This stylesheet has been placed in the public domain. + +Default cascading style sheet for the HTML output of Docutils. + +See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to +customize this style sheet. +*/ + +/* used to remove borders from tables and images */ +.borderless, table.borderless td, table.borderless th { + border: 0 } + +table.borderless td, table.borderless th { + /* Override padding for "table.docutils td" with "! important". + The right padding separates the table cells. */ + padding: 0 0.5em 0 0 ! important } + +.first { + /* Override more specific margin styles with "! important". */ + margin-top: 0 ! important } + +.last, .with-subtitle { + margin-bottom: 0 ! important } + +.hidden { + display: none } + +a.toc-backref { + text-decoration: none ; + color: black } + +blockquote.epigraph { + margin: 2em 5em ; } + +dl.docutils dd { + margin-bottom: 0.5em } + +/* Uncomment (and remove this text!) to get bold-faced definition list terms +dl.docutils dt { + font-weight: bold } +*/ + +div.abstract { + margin: 2em 5em } + +div.abstract p.topic-title { + font-weight: bold ; + text-align: center } + +div.admonition, div.attention, div.caution, div.danger, div.error, +div.hint, div.important, div.note, div.tip, div.warning { + margin: 2em ; + border: medium outset ; + padding: 1em } + +div.admonition p.admonition-title, div.hint p.admonition-title, +div.important p.admonition-title, div.note p.admonition-title, +div.tip p.admonition-title { + font-weight: bold ; + font-family: sans-serif } + +div.attention p.admonition-title, div.caution p.admonition-title, +div.danger p.admonition-title, div.error p.admonition-title, +div.warning p.admonition-title { + color: red ; + font-weight: bold ; + font-family: sans-serif } + +/* Uncomment (and remove this text!) to get reduced vertical space in + compound paragraphs. +div.compound .compound-first, div.compound .compound-middle { + margin-bottom: 0.5em } + +div.compound .compound-last, div.compound .compound-middle { + margin-top: 0.5em } +*/ + +div.dedication { + margin: 2em 5em ; + text-align: center ; + font-style: italic } + +div.dedication p.topic-title { + font-weight: bold ; + font-style: normal } + +div.figure { + margin-left: 2em ; + margin-right: 2em } + +div.footer, div.header { + clear: both; + font-size: smaller } + +div.line-block { + display: block ; + margin-top: 1em ; + margin-bottom: 1em } + +div.line-block div.line-block { + margin-top: 0 ; + margin-bottom: 0 ; + margin-left: 1.5em } + +div.sidebar { + margin: 0 0 0.5em 1em ; + border: medium outset ; + padding: 1em ; + background-color: #ffffee ; + width: 40% ; + float: right ; + clear: right } + +div.sidebar p.rubric { + font-family: sans-serif ; + font-size: medium } + +div.system-messages { + margin: 5em } + +div.system-messages h1 { + color: red } + +div.system-message { + border: medium outset ; + padding: 1em } + +div.system-message p.system-message-title { + color: red ; + font-weight: bold } + +div.topic { + margin: 2em } + +h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, +h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { + margin-top: 0.4em } + +h1.title { + text-align: center } + +h2.subtitle { + text-align: center } + +hr.docutils { + width: 75% } + +img.align-left, .figure.align-left{ + clear: left ; + float: left ; + margin-right: 1em } + +img.align-right, .figure.align-right { + clear: right ; + float: right ; + margin-left: 1em } + +.align-left { + text-align: left } + +.align-center { + clear: both ; + text-align: center } + +.align-right { + text-align: right } + +/* reset inner alignment in figures */ +div.align-right { + text-align: left } + +/* div.align-center * { */ +/* text-align: left } */ + +ol.simple, ul.simple { + margin-bottom: 1em } + +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 } + +p.attribution { + text-align: right ; + margin-left: 50% } + +p.caption { + font-style: italic } + +p.credits { + font-style: italic ; + font-size: smaller } + +p.label { + white-space: nowrap } + +p.rubric { + font-weight: bold ; + font-size: larger ; + color: maroon ; + text-align: center } + +p.sidebar-title { + font-family: sans-serif ; + font-weight: bold ; + font-size: larger } + +p.sidebar-subtitle { + font-family: sans-serif ; + font-weight: bold } + +p.topic-title { + font-weight: bold } + +pre.address { + margin-bottom: 0 ; + margin-top: 0 ; + font: inherit } + +pre.literal-block, pre.doctest-block { + margin-left: 2em ; + margin-right: 2em } + +span.classifier { + font-family: sans-serif ; + font-style: oblique } + +span.classifier-delimiter { + font-family: sans-serif ; + font-weight: bold } + +span.interpreted { + font-family: sans-serif } + +span.option { + white-space: nowrap } + +span.pre { + white-space: pre } + +span.problematic { + color: red } + +span.section-subtitle { + /* font-size relative to parent (h1..h6 element) */ + font-size: 80% } + +table.citation { + border-left: solid 1px gray; + margin-left: 1px } + +table.docinfo { + margin: 2em 4em } + +table.docutils { + margin-top: 0.5em ; + margin-bottom: 0.5em } + +table.footnote { + border-left: solid 1px black; + margin-left: 1px } + +table.docutils td, table.docutils th, +table.docinfo td, table.docinfo th { + padding-left: 0.5em ; + padding-right: 0.5em ; + vertical-align: top } + +table.docutils th.field-name, table.docinfo th.docinfo-name { + font-weight: bold ; + text-align: left ; + white-space: nowrap ; + padding-left: 0 } + +h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, +h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { + font-size: 100% } + +ul.auto-toc { + list-style-type: none } + +</style> +</head> +<body> +<div class="document"> + + +<div class="section" id="header"> +<h1>Header</h1> +<p>Reference to <a class="reference internal" href="#header">header</a>.</p> +</div> +</div> +</body> +</html> diff --git a/sandbox/rstdiff/tests/html/expected/textDifferent.html b/sandbox/rstdiff/tests/html/expected/textDifferent.html new file mode 100644 index 000000000..9980117b9 --- /dev/null +++ b/sandbox/rstdiff/tests/html/expected/textDifferent.html @@ -0,0 +1,313 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" /> +<title></title> +<style type="text/css"> + +/* +:Author: David Goodger (goodger@python.org) +:Id: $Id$ +:Copyright: This stylesheet has been placed in the public domain. + +Default cascading style sheet for the HTML output of Docutils. + +See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to +customize this style sheet. +*/ + +/* used to remove borders from tables and images */ +.borderless, table.borderless td, table.borderless th { + border: 0 } + +table.borderless td, table.borderless th { + /* Override padding for "table.docutils td" with "! important". + The right padding separates the table cells. */ + padding: 0 0.5em 0 0 ! important } + +.first { + /* Override more specific margin styles with "! important". */ + margin-top: 0 ! important } + +.last, .with-subtitle { + margin-bottom: 0 ! important } + +.hidden { + display: none } + +a.toc-backref { + text-decoration: none ; + color: black } + +blockquote.epigraph { + margin: 2em 5em ; } + +dl.docutils dd { + margin-bottom: 0.5em } + +/* Uncomment (and remove this text!) to get bold-faced definition list terms +dl.docutils dt { + font-weight: bold } +*/ + +div.abstract { + margin: 2em 5em } + +div.abstract p.topic-title { + font-weight: bold ; + text-align: center } + +div.admonition, div.attention, div.caution, div.danger, div.error, +div.hint, div.important, div.note, div.tip, div.warning { + margin: 2em ; + border: medium outset ; + padding: 1em } + +div.admonition p.admonition-title, div.hint p.admonition-title, +div.important p.admonition-title, div.note p.admonition-title, +div.tip p.admonition-title { + font-weight: bold ; + font-family: sans-serif } + +div.attention p.admonition-title, div.caution p.admonition-title, +div.danger p.admonition-title, div.error p.admonition-title, +div.warning p.admonition-title { + color: red ; + font-weight: bold ; + font-family: sans-serif } + +/* Uncomment (and remove this text!) to get reduced vertical space in + compound paragraphs. +div.compound .compound-first, div.compound .compound-middle { + margin-bottom: 0.5em } + +div.compound .compound-last, div.compound .compound-middle { + margin-top: 0.5em } +*/ + +div.dedication { + margin: 2em 5em ; + text-align: center ; + font-style: italic } + +div.dedication p.topic-title { + font-weight: bold ; + font-style: normal } + +div.figure { + margin-left: 2em ; + margin-right: 2em } + +div.footer, div.header { + clear: both; + font-size: smaller } + +div.line-block { + display: block ; + margin-top: 1em ; + margin-bottom: 1em } + +div.line-block div.line-block { + margin-top: 0 ; + margin-bottom: 0 ; + margin-left: 1.5em } + +div.sidebar { + margin: 0 0 0.5em 1em ; + border: medium outset ; + padding: 1em ; + background-color: #ffffee ; + width: 40% ; + float: right ; + clear: right } + +div.sidebar p.rubric { + font-family: sans-serif ; + font-size: medium } + +div.system-messages { + margin: 5em } + +div.system-messages h1 { + color: red } + +div.system-message { + border: medium outset ; + padding: 1em } + +div.system-message p.system-message-title { + color: red ; + font-weight: bold } + +div.topic { + margin: 2em } + +h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, +h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { + margin-top: 0.4em } + +h1.title { + text-align: center } + +h2.subtitle { + text-align: center } + +hr.docutils { + width: 75% } + +img.align-left, .figure.align-left{ + clear: left ; + float: left ; + margin-right: 1em } + +img.align-right, .figure.align-right { + clear: right ; + float: right ; + margin-left: 1em } + +.align-left { + text-align: left } + +.align-center { + clear: both ; + text-align: center } + +.align-right { + text-align: right } + +/* reset inner alignment in figures */ +div.align-right { + text-align: left } + +/* div.align-center * { */ +/* text-align: left } */ + +ol.simple, ul.simple { + margin-bottom: 1em } + +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 } + +p.attribution { + text-align: right ; + margin-left: 50% } + +p.caption { + font-style: italic } + +p.credits { + font-style: italic ; + font-size: smaller } + +p.label { + white-space: nowrap } + +p.rubric { + font-weight: bold ; + font-size: larger ; + color: maroon ; + text-align: center } + +p.sidebar-title { + font-family: sans-serif ; + font-weight: bold ; + font-size: larger } + +p.sidebar-subtitle { + font-family: sans-serif ; + font-weight: bold } + +p.topic-title { + font-weight: bold } + +pre.address { + margin-bottom: 0 ; + margin-top: 0 ; + font: inherit } + +pre.literal-block, pre.doctest-block { + margin-left: 2em ; + margin-right: 2em } + +span.classifier { + font-family: sans-serif ; + font-style: oblique } + +span.classifier-delimiter { + font-family: sans-serif ; + font-weight: bold } + +span.interpreted { + font-family: sans-serif } + +span.option { + white-space: nowrap } + +span.pre { + white-space: pre } + +span.problematic { + color: red } + +span.section-subtitle { + /* font-size relative to parent (h1..h6 element) */ + font-size: 80% } + +table.citation { + border-left: solid 1px gray; + margin-left: 1px } + +table.docinfo { + margin: 2em 4em } + +table.docutils { + margin-top: 0.5em ; + margin-bottom: 0.5em } + +table.footnote { + border-left: solid 1px black; + margin-left: 1px } + +table.docutils td, table.docutils th, +table.docinfo td, table.docinfo th { + padding-left: 0.5em ; + padding-right: 0.5em ; + vertical-align: top } + +table.docutils th.field-name, table.docinfo th.docinfo-name { + font-weight: bold ; + text-align: left ; + white-space: nowrap ; + padding-left: 0 } + +h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, +h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { + font-size: 100% } + +ul.auto-toc { + list-style-type: none } + +</style> +</head> +<body> +<div class="document"> + + +<p><span class="change-replaced">Some</span><span class="change-replacement">A changed</span> line.</p> +</div> +</body> +</html> diff --git a/sandbox/rstdiff/tests/html/filterunit.cfg b/sandbox/rstdiff/tests/html/filterunit.cfg new file mode 100644 index 000000000..430139648 --- /dev/null +++ b/sandbox/rstdiff/tests/html/filterunit.cfg @@ -0,0 +1,10 @@ +# Tests with the HTML writer + +command = ../../rstdiff.py + +inputExtension = .old.rst +inputExtension = .new.rst +inputCount = 2 +expectedExtension = .html + +options = --writer=html --no-doc-title $1< $2< diff --git a/sandbox/rstdiff/tests/html/input/contents.new.rst b/sandbox/rstdiff/tests/html/input/contents.new.rst new file mode 100644 index 000000000..afecbe5ea --- /dev/null +++ b/sandbox/rstdiff/tests/html/input/contents.new.rst @@ -0,0 +1,9 @@ +.. sectnum:: + +.. contents:: + +Header +====== + +Another header +-------------- diff --git a/sandbox/rstdiff/tests/html/input/contents.old.rst b/sandbox/rstdiff/tests/html/input/contents.old.rst new file mode 100644 index 000000000..afecbe5ea --- /dev/null +++ b/sandbox/rstdiff/tests/html/input/contents.old.rst @@ -0,0 +1,9 @@ +.. sectnum:: + +.. contents:: + +Header +====== + +Another header +-------------- diff --git a/sandbox/rstdiff/tests/html/input/footnote.new.rst b/sandbox/rstdiff/tests/html/input/footnote.new.rst new file mode 100644 index 000000000..c044acff3 --- /dev/null +++ b/sandbox/rstdiff/tests/html/input/footnote.new.rst @@ -0,0 +1,3 @@ +A text [#]_. + +.. [#] A footnote. diff --git a/sandbox/rstdiff/tests/html/input/footnote.old.rst b/sandbox/rstdiff/tests/html/input/footnote.old.rst new file mode 100644 index 000000000..c044acff3 --- /dev/null +++ b/sandbox/rstdiff/tests/html/input/footnote.old.rst @@ -0,0 +1,3 @@ +A text [#]_. + +.. [#] A footnote. diff --git a/sandbox/rstdiff/tests/html/input/reference.new.rst b/sandbox/rstdiff/tests/html/input/reference.new.rst new file mode 100644 index 000000000..fc904509f --- /dev/null +++ b/sandbox/rstdiff/tests/html/input/reference.new.rst @@ -0,0 +1,4 @@ +Header +====== + +Reference to header_. diff --git a/sandbox/rstdiff/tests/html/input/reference.old.rst b/sandbox/rstdiff/tests/html/input/reference.old.rst new file mode 100644 index 000000000..fc904509f --- /dev/null +++ b/sandbox/rstdiff/tests/html/input/reference.old.rst @@ -0,0 +1,4 @@ +Header +====== + +Reference to header_. diff --git a/sandbox/rstdiff/tests/html/input/textDifferent.new.rst b/sandbox/rstdiff/tests/html/input/textDifferent.new.rst new file mode 100644 index 000000000..4e3e1cc26 --- /dev/null +++ b/sandbox/rstdiff/tests/html/input/textDifferent.new.rst @@ -0,0 +1 @@ +A changed line. diff --git a/sandbox/rstdiff/tests/html/input/textDifferent.old.rst b/sandbox/rstdiff/tests/html/input/textDifferent.old.rst new file mode 100644 index 000000000..443e38aaf --- /dev/null +++ b/sandbox/rstdiff/tests/html/input/textDifferent.old.rst @@ -0,0 +1 @@ +Some line. |