Account for 'required' text when wrapping desc column.

This commit is contained in:
Kegan Dougal 2015-05-21 11:27:54 +01:00
parent a7f3d39da2
commit ea9c6496bb
2 changed files with 7 additions and 4 deletions

View file

@ -45,7 +45,7 @@ from argparse import ArgumentParser, FileType
import json
import os
import sys
import textwrap
from textwrap import TextWrapper
import internal.units
import internal.sections
@ -85,8 +85,11 @@ def main(file_stream=None, out_dir=None):
def indent(input, indent):
return " "*indent + input
def wrap(input, wrap=80):
return '\n'.join(textwrap.wrap(input, wrap))
def wrap(input, wrap=80, initial_indent=""):
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
env = Environment(