Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebHost: noscript faq and glossary #4061

Merged
merged 6 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions WebHostLib/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import jinja2.exceptions
from flask import request, redirect, url_for, render_template, Response, session, abort, send_from_directory
from pony.orm import count, commit, db_session
from werkzeug.utils import secure_filename

from worlds.AutoWorld import AutoWorldRegister
from . import app, cache
Expand Down Expand Up @@ -69,14 +70,28 @@ def tutorial_landing():

@app.route('/faq/<string:lang>/')
@cache.cached()
def faq(lang):
return render_template("faq.html", lang=lang)
def faq(lang: str):
import markdown
with open(os.path.join(app.static_folder, "assets", "faq", secure_filename(lang)+".md")) as f:
document = f.read()
return render_template(
"markdown_document.html",
title="Frequently Asked Questions",
html_from_markdown=markdown.markdown(document, extensions=["mdx_truly_sane_lists", "mdx_breakless_lists"]),
Berserker66 marked this conversation as resolved.
Show resolved Hide resolved
)


@app.route('/glossary/<string:lang>/')
@cache.cached()
def terms(lang):
return render_template("glossary.html", lang=lang)
def glossary(lang: str):
import markdown
with open(os.path.join(app.static_folder, "assets", "glossary", secure_filename(lang)+".md")) as f:
document = f.read()
return render_template(
"markdown_document.html",
title="Glossary",
html_from_markdown=markdown.markdown(document, extensions=["mdx_truly_sane_lists", "mdx_breakless_lists"]),
Berserker66 marked this conversation as resolved.
Show resolved Hide resolved
)


@app.route('/seed/<suuid:seed>')
Expand Down
3 changes: 3 additions & 0 deletions WebHostLib/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ bokeh>=3.1.1; python_version <= '3.8'
bokeh>=3.4.3; python_version == '3.9'
bokeh>=3.5.2; python_version >= '3.10'
markupsafe>=2.1.5
Markdown>=3.7
mdx_truly_sane_lists>=1.3
Berserker66 marked this conversation as resolved.
Show resolved Hide resolved
mdx-breakless-lists>=1.0.1
51 changes: 0 additions & 51 deletions WebHostLib/static/assets/faq.js

This file was deleted.

51 changes: 0 additions & 51 deletions WebHostLib/static/assets/glossary.js

This file was deleted.

17 changes: 0 additions & 17 deletions WebHostLib/templates/faq.html

This file was deleted.

17 changes: 0 additions & 17 deletions WebHostLib/templates/glossary.html

This file was deleted.

13 changes: 13 additions & 0 deletions WebHostLib/templates/markdown_document.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends 'pageWrapper.html' %}

{% block head %}
{% include 'header/grassHeader.html' %}
<title>{{ title }}</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename="styles/markdown.css") }}" />
{% endblock %}

{% block body %}
<div class="markdown">
{{ html_from_markdown | safe}}
</div>
{% endblock %}
Loading