68 lines
1.8 KiB
HTML
68 lines
1.8 KiB
HTML
{% 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>
|
|
{% endmacro %}
|
|
|
|
{% block body %}
|
|
<main>
|
|
<nav>
|
|
{{ render_tree(item_list) }}
|
|
</nav>
|
|
|
|
<article>
|
|
{% if not edit %}
|
|
{% autoescape false %}
|
|
{{ markdown(content, extensions=['extra']) }}
|
|
{% endautoescape %}
|
|
|
|
{% 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',
|
|
},
|
|
},
|
|
text: "Autosaved: "
|
|
},
|
|
});
|
|
</script>
|
|
{% endif %}
|
|
</article>
|
|
</main>
|
|
|
|
{% set footer = config.get('foote') %}
|
|
{% if footer not in [None, False, ""] %}
|
|
<footer>{{ config.get('footer') }}</footer>
|
|
{% endif %}
|
|
|
|
{% endblock %}
|