Re: New feature: more sourcecode highlighting
Yasushi Iwata <yasusii-aid3/A5iOTfPDbFq/[email protected]> Tue, 27 Jan 2004 16:02:32 +0900 (JST)
| Newsgroups | gmane.comp.pythin.pyds.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, On Mon, 26 Jan 2004 12:04:23 +0100 you wrote: > I just added support (and dependency) for SilverCity to PyDS (Roberto Alsina > pointed me to it). This adds a new reST directive code-block that is used > like this: code_block() receives content as unicode, so encoding and decoding are needed. Here's patch for codeblock.py.
codeblock.py.diff
(text/plain, 727 B)
--- codeblock.py.orig 2004-01-27 15:54:02.000000000 +0900
+++ codeblock.py 2004-01-27 15:53:19.000000000 +0900
@@ -32,9 +32,12 @@
docutils.nodes.literal_block(block_text, block_text), line=lineno )
return [error]
io = StringIO.StringIO()
- generator().generate_html( io, '\n'.join(content) )
+ content = '\n'.join(content)
+ if type(content) == type(u''):
+ content = content.encode(_PyDS.documentEncoding)
+ generator().generate_html( io, content)
html = '<div class="code-block">\n%s\n</div>\n' % io.getvalue()
- raw = docutils.nodes.raw('',html, format = 'html')
+ raw = docutils.nodes.raw('',html.decode(_PyDS.documentEncoding), format = 'html')
return [raw]
code_block.arguments = (1,0,0)