aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/__init__.py2
-rw-r--r--wqflask/wqflask/glossary.py9
-rw-r--r--wqflask/wqflask/markdown_routes.py29
3 files changed, 30 insertions, 10 deletions
diff --git a/wqflask/wqflask/__init__.py b/wqflask/wqflask/__init__.py
index a3870ce6..874cde17 100644
--- a/wqflask/wqflask/__init__.py
+++ b/wqflask/wqflask/__init__.py
@@ -6,7 +6,7 @@ import jinja2
from flask import g
from flask import Flask
from utility import formatting
-from wqflask.glossary import glossary_blueprint
+from wqflask.markdown_routes import glossary_blueprint
app = Flask(__name__)
diff --git a/wqflask/wqflask/glossary.py b/wqflask/wqflask/glossary.py
deleted file mode 100644
index a44e7c45..00000000
--- a/wqflask/wqflask/glossary.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from flask import Blueprint
-from flask import render_template
-
-glossary_blueprint = Blueprint('glossary_blueprint', __name__)
-
-
-@glossary_blueprint.route('/')
-def glossary():
- return render_template("glossary.html"), 200
diff --git a/wqflask/wqflask/markdown_routes.py b/wqflask/wqflask/markdown_routes.py
new file mode 100644
index 00000000..e7e3c33e
--- /dev/null
+++ b/wqflask/wqflask/markdown_routes.py
@@ -0,0 +1,29 @@
+"""Markdown routes
+
+Render pages from github, or if they are unavailable, look for it else where
+"""
+import requests
+import mistune
+
+from flask import Blueprint
+from flask import render_template
+
+glossary_blueprint = Blueprint('glossary_blueprint', __name__)
+
+
+@glossary_blueprint.route('/')
+def glossary():
+ markdown_url = ("https://raw.githubusercontent.com"
+ "/genenetwork/genenetwork2/"
+ "wqflask/wqflask/static"
+ "/glossary.md")
+ md_content = requests.get(markdown_url)
+ if md_content.status_code == 200:
+ return render_template(
+ "glossary_html",
+ rendered_markdown=mistune.html(
+ md_content.content.decode("utf-8"))), 200
+
+ return render_template(
+ "glossary.html",
+ rendered_markdown=mistune.html("# Github Down!")), 200