Actually produce valid RST from the template

pull/977/head
Kegan Dougal 9 years ago
parent 8643b4aadd
commit c237c9010a

@ -66,8 +66,12 @@ def check_unaccessed(name, store):
def main():
# add a template filter to produce pretty pretty JSON
def jsonify(input):
return json.dumps(input, indent=4)
def jsonify(input, pre_whitespace=0):
code = json.dumps(input, indent=4)
if pre_whitespace:
code = code.replace("\n", ("\n" +" "*pre_whitespace))
return code
# make Jinja aware of the templates and filters
env = Environment(

@ -1,7 +1,15 @@
{{event.type}}
--------------
Summary: {{event.summary}}
Type: {{event.typeof}}
Description: {{event.desc}}
JSON Format: {{event.json_format | jsonify}}
Example: {{example.content | jsonify}}
``{{event.type}}``
Summary:
{{event.summary}}
Type:
{{event.typeof}}
Description:
{{event.desc}}
JSON Format::
{{event.json_format | jsonify(4)}}
Example::
{{example.content | jsonify(4)}}

Loading…
Cancel
Save