Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the version on the footer #9

Merged
merged 2 commits into from
Apr 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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