aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask
diff options
context:
space:
mode:
authorAlexander_Kabui2024-09-12 23:01:38 +0300
committerAlexander_Kabui2024-09-12 23:01:38 +0300
commitb8d55b7830364d00f8f69ce1f0614f4a945e0fd8 (patch)
treec6a8a99255071db13cd943175d73dac0adc551c0 /gn2/wqflask
parent18263411f6d38d3c5972693aa5afa23642099b61 (diff)
downloadgenenetwork2-b8d55b7830364d00f8f69ce1f0614f4a945e0fd8.tar.gz
Use generic template for similar templates.
Diffstat (limited to 'gn2/wqflask')
-rw-r--r--gn2/wqflask/api/markdown.py36
1 files changed, 22 insertions, 14 deletions
diff --git a/gn2/wqflask/api/markdown.py b/gn2/wqflask/api/markdown.py
index 8f153cb7..126d887f 100644
--- a/gn2/wqflask/api/markdown.py
+++ b/gn2/wqflask/api/markdown.py
@@ -7,6 +7,7 @@ import requests
import markdown
import os
import sys
+from pathlib import Path
from bs4 import BeautifulSoup # type: ignore
@@ -117,9 +118,10 @@ def get_blogs(user: str = "genenetwork",
def glossary():
file_data = fetch_raw_markdown(file_path="general/glossary/glossary.md")
return render_template(
- "glossary.html",
+ "generic_gn_docs.html",
rendered_markdown=render_markdown_as_html(file_data["content"]),
- file_path=file_data["file_path"]
+ file_path=file_data["file_path"],
+ file_title=Path(file_data["file_path"]).stem
)
@@ -129,9 +131,10 @@ def references():
file_data = fetch_raw_markdown(
file_path="general/references/references.md")
return render_template(
- "references.html",
+ "generic_gn_docs.html",
rendered_markdown=render_markdown_as_html(file_data["content"]),
- file_path=file_data["file_path"]
+ file_path=file_data["file_path"],
+ file_title=Path(file_data["file_path"]).stem
)
@@ -139,9 +142,10 @@ def references():
def news():
file_data = fetch_raw_markdown(file_path="general/news/news.md")
return render_template(
- "news.html",
+ "generic_gn_docs.html",
render_markdown=render_markdown_as_html(file_data["content"]),
- file_path=file_data["file_path"]
+ file_path=file_data["file_path"],
+ file_title=Path(file_data["file_path"]).stem
)
@@ -149,9 +153,10 @@ def news():
def xapian():
file_data = fetch_raw_markdown(file_path="general/search/xapian_syntax.md")
return render_template(
- "search-syntax.html",
+ "generic_gn_docs.html",
rendered_markdown=render_markdown_as_html(file_data["content"]),
- file_path=file_data["file_path"]
+ file_path=file_data["file_path"],
+ file_title=Path(file_data["file_path"]).stem
)
@@ -197,9 +202,10 @@ def svg_graph():
def links():
file_data = fetch_raw_markdown(file_path="general/links/links.md")
return render_template(
- "links.html",
+ "generic_gn_docs.html",
rendered_markdown=render_markdown_as_html(file_data["content"]),
- file_path=file_data["file_path"]
+ file_path=file_data["file_path"],
+ file_title=Path(file_data["file_path"]).stem
)
@@ -207,19 +213,21 @@ def links():
def policies():
file_data = fetch_raw_markdown(file_path="general/policies/policies.md")
return render_template(
- "policies.html",
+ "generic_gn_docs.html",
rendered_markdown=render_markdown_as_html(file_data["content"]),
- file_path=file_data["file_path"]
+ file_path=file_data["file_path"],
+ file_title=Path(file_data["file_path"]).stem
)
@facilities_blueprint.route("/")
def facilities():
file_data = fetch_raw_markdown(file_path="general/help/facilities.md")
- return render_template("facilities.html",
+ return render_template("generic_gn_docs.html",
rendered_markdown=render_markdown_as_html(
file_data["content"]),
- file_path=file_data["file_path"]
+ file_path=file_data["file_path"],
+ file_title=Path(file_data["file_path"]).stem
)