Skip to content

Commit

Permalink
added version in the HTML page footer
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobord committed Apr 22, 2016
1 parent 1b71fec commit 4b6a096
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 8 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
import markdown
from mdx_gfm import GithubFlavoredMarkdownExtension
import yaml
from shell import shell


if __name__ == '__main__':

version = shell('git describe --tags').output(raw=True)

build_path = 'build'
static_path = join(build_path, 'static')
with open(join('templates', 'base.html')) as fd:
Expand Down Expand Up @@ -48,6 +51,7 @@
body=body,
title=directory,
static='../static',
version=version,
)
target_dir = join(build_path, directory)
if not os.path.isdir(target_dir):
Expand Down Expand Up @@ -97,7 +101,8 @@
html = template.substitute(
body=body_html,
title="Home",
static='static'
static='static',
version=version
)
with open(join(build_path, 'index.html'), 'w') as fd:
fd.write(html)
Expand All @@ -113,7 +118,8 @@
html = template.substitute(
body=license_html,
title="Open Gaming License",
static='static'
static='static',
version=version
)
with open(join(build_path, 'license.html'), 'w') as fd:
fd.write(html)
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<body>
<section>$body</section>
<footer>
<p>This website is made by Bruno Bord - 2016, based on David Black &amp; Peter Regan work -- <a href="https://github.com/brunobord/the-black-hack">Github project</a>.</p>
<p>This website is made by Bruno Bord - 2016, based on David Black &amp; Peter Regan work -- <a href="https://github.com/brunobord/the-black-hack">Github project</a> -- build: v$version</p>

</footer>
</body>
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ basepython = python3.4
deps =
py-gfm
PyYAML
shell
# For debuggin purposes
ipdb
commands =
python build.py

0 comments on commit 4b6a096

Please sign in to comment.