Skip to content
Permalink
Browse files

Add back to top button (#101)

* Add back to top button

* Minor changes

* Add gitignore

* Hide button in printed documents

* Add missing local changes

* Align th text to the left again
  • Loading branch information...
mathiascode authored and bearbin committed Sep 5, 2019
1 parent 4822fa8 commit 9821968301c84480984244b6c882812167a987e8
Showing with 35 additions and 5 deletions.
  1. +8 −1 generate.py
  2. +22 −2 {static/css → }/style.css
  3. +5 −2 template.html
@@ -19,6 +19,7 @@
def main():
# First off, load all of the data from disk into memory.
template = load_template()
css = load_css()
sections = load_sections()
# Run through the sections and linkify.
for s in sections:
@@ -37,7 +38,8 @@ def main():
head_title = title
# Write the actual content.
with open(os.path.join(output_directory, "index.html"), "w") as f:
f.write(template.safe_substitute(content=content,
f.write(template.safe_substitute(css=css,
content=content,
timestamp=timestamp,
title=title,
head_title=head_title,
@@ -50,6 +52,11 @@ def load_template():
# Read all of the data from the file and return it.
return string.Template(template_file.read())

def load_css():
with open(os.path.join(input_directory, "style.css"), "r") as css_file:
# Read all of the data from the file and return it.
return css_file.read()

def load_sections():
# First, define an empty dictionary to contain the section data.
# This dictionary will consist of keys of section names, with values of

Some generated files are not rendered by default. Learn more.

@@ -6,13 +6,16 @@
<title>${head_title}</title>
<meta name="description" content="This is the Cuberite User's Manual. It is intended as a guide on how to operate the basics of Cuberite, as well as an introduction to some advanced features.">
<link rel="canonical" href="https://book.cuberite.org/">
<link rel="stylesheet" href="css/style.css">
<style>
${css}
</style>
</head>
<body>
<a class="return-link" href="https://cuberite.org/">&lt;- Return to Cuberite.org</a>
<a name="top" class="return-link" href="https://cuberite.org/">&lt;- Return to Cuberite.org</a>
<h1>${title}</h1>
<p>Updated on ${timestamp}, Commit: <a href="https://github.com/cuberite/users-manual/commit/${commit_id}">${commit_id}</a></p>
${content}
<a class="top-button" href="#top">^</a>
<noscript>
<img class="hidden" src="https://analytics.cuberite.org/piwik.php?idsite=2&amp;rec=1" alt=""/>
</noscript>

0 comments on commit 9821968

Please sign in to comment.
You can’t perform that action at this time.