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

Properly render static documents #43

Merged
merged 3 commits into from
Feb 13, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 6 additions & 9 deletions shogun_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def sitemap():


@app.route('/docs/<path:filename>')
def docs_static(filename):
print app.root_path
return send_from_directory(DOCS_SUBMODULE_DIR, filename)
def docs_static(filename, template='doc.html'):
doc_content = get_markuped(filename.lower(), "docs/{}".format(filename))
return render_template(template, **locals())


@app.route('/googlec077134a354808ac.html')
Expand Down Expand Up @@ -146,8 +146,7 @@ def archives_static(filename):

@app.route('/')
def index():
about = get_markuped("about", "docs/ABOUT.md")
return render_template('home.html', **locals())
return docs_static('ABOUT.md', 'home.html')


@app.route('/showroom')
Expand All @@ -167,8 +166,7 @@ def docs():

@app.route('/mission')
def mission():
mission = get_markuped("mission", "docs/MISSION.md")
return render_template('mission.html', **locals())
return docs_static('MISSION.md')


@app.route('/doc/en/<path:filename>')
Expand All @@ -180,8 +178,7 @@ def doc(filename):

@app.route('/install')
def install():
install_content = get_markuped("install", "docs/INSTALL.md")
return render_template('install.html', **locals())
return docs_static('INSTALL.md')


@app.route('/irclogs')
Expand Down
4 changes: 1 addition & 3 deletions templates/mission.html → templates/doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
<div class="container pt">
<div class="row">
<div class="col-md-10 col-md-offset-1">

{{ mission }}

{{ doc_content }}
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<center><h1>About Shogun</h1></center>
{{ about }}
{{ doc_content }}
</div>
</div>
</div>
Expand Down
19 changes: 0 additions & 19 deletions templates/install.html

This file was deleted.