Skip to content

Commit

Permalink
Merge pull request #9 from brunobord/version-number-footer
Browse files Browse the repository at this point in the history
Add the version on the footer
  • Loading branch information
brunobord committed Apr 22, 2016
2 parents 1b71fec + 7db4258 commit b1c5d5e
Show file tree
Hide file tree
Showing 4 changed files with 19 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
14 changes: 12 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand All @@ -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)
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$git_version ($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 b1c5d5e

Please sign in to comment.