implemented automatic summary generation, and added timestamps in page list

This commit is contained in:
2026-01-07 20:55:32 +01:00
parent 0422c3042a
commit dcae9feac7
8 changed files with 125 additions and 37 deletions

19
templates/_base.html Normal file
View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
{% block head %}
<meta charset="UTF-8">
<title>{{ title }}</title>
<link rel="stylesheet" href="/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
{% endblock head %}
</head>
<body>
<nav>
<a href="/">Home</a>
</nav>
<div id="content">{% block content %}{% endblock content %}</div>
</body>
</html>

41
templates/home.html Normal file
View File

@@ -0,0 +1,41 @@
{% extends "_base.html" %}
{% block title %}{{ title }}{% endblock title %}
{% block content %}
<h1>{{ title }}</h1>
<ol>
{% for file in files %}
<li>
<a href="./{{ file.filename }}">{{ file.title }}</a> -
<span class="local-date" data-timestamp="{{ file.datetime }}">
{{ file.datetime }}
</span>
</li>
{% endfor %}
</ol>
<hr />
<script>
document.addEventListener("DOMContentLoaded", function() {
const dateElements = document.querySelectorAll('.local-date');
dateElements.forEach(el => {
const rawValue = el.getAttribute('data-timestamp');
const unixTimestamp = parseInt(rawValue);
if (!isNaN(unixTimestamp)) {
const date = new Date(unixTimestamp * 1000);
el.textContent = date.toLocaleString(undefined, {
year: 'numeric',
month: 'short',
day: 'numeric',
hour: '2-digit',
minute: '2-digit'
});
}
});
});
</script>
{% endblock content %}

View File

@@ -1,21 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ title }}</title>
<link rel="stylesheet" href="/style.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
</head>
<body>
{% extends "_base.html" %}
{% block title %}{{ title }}{% endblock title %}
{% block content %}
<article>
{{ content | safe }}
</article>
<nav>
<a href="/">Home (Summary)</a>
</nav>
<script>
document.querySelectorAll('pre[data-code]').forEach((block) => {
const wrapper = document.createElement('div');
@@ -51,5 +40,4 @@
});
});
</script>
</body>
</html>
{% endblock content %}