Here goes something

This commit is contained in:
Juno Takano 2025-12-09 18:28:39 -03:00
commit a7d944bbd4
16 changed files with 2700 additions and 0 deletions

44
templates/base.html Normal file
View file

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<title>{% block title %}{% endblock title %} &bullet; en</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/static/style.css" rel="stylesheet">
{% block head %}
{% endblock head %}
</head>
<body>
<nav style="text-align: center;">
<ul style="display: inline; padding-left: 0;">
<li style="display: inline;"><a href="/">Index</a></li>
<li style="display: inline;"><a href="/about">About</a></li>
<li style="display: inline;"><a href="/tree">Tree</a></li>
<li style="display: inline;"><a href="/graph/toml">TOML Graph</a></li>
<li style="display: inline;"><a href="/graph/json">JSON Graph</a></li>
</ul>
<hr>
</nav>
<main>
{% block body %}
{% endblock body %}
</main>
<footer>
<hr>
<div>
<cite>made by <a href="https://jutty.dev">jutty</a></cite>
&bullet;
<a href="/acknowledgments">acknowledgments</a>
&bullet;
<a href="https://codeberg.org/jutty/en">source code</a>
<br/>
built
<time>
{{ now(utc=true) | date(format="%Y-%m-%d %H:%M") }} UTC
</time>
&bullet;
<time>{{ now(timestamp=true) }} Unix Epoch</time>
</div>
</footer>
</body>
</html>

2
templates/empty.html Normal file
View file

@ -0,0 +1,2 @@
<p>There are no nodes. The graph is either empty or failed to parse.</p>
<p>Check the <a href="/graph/toml">raw endpoints</a> for possible parsing errors.</p>

14
templates/error.html Normal file
View file

@ -0,0 +1,14 @@
{% extends "base.html" %}
{%- block body %}
<h1>
{{ title | default(value="Unknown error") }}
</h1>
{{ message | default(value="This error has not been described in detail.") }}
<hr>
<div align=right style="margin-top: 4em; margin-right: 2em">
<p><em>It seems you have fallen out of the circle.</em></p>
<p>Maybe you'd like to climb back on the <a href="/tree">tree</a>?
</div>
</p>
{%- endblock body %}

38
templates/index.html Normal file
View file

@ -0,0 +1,38 @@
{% extends "base.html" %}
{% block title %}Index{% endblock title %}
{%- block body %}
<h1>en</h1>
<p>
<em>A non-linear writing instrument.</em>
{% if nodes %}
<form method="post">
<label for="node">Find by ID:</label>
<input type="text" name="node" required/>
<input type="submit" value="Submit"/>
</form>
<hr>
<h2>Nodes</h2>
<nav>
{% if root_node %}
<p>
<strong>Root</strong>:
<a href="/node/{{root_node.id}}">{{root_node.title}}</a>
</p>
{% endif %}
{% if nodes %}
<ul>
{% for node in nodes %}
{% if node.id != root_node.id %}
<li><a href="/node/{{node.id}}">{{node.title}}</a></li>
{% endif %}
{% endfor %}
{% endif %}
</ul>
</nav>
{% else %}
<hr>
{% include "empty.html" %}
{% endif %}
{%- endblock body %}

44
templates/node.html Normal file
View file

@ -0,0 +1,44 @@
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock title %}
{%- block body %}
<section>
<h1>{{ title }}</h1>
<code style="display: inline;">ID: {{ id }}</code>
<p>{{ body }}</p>
</section>
{% if connections or incoming %}
<aside>
<hr>
<h2>Connections</h2>
{% if connections %}
<ul>
{% for connection in connections %}
<li>
<strong>{{id}}</strong>
&#x1f86a;
<a href="/node/{{connection.to}}">{{connection.to}}</a>
</li>
{% endfor %}
</ul>
{% else %}
<em>No outgoing connections.</em>
{% endif %}
{% if incoming %}
<h3>Incoming connections</h3>
<ul>
{% for connection in incoming %}
<li>
<strong>{{connection.to}}</strong>
&#x1F868;
<a href="/node/{{connection.from}}">{{connection.from}}</a>
</li>
{% endfor %}
</ul>
{% endif %}
</aside>
{% else %}
<em>Node has no connections.</em>
{% endif %}
{%- endblock body %}

76
templates/tree.html Normal file
View file

@ -0,0 +1,76 @@
{% extends "base.html" %}
{% block title %}Tree{% endblock title %}
{%- block body %}
{% if nodes or root_node %}
<h1>Tree</h1>
<p><strong>Total nodes:</strong> {{ nodes | length }}</p>
{% if root_node %}
<h2>Root node</h2>
<ul>
<li>
<a href="/node/{{root_node.id}}">{{root_node.title}}</a>
<ul>
<li><strong>Body:</strong>
<ul style="display: inline; padding-left: 0;">
<li style="display: inline;">
<details style="display: inline; cursor: pointer;">
<summary style="display: inline;">
{{root_node.body | truncate(length=120)}}
</summary>
{{root_node.body}}
</details>
</li>
</ul>
{% if root_node.connections %}
<li><strong>Connections</strong>
<ul>
{% for connection in root_node.connections %}
<li><a href="/node/{{connection.to}}">{{connection.to}}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}
</ul>
</li>
</ul>
{% endif %}
{% if nodes %}
<h2>All nodes</h2>
<ul>
{% for node in nodes %}
<li>
<a href="/node/{{node.id}}">{{node.title}}</a>
<ul>
<li><strong>Body:</strong>
<ul style="display: inline; padding-left: 0;">
<li style="display: inline;">
<details style="display: inline; cursor: pointer;">
<summary style="display: inline;">
{{node.body | truncate(length=30)}}
</summary>
{{node.body}}
</details>
</li>
</ul>
{% if node.connections %}
<li><strong>Connections</strong>
<ul>
{% for connection in node.connections %}
<li><a href="/node/{{connection.to}}">{{connection.to}}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}
</ul>
</li>
{% endfor %}
{% endif %}
</ul>
{% else %}
<p>There are no nodes. The graph is either empty or failed to parse.</p>
{% endif %}
{%- endblock body %}