Actually produce valid RST from the template
This commit is contained in:
parent
8643b4aadd
commit
c237c9010a
2 changed files with 21 additions and 9 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue