Clean-up rendered HTML
Diff
templates/base.html | 17 ++++++++++-------
templates/index.html | 76 +++++++++++++++++++++++++++++++++++++++++++++-------------------------------
templates/repo/about.html | 30 ++++++++++++++++--------------
templates/repo/base.html | 6 +++---
templates/repo/commit.html | 12 ++++++------
templates/repo/diff.html | 10 +++++-----
templates/repo/file.html | 8 ++++----
templates/repo/log.html | 2 +-
templates/repo/refs.html | 24 ++++++++++++------------
templates/repo/summary.html | 18 +++++++++---------
templates/repo/tree.html | 31 +++++++++++++++++--------------
templates/repo/macros/refs.html | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------
12 files changed, 202 insertions(+), 198 deletions(-)
@@ -1,30 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>{% block title %}rgit{% endblock %}</title>
{% block head %}{% endblock %}
<link rel="stylesheet" type="text/css" href="/style.css" />
{%- block head -%}{%- endblock %}
</head>
<body>
<header>
<h1><a href="/" class="no-hover">🏡</a> {% block header %}Git repository browser{% endblock %}</h1>
<h1>
<a href="/" class="no-hover">🏡</a>
{% block header -%}Git repository browser{%- endblock %}
</h1>
</header>
{% block nav %}
{%- block nav -%}
<nav>
<a href="/" class="active">index</a>
</nav>
{% endblock %}
{%- endblock -%}
<main>
{% block content %}{% endblock %}
{%- block content %}{% endblock -%}
</main>
<footer>
generated by <a href="https://github.com/w4/rgit" target="_blank">rgit</a> v{{ crate::CRATE_VERSION }} at {{ time::OffsetDateTime::now_utc().to_string() }}
</footer>
</body>
</html>
</html>
@@ -12,44 +12,44 @@
</thead>
<tbody>
{% for (path, repositories) in repositories.iter() %}
{% if let Some(path) = path %}
<tr><td class="repo-section" colspan="4">{{ path }}</td></tr>
{% endif %}
{%- for (path, repositories) in repositories.iter() %}
{%- if let Some(path) = path %}
<tr><td class="repo-section" colspan="4">{{ path }}</td></tr>
{%- endif -%}
{%for repository in repositories %}
<tr class="{% if path.is_some() %}has-parent{% endif %}">
<td>
<a href="/{% if let Some(path) = path %}{{ path }}/{% endif %}{{ repository.name }}">
{{ repository.name }}
</a>
</td>
<td>
<a href="/{% if let Some(path) = path %}{{ path }}/{% endif %}{{ repository.name }}">
{% if let Some(description) = repository.description %}
{{ description }}
{% else %}
Unnamed repository; edit this file 'description' to name the repository.
{% endif %}
</a>
</td>
<td>
<a href="/{% if let Some(path) = path %}{{ path }}/{% endif %}{{ repository.name }}">
{% if let Some(owner) = repository.owner %}
{{ owner }}
{% endif %}
</a>
</td>
<td>
<a href="/{% if let Some(path) = path %}{{ path }}/{% endif %}{{ repository.name }}">
<time datetime="{{ repository.last_modified }}" title="{{ repository.last_modified }}">
{{ repository.last_modified.clone()|timeago }}
</time>
</a>
</td>
</tr>
{% endfor %}
{% endfor %}
{%- for repository in repositories %}
<tr class="{% if path.is_some() %}has-parent{% endif %}">
<td>
<a href="/{% if let Some(path) = path %}{{ path }}/{% endif %}{{ repository.name }}">
{{- repository.name -}}
</a>
</td>
<td>
<a href="/{% if let Some(path) = path %}{{ path }}/{% endif %}{{ repository.name }}">
{%- if let Some(description) = repository.description -%}
{{- description -}}
{%- else -%}
Unnamed repository; edit this file 'description' to name the repository.
{%- endif -%}
</a>
</td>
<td>
<a href="/{% if let Some(path) = path %}{{ path }}/{% endif %}{{ repository.name }}">
{%- if let Some(owner) = repository.owner -%}
{{- owner -}}
{%- endif -%}
</a>
</td>
<td>
<a href="/{% if let Some(path) = path %}{{ path }}/{% endif %}{{ repository.name }}">
<time datetime="{{ repository.last_modified }}" title="{{ repository.last_modified }}">
{{- repository.last_modified.clone()|timeago -}}
</time>
</a>
</td>
</tr>
{%- endfor -%}
{%- endfor %}
</tbody>
</table>
{% endblock %}
{% endblock %}
@@ -1,25 +1,25 @@
{% extends "repo/base.html" %}
{% block head %}
{% if let Some(readme) = readme %}
{% if readme.0 == crate::git::ReadmeFormat::Markdown %}
<link rel="stylesheet" type="text/css" href="/highlight.css" />
<link rel="stylesheet" type="text/css" href="/highlight-dark.css" />
{% endif %}
{% endif %}
{% block head -%}
{%- if let Some(readme) = readme -%}
{%- if readme.0 == crate::git::ReadmeFormat::Markdown %}
<link rel="stylesheet" type="text/css" href="/highlight.css" />
<link rel="stylesheet" type="text/css" href="/highlight-dark.css" />
{%- endif -%}
{%- endif -%}
{% endblock %}
{% block about_nav_class %}active{% endblock %}
{% block content %}
{% if let Some(readme) = readme %}
{% match readme.0 %}
{% when crate::git::ReadmeFormat::Markdown %}
{% if let Some(readme) = readme -%}
{%- match readme.0 -%}
{%- when crate::git::ReadmeFormat::Markdown -%}
{{ readme.1|safe }}
{% when crate::git::ReadmeFormat::Plaintext %}
{%- when crate::git::ReadmeFormat::Plaintext -%}
<pre>{{ readme.1 }}</pre>
{% endmatch %}
{% else %}
{%- endmatch -%}
{%- else -%}
No README in repository HEAD.
{% endif %}
{% endblock %}
{%- endif %}
{% endblock %}
@@ -1,10 +1,10 @@
{% extends "../base.html" %}
{% block title %}{{ repo.display() }}{% endblock %}
{% block header %}
<a href="/" class="no-style">index</a> : {{ repo.display() }}
{% endblock %}
{%- block header -%}
<a href="/" class="no-style">index</a> : {{ repo.display() }}
{%- endblock -%}
{% block nav %}
<nav>
@@ -1,9 +1,9 @@
{% extends "repo/base.html" %}
{% block head %}
<link rel="stylesheet" type="text/css" href="/highlight.css" />
<link rel="stylesheet" type="text/css" href="/highlight-dark.css" />
{% endblock %}
<link rel="stylesheet" type="text/css" href="/highlight.css" />
<link rel="stylesheet" type="text/css" href="/highlight-dark.css" />
{%- endblock %}
{% block commit_nav_class %}active{% endblock %}
@@ -28,12 +28,12 @@
<th>tree</th>
<td colspan="2"><pre><a href="/{{ repo.display() }}/tree?id={{ commit.tree() }}" class="no-style">{{ commit.tree() }}</a></pre></td>
</tr>
{% for parent in commit.parents() %}
{%- for parent in commit.parents() %}
<tr>
<th>parent</th>
<td colspan="2"><pre><a href="/{{ repo.display() }}/commit?id={{ parent }}" class="no-style">{{ parent }}</a></pre></td>
</tr>
{% endfor %}
{%- endfor %}
</tbody>
</table>
@@ -43,4 +43,4 @@
<h3>Diff</h3>
<pre class="diff">{{ commit.diff_stats|safe }}
{{ commit.diff|safe }}</pre>
{% endblock %}
{% endblock %}
@@ -1,9 +1,9 @@
{% extends "repo/base.html" %}
{% block head %}
<link rel="stylesheet" type="text/css" href="/highlight.css" />
<link rel="stylesheet" type="text/css" href="/highlight-dark.css" />
{% endblock %}
{%- block head %}
<link rel="stylesheet" type="text/css" href="/highlight.css" />
<link rel="stylesheet" type="text/css" href="/highlight-dark.css" />
{%- endblock -%}
{% block diff_nav_class %}active{% endblock %}
@@ -11,4 +11,4 @@
<h2>Diff</h2>
<pre class="diff">{{ commit.diff_stats|safe }}
{{ commit.diff|safe }}</pre>
{% endblock %}
{% endblock %}
@@ -1,12 +1,12 @@
{% extends "repo/base.html" %}
{% block head %}
<link rel="stylesheet" type="text/css" href="/highlight.css" />
<link rel="stylesheet" type="text/css" href="/highlight-dark.css" />
{% endblock %}
<link rel="stylesheet" type="text/css" href="/highlight.css" />
<link rel="stylesheet" type="text/css" href="/highlight-dark.css" />
{%- endblock %}
{% block tree_nav_class %}active{% endblock %}
{% block content %}
<pre>{{ file.content|safe }}</pre>
{% endblock %}
{% endblock %}
@@ -17,4 +17,4 @@
{% endif %}
</div>
{% endif %}
{% endblock %}
{% endblock %}
@@ -7,17 +7,17 @@
<table class="repositories">
{% call refs::branch_table(refs.heads) %}
{% if !refs.tags.is_empty() %}
<tbody>
<tr class="separator">
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
{%- if !refs.tags.is_empty() %}
<tbody>
<tr class="separator">
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
{% call refs::tag_table(refs.tags) %}
{% endif %}
{%- call refs::tag_table(refs.tags) -%}
{%- endif %}
</table>
{% endblock %}
{% endblock %}
@@ -6,7 +6,7 @@
{% block content %}
<table class="repositories">
{% call refs::branch_table(refs.heads.iter().take(10)) %}
{% if refs.heads.len() > 10 %}
{%- if refs.heads.len() > 10 -%}
<tbody>
<tr class="no-background">
<td><a href="/{{ repo.display() }}/refs" class="no-style">[...]</a></td>
@@ -15,9 +15,9 @@
<td></td>
</tr>
</tbody>
{% endif %}
{%- endif -%}
{% if !refs.tags.is_empty() %}
{%- if !refs.tags.is_empty() -%}
<tbody>
<tr class="separator">
<td></td>
@@ -27,8 +27,8 @@
</tr>
</tbody>
{% call refs::tag_table(refs.tags.iter().take(10)) %}
{% if refs.tags.len() > 10 %}
{%- call refs::tag_table(refs.tags.iter().take(10)) -%}
{%- if refs.tags.len() > 10 -%}
<tbody>
<tr class="no-background">
<td><a href="/{{ repo.display() }}/refs" class="no-style">[...]</a></td>
@@ -37,8 +37,8 @@
<td></td>
</tr>
</tbody>
{% endif %}
{% endif %}
{%- endif -%}
{%- endif %}
<tbody>
<tr class="separator">
@@ -59,6 +59,6 @@
<td></td>
</tr>
</tbody>
{% endif %}
{%- endif %}
</table>
{% endblock %}
{% endblock %}
@@ -13,22 +13,23 @@
</thead>
<tbody>
{% for item in items %}
{% for item in items -%}
<tr>
{% match item %}
{% when crate::git::TreeItem::Tree with (tree) %}
<td><pre>{{ tree.mode|file_perms }}</pre></td>
<td><pre><a class="nested-tree" href="/{{ repo.display() }}/tree/{{ tree.path.display() }}{{ query }}">{{ tree.name }}</a></pre></td>
<td></td>
<td></td>
{% when crate::git::TreeItem::File with (file) %}
<td><pre>{{ file.mode|file_perms }}</pre></td>
<td><pre><a href="/{{ repo.display() }}/tree/{{ file.path.display() }}{{ query }}">{{ file.name }}</a></pre></td>
<td><pre>{{ file.size }}</pre></td>
<td></td>
{% endmatch %}
{% match item -%}
{%- when crate::git::TreeItem::Tree with (tree) -%}
<td><pre>{{ tree.mode|file_perms }}</pre></td>
<td><pre><a class="nested-tree" href="/{{ repo.display() }}/tree/{{ tree.path.display() }}{{ query }}">{{ tree.name }}</a></pre></td>
<td></td>
<td></td>
{%- when crate::git::TreeItem::File with (file) -%}
<td><pre>{{ file.mode|file_perms }}</pre></td>
<td><pre><a href="/{{ repo.display() }}/tree/{{ file.path.display() }}{{ query }}">{{ file.name }}</a></pre></td>
<td><pre>{{ file.size }}</pre></td>
<td></td>
{%- endmatch %}
</tr>
{% endfor %}
{% endfor -%}
</tbody>
</table>
{% endblock %}
{% endblock %}
@@ -1,88 +1,88 @@
{% macro branch_table(branches) %}
<thead>
<tr>
<th>Branch</th>
<th>Commit message</th>
<th>Author</th>
<th>Age</th>
</tr>
</thead>
{%- macro branch_table(branches) -%}
<thead>
<tr>
<th>Branch</th>
<th>Commit message</th>
<th>Author</th>
<th>Age</th>
</tr>
</thead>
<tbody>
{% for (name, commit) in branches %}
<tr>
<td><a href="/{{ repo.display() }}/log/?h={{ name }}">{{ name }}</a></td>
<td><a href="/{{ repo.display() }}/commit/?id={{ commit.get().hash|hex }}">{{ commit.get().summary }}</a></td>
<td>
<img src="https://www.gravatar.com/avatar/{{ commit.get().author.email|md5 }}?s=13&d=retro" width="13" height="13">
{{ commit.get().author.name }}
</td>
<td>
<time datetime="{{ commit.get().author.time }}" title="{{ commit.get().author.time }}">
{{ commit.get().author.time|timeago }}
</time>
</td>
</tr>
{% endfor %}
</tbody>
{% endmacro %}
<tbody>
{% for (name, commit) in branches -%}
<tr>
<td><a href="/{{ repo.display() }}/log/?h={{ name }}">{{ name }}</a></td>
<td><a href="/{{ repo.display() }}/commit/?id={{ commit.get().hash|hex }}">{{ commit.get().summary }}</a></td>
<td>
<img src="https://www.gravatar.com/avatar/{{ commit.get().author.email|md5 }}?s=13&d=retro" width="13" height="13">
{{ commit.get().author.name }}
</td>
<td>
<time datetime="{{ commit.get().author.time }}" title="{{ commit.get().author.time }}">
{{- commit.get().author.time|timeago -}}
</time>
</td>
</tr>
{% endfor -%}
</tbody>
{%- endmacro -%}
{% macro tag_table(tags) %}
<thead>
<tr class="no-background">
<th>Tag</th>
<th>Download</th>
<th>Author</th>
<th>Age</th>
</tr>
</thead>
{%- macro tag_table(tags) -%}
<thead>
<tr class="no-background">
<th>Tag</th>
<th>Download</th>
<th>Author</th>
<th>Age</th>
</tr>
</thead>
<tbody>
{% for (name, tag) in tags %}
<tr>
<td><a href="/{{ repo.display() }}/tag/?h={{ name }}">{{ name }}</a></td>
<td></td>
<td>
{% if let Some(tagger) = tag.get().tagger %}
<img src="https://www.gravatar.com/avatar/{{ tagger.email|md5 }}?s=13&d=retro" width="13" height="13">
{{ tagger.name }}
{% endif %}
</td>
<td>
{% if let Some(tagger) = tag.get().tagger %}
<time datetime="{{ tagger.time }}" title="{{ tagger.time }}">
{{ tagger.time|timeago }}
</time>
{% endif %}
</td>
</tr>
{% endfor %}
</thead>
{% endmacro %}
<tbody>
{% for (name, tag) in tags -%}
<tr>
<td><a href="/{{ repo.display() }}/tag/?h={{ name }}">{{- name -}}</a></td>
<td></td>
<td>
{% if let Some(tagger) = tag.get().tagger -%}
<img src="https://www.gravatar.com/avatar/{{ tagger.email|md5 }}?s=13&d=retro" width="13" height="13">
{{ tagger.name }}
{%- endif %}
</td>
<td>
{% if let Some(tagger) = tag.get().tagger -%}
<time datetime="{{ tagger.time }}" title="{{ tagger.time }}">
{{- tagger.time|timeago -}}
</time>
{%- endif %}
</td>
</tr>
{% endfor -%}
</tbody>
{%- endmacro -%}
{% macro commit_table(commits) %}
<thead>
<tr>
<th>Age</th>
<th>Commit message</th>
<th>Author</th>
</tr>
</thead>
{%- macro commit_table(commits) -%}
<thead>
<tr>
<th>Age</th>
<th>Commit message</th>
<th>Author</th>
</tr>
</thead>
<tbody>
{% for commit in commits %}
<tr>
<td>
<time datetime="{{ commit.committer.time }}" title="{{ commit.committer.time }}">
{{ commit.committer.time.clone()|timeago }}
</time>
</td>
<td><a href="/{{ repo.display() }}/commit/?id={{ commit.hash|hex }}">{{ commit.summary }}</a></td>
<td>
<img src="https://www.gravatar.com/avatar/{{ commit.author.email|md5 }}?s=13&d=retro" width="13" height="13">
{{ commit.author.name }}
</td>
</tr>
{% endfor %}
</tbody>
{% endmacro %}
<tbody>
{% for commit in commits -%}
<tr>
<td>
<time datetime="{{ commit.committer.time }}" title="{{ commit.committer.time }}">
{{- commit.committer.time.clone()|timeago -}}
</time>
</td>
<td><a href="/{{ repo.display() }}/commit/?id={{ commit.hash|hex }}">{{ commit.summary }}</a></td>
<td>
<img src="https://www.gravatar.com/avatar/{{ commit.author.email|md5 }}?s=13&d=retro" width="13" height="13">
{{ commit.author.name }}
</td>
</tr>
{% endfor -%}
</tbody>
{%- endmacro -%}