gaisen/templates/main.html

68 lines
1.9 KiB
HTML
Raw Normal View History

2024-02-24 05:46:16 +00:00
{% extends 'base.html' %}
{% block title %}{{ path }}{% endblock %}
{% macro render_tree(tree, root='/') %}
<ul>
{% for entry in tree %}
<li>
<a href="{{ root }}{{ entry.name }}">{{ entry.name }}</a>
{{ render_tree(entry.children, root + entry.name + '/') }}
</li>
{% endfor %}
</ul>
2024-02-24 05:46:16 +00:00
{% endmacro %}
{% block body %}
<main>
<nav>
{{ render_tree(item_list.children) }}
</nav>
2024-02-24 05:46:16 +00:00
<article>
{% if not edit %}
{% autoescape false %}
{{ markdown(content, extensions=['extra']) }}
{% endautoescape %}
2024-02-24 05:46:16 +00:00
{% if path != '/' %}
<a href="{{ path }}?edit">Edit</a>
{% endif %}
{% else %}
<form method="POST" action="{{ path }}">
<textarea id="markdown-textarea" name="text">{{ content }}</textarea>
<input type="submit" value="Save"/>
<form>
<script>
const easyMDE = new EasyMDE({
element: document.getElementById('markdown-textarea'),
autosave: {
enabled: false,
uniqueId: "whatever-i-guess",
delay: 1000,
submit_delay: 5000,
timeFormat: {
locale: 'en-US',
format: {
//year: 'numeric',
//month: 'long',
//day: '2-digit',
hour: '2-digit',
minute: '2-digit',
2024-02-24 05:46:16 +00:00
},
},
text: "Autosaved: "
},
});
</script>
{% endif %}
</article>
</main>
2024-02-24 05:46:16 +00:00
{% set footer = config.get('foote') %}
{% if footer not in [None, False, ""] %}
<footer>{{ config.get('footer') }}</footer>
{% endif %}
2024-02-24 05:46:16 +00:00
{% endblock %}