all repos — markup @ cd04f07a3af80bb279c067b936eec8fd32ef0805

The code we use to render README.your_favorite_markup

make utf-8 work with .rst files
Chris Wanstrath chris@ozmm.org
Mon, 29 Mar 2010 17:26:01 -0700
commit

cd04f07a3af80bb279c067b936eec8fd32ef0805

parent

bfc89e49451fa103adf6d138da2b45c0271b000c

3 files changed, 5 insertions(+), 2 deletions(-)

jump to
M lib/github/commands/rest2htmllib/github/commands/rest2html

@@ -14,6 +14,8 @@ except:

pass import sys +import codecs + from docutils.core import publish_parts from docutils.writers.html4css1 import Writer

@@ -35,7 +37,7 @@ Usage: rest2html < README.rst

rest2html README.rst """ try: - text = open(sys.argv[1], 'r').read() + text = codecs.open(sys.argv[1], 'r', 'utf-8').read() except IOError: # given filename could not be found return '' except IndexError: # no filename given
M test/markups/README.rsttest/markups/README.rst

@@ -10,4 +10,4 @@ 1. Blah blah ``code`` blah

2. More ``code``, hooray - +3. Somé UTF-8°
M test/markups/README.rst.htmltest/markups/README.rst.html

@@ -7,6 +7,7 @@ <h2>Header 2</h2>

<ol class="arabic simple"> <li>Blah blah <tt class="docutils literal">code</tt> blah</li> <li>More <tt class="docutils literal">code</tt>, hooray</li> +<li>Somé UTF-8°</li> </ol> </div> </div>