diff options
author | Alexander_Kabui | 2024-09-13 17:56:08 +0300 |
---|---|---|
committer | Alexander_Kabui | 2024-09-13 17:56:08 +0300 |
commit | 329b01b5a933c89d747eef18a1444928b978be0d (patch) | |
tree | 8c9e3851e25990430811a56efd5a5312d42c3784 /gn2/wqflask | |
parent | 954993cca85a90a1d2868a9852b685824686952e (diff) | |
download | genenetwork2-329b01b5a933c89d747eef18a1444928b978be0d.tar.gz |
Use gn_docs blueprint for doc files.
Diffstat (limited to 'gn2/wqflask')
-rw-r--r-- | gn2/wqflask/api/markdown.py | 27 | ||||
-rw-r--r-- | gn2/wqflask/templates/base.html | 16 | ||||
-rw-r--r-- | gn2/wqflask/templates/blogs_list.html | 4 |
3 files changed, 24 insertions, 23 deletions
diff --git a/gn2/wqflask/api/markdown.py b/gn2/wqflask/api/markdown.py index 9a43ecdb..f9e87ee3 100644 --- a/gn2/wqflask/api/markdown.py +++ b/gn2/wqflask/api/markdown.py @@ -49,6 +49,7 @@ def render_markdown_as_html(content): return markdown.markdown(content, extensions=["tables"]) + def render_markdown(file_name, is_remote_file=True): """Try to fetch the file name from Github and if that fails, try to look for it inside the file system """ @@ -117,7 +118,7 @@ def get_blogs(user: str = "genenetwork", return dict(sorted(blogs.items(), key=lambda x: x[0], reverse=True)) -@glossary_blueprint.route('/') +@gn_docs_blueprint.route('/glossary') def glossary(): file_data = fetch_raw_markdown(file_path="general/glossary/glossary.md") return render_template( @@ -128,11 +129,11 @@ def glossary(): ) -@references_blueprint.route('/') +@gn_docs_blueprint.route('/references') def references(): file_data = fetch_raw_markdown( - file_path="general/references/references.md") + file_path="general/references/references.md") return render_template( "generic_gn_docs.html", rendered_markdown=render_markdown_as_html(file_data["content"]), @@ -141,18 +142,18 @@ def references(): ) -@news_blueprint.route('/') +@gn_docs_blueprint.route('/news') def news(): file_data = fetch_raw_markdown(file_path="general/news/news.md") return render_template( "generic_gn_docs.html", - render_markdown=render_markdown_as_html(file_data["content"]), + rendered_markdown=render_markdown_as_html(file_data["content"]), file_path=file_data["file_path"], file_title=Path(file_data["file_path"]).stem ) -@xapian_syntax_blueprint.route('/') +@gn_docs_blueprint.route('/xapian') def xapian(): file_data = fetch_raw_markdown(file_path="general/search/xapian_syntax.md") return render_template( @@ -163,7 +164,7 @@ def xapian(): ) -@environments_blueprint.route("/") +@gn_docs_blueprint.route("/environments") def environments(): md_file = get_file_from_python_search_path("wqflask/DEPENDENCIES.md") @@ -194,14 +195,14 @@ def environments(): rendered_markdown=render_markdown_as_html(file_data["content"]))) -@environments_blueprint.route('/svg-dependency-graph') +@gn_docs_blueprint.route('/svg-dependency-graph') def svg_graph(): directory, file_name, _ = get_file_from_python_search_path( "wqflask/dependency-graph.svg").partition("dependency-graph.svg") return send_from_directory(directory, file_name) -@links_blueprint.route("/") +@gn_docs_blueprint.route("/links") def links(): file_data = fetch_raw_markdown(file_path="general/links/links.md") return render_template( @@ -212,7 +213,7 @@ def links(): ) -@policies_blueprint.route("/") +@gn_docs_blueprint.route("/policies") def policies(): file_data = fetch_raw_markdown(file_path="general/policies/policies.md") return render_template( @@ -223,7 +224,7 @@ def policies(): ) -@facilities_blueprint.route("/") +@gn_docs_blueprint.route("/facilities") def facilities(): file_data = fetch_raw_markdown(file_path="general/help/facilities.md") return render_template("generic_gn_docs.html", @@ -234,12 +235,12 @@ def facilities(): ) -@blogs_blueprint.route("/<path:blog_path>") +@gn_docs_blueprint.route("/blogs/<path:blog_path>") def display_blog(blog_path): return render_template("blogs.html", rendered_markdown=render_markdown(blog_path)) -@blogs_blueprint.route("/") +@gn_docs_blueprint.route("/blogs") def blogs_list(): blogs = get_blogs() diff --git a/gn2/wqflask/templates/base.html b/gn2/wqflask/templates/base.html index 9c4ebfdd..7db9aed6 100644 --- a/gn2/wqflask/templates/base.html +++ b/gn2/wqflask/templates/base.html @@ -82,16 +82,16 @@ <li class=""> <a href="/help" class="dropdow-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Help <span class="caret"></a> <ul class="dropdown-menu"> - <li><a href="{{ url_for('references_blueprint.references') }}">References</a></li> + <li><a href="{{ url_for('gn_docs_blueprint.references') }}">References</a></li> <li><a href="/tutorials">Webinars, Tutorials/Primers</a></li> - <li><a href="{{ url_for('blogs_blueprint.blogs_list') }}">Blogs</a></li> - <li><a href="{{ url_for('glossary_blueprint.glossary') }}">Glossary of Term</a></li> + <li><a href="{{ url_for('gn_docs_blueprint.blogs_list') }}">Blogs</a></li> + <li><a href="{{ url_for('gn_docs_blueprint.glossary') }}">Glossary of Term</a></li> <li><a href="http://gn1.genenetwork.org/faq.html">FAQ</a></li> - <li><a href="{{ url_for('policies_blueprint.policies') }}">Policies</a></li> - <li><a href="{{ url_for('links_blueprint.links') }}">Links</a></li> - <li><a href="{{ url_for('facilities_blueprint.facilities') }}">Facilities</a></li> - <li><a href="{{ url_for('environments_blueprint.environments') }}">Environments</a></li> - <li><a href="/news">GN1 News</a></li> + <li><a href="{{ url_for('gn_docs_blueprint.policies') }}">Policies</a></li> + <li><a href="{{ url_for('gn_docs_blueprint.links') }}">Links</a></li> + <li><a href="{{ url_for('gn_docs_blueprint.facilities') }}">Facilities</a></li> + <li><a href="{{ url_for('gn_docs_blueprint.environments') }}">Environments</a></li> + <li><a href="{{ url_for('gn_docs_blueprint.news') }}">GN1 News</a></li> </ul> </li> <li class=""> diff --git a/gn2/wqflask/templates/blogs_list.html b/gn2/wqflask/templates/blogs_list.html index 6bad4628..a74d24a2 100644 --- a/gn2/wqflask/templates/blogs_list.html +++ b/gn2/wqflask/templates/blogs_list.html @@ -40,7 +40,7 @@ <div class="blog_title"> <ul> <li> - <a href="{{ url_for('blogs_blueprint.display_blog',blog_path = blog.full_path)}}">{{blog['subtitle']}}</a> + <a href="{{ url_for('gn_docs_blueprint.display_blog',blog_path = blog.full_path)}}">{{blog['subtitle']}}</a> </li> </ul> </div> @@ -49,4 +49,4 @@ {%endfor%} </div> </div> -{% endblock %}
\ No newline at end of file +{% endblock %} |