# HG changeset patch # User Ludovic Chabant # Date 1464924096 25200 # Node ID 3ab6f7a3a2c72eace1dae3eb0df60bf4815aad0f # Parent c6035785dbfcb8168444a4112b1eb7be5af100a5 cm: Add generation of Mardown changelog suitable for the online documentation. diff -r c6035785dbfc -r 3ab6f7a3a2c7 garcon/changelog.py --- a/garcon/changelog.py Thu Jun 02 13:01:08 2016 -0700 +++ b/garcon/changelog.py Thu Jun 02 20:21:36 2016 -0700 @@ -45,7 +45,8 @@ '--template', hg_log_template]) hglog = hglog.decode('utf8') - templates = _get_templates() + _, out_ext = os.path.splitext(out_file) + templates = _get_templates(out_ext) with open(out_file, 'w', encoding='utf8', newline='') as fp: fp.write(templates['header']) @@ -129,6 +130,7 @@ continue tokens = { + 'num': str(version), 'sub_num': str(i), 'category': cat_name.title()} tpl = _multi_replace(templates['category_title'], tokens) @@ -146,13 +148,14 @@ return s -def _get_templates(): +def _get_templates(extension): tpl_dir = os.path.join(os.path.dirname(__file__), 'changelog') tpls = {} for name in os.listdir(tpl_dir): - tpl = _get_template(os.path.join(tpl_dir, name)) - name_no_ext, _ = os.path.splitext(name) - tpls[name_no_ext] = tpl + if name.endswith(extension): + tpl = _get_template(os.path.join(tpl_dir, name)) + name_no_ext, _ = os.path.splitext(name) + tpls[name_no_ext] = tpl return tpls diff -r c6035785dbfc -r 3ab6f7a3a2c7 garcon/changelog/category_title.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/garcon/changelog/category_title.md Thu Jun 02 20:21:36 2016 -0700 @@ -0,0 +1,3 @@ + +### %num%.%sub_num% %category% + diff -r c6035785dbfc -r 3ab6f7a3a2c7 garcon/changelog/category_title.rst --- a/garcon/changelog/category_title.rst Thu Jun 02 13:01:08 2016 -0700 +++ b/garcon/changelog/category_title.rst Thu Jun 02 20:21:36 2016 -0700 @@ -1,4 +1,4 @@ -1.%sub_num% %category% +%num%.%sub_num% %category% ---------------------- diff -r c6035785dbfc -r 3ab6f7a3a2c7 garcon/changelog/header.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/garcon/changelog/header.md Thu Jun 02 20:21:36 2016 -0700 @@ -0,0 +1,7 @@ +--- +title: Changelog +layout: simple +--- + +# Changelog + diff -r c6035785dbfc -r 3ab6f7a3a2c7 garcon/changelog/version_title.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/garcon/changelog/version_title.md Thu Jun 02 20:21:36 2016 -0700 @@ -0,0 +1,3 @@ + +## %num%. PieCrust %version% (%date%) +