diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index c7c89dce..2dc7e2ac 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -236,6 +236,26 @@ class GitHubHTMLTranslator(HTMLTranslator): def depart_table(self, node): self.body.append('\n') + def visit_image(self, node): + """Custom visit_image for using the HTML align attribute for + image alignment, since css-classes will be stripped. + """ + HTMLTranslator.visit_image(self, node) + if self.body[-1].startswith('' % align + self.body[-1] = self.body[-1].replace(old, new) + def depart_image(self, node): uri = node['uri'] ext = os.path.splitext(uri)[1].lower() diff --git a/test/markups/README.rst b/test/markups/README.rst index 53cba9e0..3b70fdcd 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -82,6 +82,8 @@ someone@somewhere.org Press :kbd:`Ctrl+C` to quit +.. image:: foo.png + :align: right .. raw:: html diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 3ddfab76..f542fdbf 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -131,9 +131,7 @@
Press Ctrl+C to quit
- -RAW HTML!
p {color:blue;} + +RAW HTML!
p {color:blue;} \ No newline at end of file