Actually produce valid RST from the template

This commit is contained in:
Kegan Dougal 2015-05-19 15:54:24 +01:00
parent 8643b4aadd
commit c237c9010a
2 changed files with 21 additions and 9 deletions

View file

@ -66,8 +66,12 @@ def check_unaccessed(name, store):
def main(): def main():
# add a template filter to produce pretty pretty JSON # add a template filter to produce pretty pretty JSON
def jsonify(input): def jsonify(input, pre_whitespace=0):
return json.dumps(input, indent=4) 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 # make Jinja aware of the templates and filters
env = Environment( env = Environment(

View file

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