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():
|
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(
|
||||||
|
|
|
@ -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)}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue