From 0dcf0f504625e66bca47620e1c8e6fc06f940f05 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 13 Feb 2014 16:29:55 -0800 Subject: [PATCH 1/2] Do not add superfluous div tags to the document, or sections --- lib/github/commands/rest2html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 66ebf42c..f6f8b6e2 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -8,6 +8,7 @@ Brandon Keepers Bryan Veloso Chris Wanstrath Dave Abrahams +Garen Torikian Gasper Zejn Michael Jones Sam Whited @@ -50,6 +51,21 @@ SETTINGS = { } class GitHubHTMLTranslator(HTMLTranslator): + # removes the
tag wrapped around docs + # see also: http://bit.ly/1exfq2h (warning! sourceforge link.) + def depart_document(self, node): + HTMLTranslator.depart_document(self, node) + self.html_body.pop(0) + self.html_body.pop() + + # technique for visiting sections, without generating additional divs + # see also: http://bit.ly/NHtyRx + def visit_section(self, node): + self.section_level += 1 + + def depart_section(self, node): + self.section_level -= 1 + def visit_literal_block(self, node): classes = node.attributes['classes'] if len(classes) >= 2 and classes[0] == 'code': From 70e6d5a64581a95b33bfe5a1d3e9a95a9034cc93 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 13 Feb 2014 16:30:14 -0800 Subject: [PATCH 2/2] Fix RST tests to remove superfluous divs --- test/markups/README.rst.html | 6 ------ test/markups/README.rst.txt.html | 7 ------- 2 files changed, 13 deletions(-) diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index b117e888..5bb052bb 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -1,8 +1,5 @@ -
-

Header 1

Example text.

-

Header 2

  1. Blah blah code blah
  2. @@ -32,6 +29,3 @@

    Header 2

    -
-
-
diff --git a/test/markups/README.rst.txt.html b/test/markups/README.rst.txt.html index 8e26e4f0..e60a5403 100644 --- a/test/markups/README.rst.txt.html +++ b/test/markups/README.rst.txt.html @@ -1,14 +1,7 @@ -
-

Header 1

Example text.

-

Header 2

  1. Blah blah code blah
  2. More code, hooray
-
-
-
-