annotate contenttransformer/transformers.py @ 0:29805d442afc

initial commit of contenttransformer; still in the stub stage
author k0s <k0scist@gmail.com>
date Mon, 11 Jan 2010 11:32:24 -0500
parents
children 1e2c475015d8
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
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
2 from webob import Response
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
3
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
4 class Graphviz(object):
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
5 def __init__(self, content):
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
6 """create a Graphviz object"""
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
7
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
8 def __call__(self, environ, start_response):
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
9 """return a WSGI response"""
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
10
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
11
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
12 class RestructuredText(object):
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
13 settings = { 'report_level': 5 }
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
14
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
15 def __init__(self, content):
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
16 """template: genshi(?) template to use (???)"""
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
17 self.html = docutils.core.publish_string(content,
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
18 writer_name='html',
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
19 settings_overrides=self.settings)
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
20
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
21 def __call__(self, environ, start_response):
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
22 """return a WSGI response"""
29805d442afc initial commit of contenttransformer; still in the stub stage
k0s <k0scist@gmail.com>
parents:
diff changeset
23 return Response(content_type='text/html', body=self.html)