aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/api
diff options
context:
space:
mode:
authorAlexander_Kabui2024-09-12 22:27:50 +0300
committerAlexander_Kabui2024-09-12 22:27:50 +0300
commit386271aa9acfa6aaece858a8b7b0f8ab4e4e9db4 (patch)
treee85d08742236aac7901b6af34eff33a0cd76c202 /gn2/wqflask/api
parentf5e0f484b1d555edaeb1e998867a4b9266dea761 (diff)
downloadgenenetwork2-386271aa9acfa6aaece858a8b7b0f8ab4e4e9db4.tar.gz
Render markdown from genenenetwork:gn-docs.
Diffstat (limited to 'gn2/wqflask/api')
-rw-r--r--gn2/wqflask/api/markdown.py43
1 files changed, 32 insertions, 11 deletions
diff --git a/gn2/wqflask/api/markdown.py b/gn2/wqflask/api/markdown.py
index 403eef72..062c8f6c 100644
--- a/gn2/wqflask/api/markdown.py
+++ b/gn2/wqflask/api/markdown.py
@@ -114,30 +114,42 @@ def get_blogs(user: str = "genenetwork",
@glossary_blueprint.route('/')
def glossary():
+ file_data = fetch_raw_markdown(file_path="general/glossary/glossary.md")
return render_template(
"glossary.html",
- rendered_markdown=render_markdown("general/glossary/glossary.md")), 200
-
+ rendered_markdown=render_markdown_as_html(file_data["content"]),
+ file_path=file_data["file_path"]
+ )
@references_blueprint.route('/')
def references():
+
+ file_data = fetch_raw_markdown(file_path="general/references/references.md")
return render_template(
"references.html",
- rendered_markdown=render_markdown("general/references/references.md")), 200
+ rendered_markdown=render_markdown_as_html(file_data["content"]),
+ file_path=file_data["file_path"]
+ )
@news_blueprint.route('/')
def news():
+ file_data = fetch_raw_markdown(file_path="general/news/news.md")
return render_template(
"news.html",
- rendered_markdown=render_markdown("general/news/news.md")), 200
+ render_markdown=render_markdown_as_html(file_data["content"]),
+ file_path=file_data["file_path"]
+ )
@xapian_syntax_blueprint.route('/')
def xapian():
+ file_data = fetch_raw_markdown(file_path="general/search/xapian_syntax.md")
return render_template(
"search-syntax.html",
- rendered_markdown=render_markdown("general/search/xapian_syntax.md")), 200
+ rendered_markdown=render_markdown_as_html(file_data["content"]),
+ file_path=file_data["file_path"]
+ )
@environments_blueprint.route("/")
@@ -163,12 +175,11 @@ def environments():
200
)
# Fallback: Fetch file from server
+ file_data = fetch_raw_markdown(file_path="general/environment/environment.md")
return (render_template(
"environment.html",
svg_data=None,
- rendered_markdown=render_markdown(
- "general/environments/environments.md")),
- 200)
+ rendered_markdown=render_markdown_as_html(file_data["content"])))
@environments_blueprint.route('/svg-dependency-graph')
@@ -180,21 +191,31 @@ def svg_graph():
@links_blueprint.route("/")
def links():
+ file_data = fetch_raw_markdown(file_path="general/links/links.md")
return render_template(
"links.html",
- rendered_markdown=render_markdown("general/links/links.md")), 200
+ rendered_markdown=render_markdown_as_html(file_data["content"]),
+ file_path=file_data["file_path"]
+ )
@policies_blueprint.route("/")
def policies():
+ file_data = fetch_raw_markdown(file_path="general/policies/policies.md")
return render_template(
"policies.html",
- rendered_markdown=render_markdown("general/policies/policies.md")), 200
+ rendered_markdown=render_markdown_as_html(file_data["content"]),
+ file_path=file_data["file_path"]
+ )
@facilities_blueprint.route("/")
def facilities():
- return render_template("facilities.html", rendered_markdown=render_markdown("general/help/facilities.md")), 200
+ file_data = fetch_raw_markdown(file_path="general/help/facilities.md")
+ return render_template("facilities.html",
+ rendered_markdown=render_markdown_as_html(file_data["content"]),
+ file_path=file_data["file_path"]
+ )
@blogs_blueprint.route("/<path:blog_path>")