summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJulien Lacour2012-06-06 11:45:12 +0200
committerJulien Lacour2012-06-21 15:07:53 +0200
commit02897b6327ce0ef9107488dbd03dc725ebac7db0 (patch)
treea7485b36d943b170e5aa557a63c8ba67f0b15b5d /common
parent792b9ed42008e4d682b3efd4197eca961944fa3e (diff)
common/doc/template/glossary: support when terms are all shorter than header "Term"
Diffstat (limited to 'common')
-rwxr-xr-xcommon/doc/template/glossary/make_glossary5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/doc/template/glossary/make_glossary b/common/doc/template/glossary/make_glossary
index 28f357572d..f52a2b178c 100755
--- a/common/doc/template/glossary/make_glossary
+++ b/common/doc/template/glossary/make_glossary
@@ -52,11 +52,14 @@ def output_rst (glossary, textwidth = 78, title = None):
print '=' * len (title)
print
max_key = len (max (glossary.iterkeys (), key = len))
+ term_name = "Term"
+ if max_key < len (term_name):
+ max_key = len (term_name)
value_width = textwidth - 1 - max_key
max_value = min (len (max (glossary.itervalues (), key = len)),
value_width)
print '=' * max_key, '=' * max_value
- print '%-*s %s' % (max_key, "Term", "Definition")
+ print '%-*s %s' % (max_key, term_name, "Definition")
print '=' * max_key, '=' * max_value
join_indent = '\n' + ' ' * max_key + ' '
for k in sorted (glossary):