aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2020-11-26 15:09:37 +0300
committerAlexander Kabui2020-11-26 15:09:37 +0300
commit416cb0cd272001651a3d9eb43500067ef524819d (patch)
tree46e8e8c90add7561e9c3e1dad374544c0bbdcf84
parent2a346d94a978c8a7faf0d1435220816efc3c2c64 (diff)
downloadgenenetwork2-416cb0cd272001651a3d9eb43500067ef524819d.tar.gz
add endpoint for polices,environments and policies
-rw-r--r--wqflask/wqflask/markdown_routes.py51
1 files changed, 29 insertions, 22 deletions
diff --git a/wqflask/wqflask/markdown_routes.py b/wqflask/wqflask/markdown_routes.py
index 60d4374c..5170fcf0 100644
--- a/wqflask/wqflask/markdown_routes.py
+++ b/wqflask/wqflask/markdown_routes.py
@@ -9,23 +9,31 @@ from flask import Blueprint
from flask import render_template
glossary_blueprint = Blueprint('glossary_blueprint', __name__)
-references_blueprint=Blueprint("references_blueprint",__name__)
-environments_blueprint=Blueprint("environments_blueprint",__name__)
-links_blueprint=Blueprint("links_blueprint",__name__)
-policies_blueprint=Blueprint("policies_blueprint",__name__)
+references_blueprint = Blueprint("references_blueprint", __name__)
+environments_blueprint = Blueprint("environments_blueprint", __name__)
+links_blueprint = Blueprint("links_blueprint", __name__)
+policies_blueprint = Blueprint("policies_blueprint", __name__)
-def render_markdown(file_name):
+#for debug
+github_url = ("https://raw.githubusercontent.com/"
+ "genenetwork/gn-docs/master/general/glossary/glossary.md")
+
+
+
+def render_markdown(file_name,github_url="https://raw.githubusercontent.com/Alexanderlacuna/gn-docs/feature/add-markdown-pages/"):
+
+ md_content=requests.get(f"{github_url}{file_name}")
"""Try to fetch the file name from Github and if that fails, try to
look for it inside the file system
-
+po
"""
- github_url = ("https://raw.githubusercontent.com/"
- "genenetwork/gn-docs/master/")
- md_content = requests.get(f"{github_url}{file_name}")
+ # github_url = ("https://raw.githubusercontent.com/"
+ # "genenetwork/gn-docs/master/")
+ # md_content = requests.get(f"{github_url}{file_name}")
if md_content.status_code == 200:
+ # print(md_content.content.decode("utf-8"))
return markdown.Markdown().convert(md_content.content.decode("utf-8"))
-
# TODO: Add fallback on our git server by checking the mirror.
# Content not available
@@ -36,8 +44,6 @@ look for it inside the file system
"Please reach out to the gn2 team to have a look at this")
-
-
@glossary_blueprint.route('/')
def glossary():
return render_template(
@@ -48,23 +54,24 @@ def glossary():
@references_blueprint.route('/')
def references():
return render_template(
- "reference.html",
- rendered_markdown=render_markdown("general/glossary/glossary.md")), 200
-
+ "references.html",
+ rendered_markdown=render_markdown("general/references/references.md")), 200
@environments_blueprint.route("/")
-def references():
- return render_template("environments.html",rendered_markdown=render_markdown("general/environments/environments.md"))
+def environments():
+ return render_template("environments.html", rendered_markdown=render_markdown("general/links/links.md"))
@links_blueprint.route("/")
def links():
- return rendered_template("links.html",rendered_markdown=render_markdown("general/links/links.md"))
+ return render_template(
+ "links.html",
+ rendered_markdown=render_markdown("general/links/links.md")), 200
-policies_blueprint.route("/")
+@policies_blueprint.route("/")
def policies():
- return rendered_template("policies.html",rendered_markdown=rendered_markdown("general/policies/policies.md"))
-
-
+ return render_template(
+ "links.html",
+ rendered_markdown=render_markdown("general/policies/policies.md")), 200