2024-02-24 05:46:16 +00:00
|
|
|
{% extends 'base.html' %}
|
|
|
|
|
|
|
|
{% block title %}{{ path }}{% endblock %}
|
|
|
|
|
|
|
|
{% macro render_tree(tree, root='/') %}
|
2024-02-24 07:33:32 +00:00
|
|
|
<ul>
|
|
|
|
{% for entry in tree %}
|
|
|
|
<li>
|
2024-02-24 09:35:36 +00:00
|
|
|
{% set url = path_join(root, entry.name) %}
|
|
|
|
<a href="{{ url }}">{{ entry.name }}</a>
|
|
|
|
{{ render_tree(entry.children, url) }}
|
2024-02-24 07:33:32 +00:00
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
2024-02-24 05:46:16 +00:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% block body %}
|
2024-02-24 07:33:32 +00:00
|
|
|
<main>
|
|
|
|
<nav>
|
2024-02-24 09:52:36 +00:00
|
|
|
{{ render_tree(document_tree.root.children) }}
|
2024-02-24 07:33:32 +00:00
|
|
|
</nav>
|
2024-02-24 05:46:16 +00:00
|
|
|
|
2024-02-24 07:33:32 +00:00
|
|
|
<article>
|
|
|
|
{% if not edit %}
|
2024-02-24 09:35:36 +00:00
|
|
|
{% if path != '' %}
|
2024-02-24 10:03:36 +00:00
|
|
|
<a href="/{{ path }}?edit">Edit</a>
|
2024-02-24 09:35:36 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2024-02-24 10:23:18 +00:00
|
|
|
{% if content is not none %}
|
|
|
|
{% autoescape false %}
|
|
|
|
{{ markdown(content, extensions=['extra']) }}
|
|
|
|
{% endautoescape %}
|
|
|
|
{% else %}
|
|
|
|
<p class="grayed">This document doesn't exist</p>
|
|
|
|
{% endif %}
|
2024-02-24 07:33:32 +00:00
|
|
|
{% else %}
|
2024-02-24 10:03:36 +00:00
|
|
|
<form method="POST" action="/{{ path }}">
|
2024-02-24 10:34:35 +00:00
|
|
|
{% set edit_content = content %}
|
|
|
|
{% if content is none %}
|
|
|
|
{% set edit_content = '# Title\n\nContent' %}
|
|
|
|
{% endif %}
|
|
|
|
<textarea id="markdown-textarea" name="text">{{ edit_content }}</textarea>
|
2024-02-24 07:33:32 +00:00
|
|
|
<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
|
|
|
},
|
|
|
|
},
|
2024-02-24 07:33:32 +00:00
|
|
|
text: "Autosaved: "
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
{% endif %}
|
2024-02-24 09:35:36 +00:00
|
|
|
|
|
|
|
<hr/>
|
|
|
|
|
2024-02-24 09:52:36 +00:00
|
|
|
{% for child in document_tree.get_node(path).children %}
|
2024-02-24 09:35:36 +00:00
|
|
|
|
|
|
|
{% if loop.first %}
|
|
|
|
<h1>Children</h1>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<a href="{{ path_join(path, child.name) }}">{{child.name}}</a>{% if not loop.last %},{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
|
2024-02-24 07:33:32 +00:00
|
|
|
</article>
|
|
|
|
</main>
|
2024-02-24 05:46:16 +00:00
|
|
|
|
2024-02-24 07:33:32 +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 %}
|