Account for 'required' text when wrapping desc column.
This commit is contained in:
parent
a7f3d39da2
commit
ea9c6496bb
2 changed files with 7 additions and 4 deletions
|
@ -45,7 +45,7 @@ from argparse import ArgumentParser, FileType
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
from textwrap import TextWrapper
|
||||||
|
|
||||||
import internal.units
|
import internal.units
|
||||||
import internal.sections
|
import internal.sections
|
||||||
|
@ -85,8 +85,11 @@ def main(file_stream=None, out_dir=None):
|
||||||
def indent(input, indent):
|
def indent(input, indent):
|
||||||
return " "*indent + input
|
return " "*indent + input
|
||||||
|
|
||||||
def wrap(input, wrap=80):
|
def wrap(input, wrap=80, initial_indent=""):
|
||||||
return '\n'.join(textwrap.wrap(input, wrap))
|
if len(input) == 0:
|
||||||
|
return initial_indent
|
||||||
|
wrapper = TextWrapper(initial_indent=initial_indent, width=wrap)
|
||||||
|
return wrapper.fill(input)
|
||||||
|
|
||||||
# make Jinja aware of the templates and filters
|
# make Jinja aware of the templates and filters
|
||||||
env = Environment(
|
env = Environment(
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
{# Desc needs to prepend the required text (maybe) and prepend spaces too -#}
|
{# Desc needs to prepend the required text (maybe) and prepend spaces too -#}
|
||||||
{# It also needs to then wrap inside the desc col (43 ch width) -#}
|
{# It also needs to then wrap inside the desc col (43 ch width) -#}
|
||||||
{# -#}
|
{# -#}
|
||||||
{{row.key}}{{row.type|indent(19-row.key|length)}}{{row.req_str | indent(18 - (row.type|length))}}{{row.desc|wrap(43)|indent_block(37)}}
|
{{row.key}}{{row.type|indent(19-row.key|length)}}{{row.desc|wrap(43,row.req_str | indent(18 - (row.type|length))) |indent_block(37)}}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
================== ================= ===========================================
|
================== ================= ===========================================
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue