Exemplo n.º 1
0
def pages_preview():
    # We only care about content.
    # Loading other attributes improperly will cause Marshmallow to incorrectly return a dict
    data = {"content": request.form.get("content")}
    schema = PageSchema()
    page = schema.load(data)
    return render_template("page.html", content=build_html(page.data.content))
Exemplo n.º 2
0
    def html(self):
        from CTFd.utils.config.pages import build_html, build_markdown

        if self.format == "markdown":
            return build_markdown(self.content)
        elif self.format == "html":
            return build_html(self.content)
        else:
            return build_markdown(self.content)
Exemplo n.º 3
0
def privacy():
    privacy_url = get_config("privacy_url")
    privacy_text = get_config("privacy_text")
    if privacy_url:
        return redirect(privacy_url)
    elif privacy_text:
        return render_template("page.html", content=build_html(privacy_text))
    else:
        abort(404)
Exemplo n.º 4
0
def tos():
    tos_url = get_config("tos_url")
    tos_text = get_config("tos_text")
    if tos_url:
        return redirect(tos_url)
    elif tos_text:
        return render_template("page.html", content=build_html(tos_text))
    else:
        abort(404)
Exemplo n.º 5
0
    def html(self):
        from CTFd.utils.config.pages import build_html
        from CTFd.utils.helpers import markup

        return markup(build_html(self.content))
Exemplo n.º 6
0
def pages_preview():
    data = request.form.to_dict()
    schema = PageSchema()
    page = schema.load(data)
    return render_template("page.html", content=build_html(page.data.content))