diff --git a/CHANGELOG.md b/CHANGELOG.md index e2b0834..ed8200a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## master (unreleased) + +* added the automatic version number on the built HTML page footer (#9) + ## 1.0.0 (2016-04-22) This is the first version of the *open gaming content* "SRD" of "The Black Hack" roleplaying game. Please refer to the [README](README.md) for more information. diff --git a/build.py b/build.py index cf88d22..2591f4f 100644 --- a/build.py +++ b/build.py @@ -11,10 +11,14 @@ import markdown from mdx_gfm import GithubFlavoredMarkdownExtension import yaml +from shell import shell if __name__ == '__main__': + version = shell('git describe --tags --abbrev=0').output(raw=True).strip() + git_version = shell('git describe --tags').output(raw=True).strip() + build_path = 'build' static_path = join(build_path, 'static') with open(join('templates', 'base.html')) as fd: @@ -48,6 +52,8 @@ body=body, title=directory, static='../static', + version=version, + git_version=git_version, ) target_dir = join(build_path, directory) if not os.path.isdir(target_dir): @@ -97,7 +103,9 @@ html = template.substitute( body=body_html, title="Home", - static='static' + static='static', + version=version, + git_version=git_version, ) with open(join(build_path, 'index.html'), 'w') as fd: fd.write(html) @@ -113,7 +121,9 @@ html = template.substitute( body=license_html, title="Open Gaming License", - static='static' + static='static', + version=version, + git_version=git_version, ) with open(join(build_path, 'license.html'), 'w') as fd: fd.write(html) diff --git a/templates/base.html b/templates/base.html index 465d89d..1b29778 100644 --- a/templates/base.html +++ b/templates/base.html @@ -70,7 +70,7 @@
$body
diff --git a/tox.ini b/tox.ini index 5a69923..f7131f5 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,8 @@ basepython = python3.4 deps = py-gfm PyYAML + shell + # For debuggin purposes ipdb commands = python build.py