annotate contenttransformer/transformers.py @ 2:1e2c475015d8

restructured text now works
author k0s <k0scist@gmail.com>
date Thu, 14 Jan 2010 00:09:06 -0500
parents 29805d442afc
children 1a267297f779
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
1 import docutils.core
2
1e2c475015d8 restructured text now works
k0s <k0scist@gmail.com>
parents: 0
diff changeset
2 import subprocess
0
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
3 from webob import Response
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
4
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
5 class Graphviz(object):
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
6 def __init__(self, content):
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
7 """create a Graphviz object"""
2
1e2c475015d8 restructured text now works
k0s <k0scist@gmail.com>
parents: 0
diff changeset
8 raise NotImplementedError # TODO
0
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
9
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
10 def __call__(self, environ, start_response):
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
11 """return a WSGI response"""
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
12
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
13
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
14 class RestructuredText(object):
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
15 settings = { 'report_level': 5 }
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
16
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
17 def __init__(self, content):
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
18 """template: genshi(?) template to use (???)"""
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
19 self.html = docutils.core.publish_string(content,
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
20 writer_name='html',
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
21 settings_overrides=self.settings)
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
22
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
23 def __call__(self, environ, start_response):
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
24 """return a WSGI response"""
2
1e2c475015d8 restructured text now works
k0s <k0scist@gmail.com>
parents: 0
diff changeset
25 return Response(content_type='text/html', body=self.html)(environ, start_response)