diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2019-11-22 21:00:58 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2019-11-22 21:00:58 +0100 |
commit | e1692ab7e9bc7d7244fbfb8c56dddf1feea7b3c1 (patch) | |
tree | 4db55cc615a39f3f0c3bf5f1866f00798a9d251d | |
parent | 73b3ff149190db1bdf331d3aab2f91200349e4a9 (diff) | |
download | weechat-e1692ab7e9bc7d7244fbfb8c56dddf1feea7b3c1.zip |
doc: add function to print counters, add separator lines (documentation generator)
-rw-r--r-- | doc/docgen.py | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/doc/docgen.py b/doc/docgen.py index 1ec6c8090..a41ed19b6 100644 --- a/doc/docgen.py +++ b/doc/docgen.py @@ -443,6 +443,15 @@ def get_plugins_priority(): return plugins_priority +def print_counters(label, files, updated): + """Print a line with counters.""" + color = weechat.color('*lightred') if updated > 0 else '' + weechat.prnt('', + 'docgen: {0}: {1} files, {2}{3}{4} updated' + ''.format(label, files, color, updated, + weechat.color('reset'))) + + # pylint: disable=too-many-locals, too-many-branches, too-many-statements # pylint: disable=too-many-nested-blocks def docgen_cmd_cb(data, buf, args): @@ -471,6 +480,8 @@ def docgen_cmd_cb(data, buf, args): translate = lambda s: (s and _(s)) or s escape = lambda s: s.replace('|', '\\|') + weechat.prnt('', '-' * 40) + for locale in locales: for key in num_files: if key != 'total2': @@ -711,7 +722,7 @@ def docgen_cmd_cb(data, buf, args): doc.write('|===\n') doc.update('completions', num_files, num_files_updated) - # write url options + # write URL options doc = AutogenDoc(directory, 'plugin_api', 'url_options') doc.write('[width="100%",cols="2,^1,7",options="header"]\n') doc.write('|===\n') @@ -738,14 +749,15 @@ def docgen_cmd_cb(data, buf, args): doc.update('plugins_priority', num_files, num_files_updated) # write counters - weechat.prnt('', - 'docgen: {0}: {1} files, {2} updated' - ''.format(locale, - num_files['total1'], - num_files_updated['total1'])) - weechat.prnt('', - 'docgen: total: {0} files, {1} updated' - ''.format(num_files['total2'], num_files_updated['total2'])) + print_counters(locale, num_files['total1'], + num_files_updated['total1']) + + weechat.prnt('', ' -' * 20) + + print_counters('total', num_files['total2'], num_files_updated['total2']) + + weechat.prnt('', '-' * 40) + return weechat.WEECHAT_RC_OK |