Commit a4bf6a6922ecae0eafca619e9e972335d6c32d13 Parent: 0ba12e9f3d08a6875f5cd746bfe6f67da6e22641 Author: mcol <mcol@posteo.net> Date: 2021-11-21 19:45:02 +0000 Committer: mcol <mcol@posteo.net> Committed: 2021-11-21 19:45:02 +0000 More improvements to templating
templates/tree.html Modified
@@ -1,27 +1,29 @@ -{% include "template.html.include" %} +{% extends "template.html.include" %} -{% block title %}Tree{% endblock %} +{%- block title -%} +{{ name }} - target +{%- endblock -%} {% block body %} {% include "repo-table-header.html.include" %} <div id="content"> - <table id="files"> - <thead> - <tr> - <td><b>Mode</b></td> - <td><b>Name</b></td> - </tr> - </thead> + <table id="files"> + <thead> + <tr> + <td><b>Mode</b></td> + <td><b>Name</b></td> + </tr> + </thead> - <tbody> - {% for file in tree %} - <tr> - <td>{{ file.mode_symbolic }}</td> - <td><a href="{{ host }}/{{ name }}/file/{{ file.href }}">{{ file.path }}</a></td> - </tr> - {% endfor %} - </tbody> - </table> + <tbody> + {% for file in tree %} + <tr> + <td>{{ file.mode_symbolic }}</td> + <td><a href="{{ host }}/{{ name }}/file/{{ file.href }}">{{ file.path }}</a></td> + </tr> + {% endfor %} + </tbody> + </table> </div> {% endblock %}
templates/template.html.include Modified
@@ -4,11 +4,12 @@ <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>{{ name }} - {% block title %}{% endblock %}</title> + <title>{% block title %}{% endblock %}</title> <link rel="stylesheet" type="text/css" href="{{ host }}/style.css"/> <link rel="icon" type="image/png" href="/favicon.png"/> </head> <body> + {% block body %} {% endblock %} </body>
templates/repo-table-header.html.include Modified
@@ -15,8 +15,8 @@ <tr class="url"><td>git clone <a href="{{ host }}/{{ name }}">{{ host }}/{{ name }}</a></td></tr> <tr><td> <a href="{{ host }}/{{ name }}/tree.html">Files</a> | <a href="{{ host }}/{{ name }}/refs.html">Refs</a> - {% if readme %} | <a href="{{ readme.href }}">Readme</a>{% endif %} - {% if license %} | <a href="{{ license.href }}">License</a>{% endif %} + {% if readme %} | <a href="{{ host }}/{{ name }}/file/{{ readme.href }}">Readme</a>{% endif %} + {% if license %} | <a href="{{ host }}/{{ name }}/file/{{ license.href }}">License</a>{% endif %} </td></tr> </table> <hr>
templates/refs.html Modified
@@ -1,35 +1,37 @@ -{% include "template.html.include" %} +{% extends "template.html.include" %} -{% block title %}Refs{% endblock %} +{%- block title -%} +{{ name }} - Refs +{%- endblock -%} {% block body %} {% include "repo-table-header.html.include" %} <div id="content"> - <h2>Branches</h2> - <table id="branches"> - <thead> - <tr><td><b>Name</b></td><td><b>Last commit date</b></td><td><b>Last commit</b></td><td><b>Author</b></td></tr> - </thead> - <tbody> - {% for branch in branches %} - <tr><td>{{ branch.name }}</td><td>{{ branch.authored }}</td><td>{{ branch.title }}</td><td>{{ branch.author }}</td></tr> - {% endfor %} - </tbody> - </table> + <h2>Branches</h2> + <table id="branches"> + <thead> + <tr><td><b>Name</b></td><td><b>Last commit date</b></td><td><b>Last commit</b></td><td><b>Author</b></td></tr> + </thead> + <tbody> + {% for branch in branches %} + <tr><td>{{ branch.name }}</td><td>{{ branch.authored }}</td><td>{{ branch.title }}</td><td>{{ branch.author }}</td></tr> + {% endfor %} + </tbody> + </table> - <br> + <br> - <h2>Tags</h2> - <table id="tags"> - <thead> - <tr><td><b>Name</b></td><td><b>Last commit date</b></td><td><b>Last commit</b></td><td><b>Author</b></td></tr> - </thead> - <tbody> - {% for tag in tags %} - <tr><td>{{ tag.name }}</td><td>{{ tag.authored }}</td><td>{{ tag.title }}</td><td>{{ tag.author }}</td></tr> - {% endfor %} - </tbody> - </table> + <h2>Tags</h2> + <table id="tags"> + <thead> + <tr><td><b>Name</b></td><td><b>Last commit date</b></td><td><b>Last commit</b></td><td><b>Author</b></td></tr> + </thead> + <tbody> + {% for tag in tags %} + <tr><td>{{ tag.name }}</td><td>{{ tag.authored }}</td><td>{{ tag.title }}</td><td>{{ tag.author }}</td></tr> + {% endfor %} + </tbody> + </table> </div> {% endblock %}
templates/index.html Modified
@@ -1,25 +1,27 @@ -{% include "template.html.include" %} +{% extends "template.html.include" %} -{% block title %}{{ description }}{% endblock %} +{%- block title -%} +{{ description }} +{%- endblock -%} {% block body %} {% include "repo-table-header.html.include" %} <div id="content"> - <table id="log"> - <thead> - <tr> - <td><b>Date</b></td> - <td><b>Commit message</b></td> - <td><b>Author</b></td> - </tr> - </thead> + <table id="log"> + <thead> + <tr> + <td><b>Date</b></td> + <td><b>Commit message</b></td> + <td><b>Author</b></td> + </tr> + </thead> - <tbody> - {% for commit in commits[:50] %} - <tr><td>{{ commit.authored[:16] }}</td><td><a href="commits/{{ commit.id }}.html">{{ commit.title }}</a></td><td>{{ commit.author }}</td></tr> - {% endfor %} - </tbody> - </table> + <tbody> + {% for commit in commits[:50] %} + <tr><td>{{ commit.authored[:16] }}</td><td><a href="commit/{{ commit.id }}.html">{{ commit.title }}</a></td><td>{{ commit.author }}</td></tr> + {% endfor %} + </tbody> + </table> </div> {% endblock %}
templates/index-main.html Modified
@@ -1,26 +1,28 @@ -{% include "template.html.include" %} +{% extends "template.html.include" %} -{% block title %}{% endblock %} +{%- block title -%} +gitserve - Index +{%- endblock -%} {% block body %} <table id="head"> - <tr><td width="32px" rowspan="2"><a href="{{ host }}"><img src="{{ host }}/avatar.png" id="avatar"/></a></td> - <td rowspan="2"><a href="{{ host }}">{{ host }}</a> / <a href="{{ host }}">code</a></td><td class="link"><a href="{{ host }}/posts.html">posts</a></td></tr><tr><td class="link"><a href="{{ host }}/about.html">about</a></td></tr> + <tr><td width="32px" rowspan="2"><a href="{{ host }}"><img src="{{ host }}/avatar.png" id="avatar"/></a></td> + <td rowspan="2"><a href="{{ host }}">{{ host }}</a> / <a href="{{ host }}">code</a></td><td class="link"><a href="{{ host }}/posts.html">posts</a></td></tr><tr><td class="link"><a href="{{ host }}/about.html">about</a></td></tr> </table> <hr> <div id="content"> - <table id="index"> - <thead> - <tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Last commit</b></td></tr> - </thead> + <table id="index"> + <thead> + <tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Last commit</b></td></tr> + </thead> - <tbody> - {% for repo in repositories %} - <tr><td><a href="{{ repo.name }}">{{ repo.name }}</a></td><td>{{ repo.description }}</td><td>{{ repo.updated }}</td></tr> - {% endfor %} - </tbody> - </table> + <tbody> + {% for repo in repositories %} + <tr><td><a href="{{ repo.name }}">{{ repo.name }}</a></td><td>{{ repo.description }}</td><td>{{ repo.updated }}</td></tr> + {% endfor %} + </tbody> + </table> </div> {% endblock %}
templates/file.html Modified
@@ -1,37 +1,39 @@ -{% include "template.html.include" %} +{% extends "template.html.include" %} -{% block title %}{{ file }}{% endblock %} +{%- block title -%} +{{ name }} - {{ file }} +{%- endblock -%} {% block body %} {% include "repo-table-header.html.include" %} <div id="content"> - <p>{{ file }} {{ file.mode_symbolic }}</p><hr> + <p>{{ file }} {{ file.mode_symbolic }}</p><hr> {% if file.is_directory %} - <table id="files"> - <thead> - <tr> - <td><b>Mode</b></td> - <td><b>Name</b></td> - </tr> - </thead> + <table id="files"> + <thead> + <tr> + <td><b>Mode</b></td> + <td><b>Name</b></td> + </tr> + </thead> - <tbody> - {% for child in file.contents %} - <tr> - <td>{{ child.mode_symbolic }}</td> - <td><a href="{{ host }}/{{ name }}/file/{{ child.href }}">{{ child.path }}</a></td> - </tr> - {% endfor %} - </tbody> - </table> + <tbody> + {% for child in file.contents %} + <tr> + <td>{{ child.mode_symbolic }}</td> + <td><a href="{{ host }}/{{ name }}/file/{{ child.href }}">{{ child.path }}</a></td> + </tr> + {% endfor %} + </tbody> + </table> {% else %} - <pre id="blob"> + <pre id="blob"> {% for line in split(file.contents, '\n') %} <a href="#l{{ loop.index }}" class="line" id="l{{ loop.index }}">{{ printf("%7v", loop.index) }}</a> {{ line }} {% endfor %} {% endif %} - </pre> + </pre> </div> {% endblock %}
templates/commit.html Modified
@@ -1,18 +1,20 @@ -{% include "template.html.include" %} +{% extends "template.html.include" %} -{% block title %}{{ commit.title }}{% endblock %} +{%- block title -%} +{{ name }} - {{ commit.title }} +{%- endblock -%} {% block body %} {% include "repo-table-header.html.include" %} <div id="content"> - <pre><b>commit</b> <a href="{{ host }}/{{ name }}/commits/{{ commit.href }}">{{ commit.id }}</a> - <b>Author:</b> {{ commit.author }} <<a href="mailto:{{ commit.author_email }}">{{ commit.author_email }}</a>> - <b>Date:</b> {{ commit.authored }} - <b>Committer:</b> {{ commit.committer }} <<a href="mailto:{{ commit.committer_email }}">{{ commit.committer_email }}</a>> - <b>Committed:</b> {{ commit.committed }} + <pre><b>commit</b> <a href="{{ host }}/{{ name }}/commit/{{ commit.id }}.html">{{ commit.id }}</a> +<b>Author:</b> {{ commit.author }} <<a href="mailto:{{ commit.author_email }}">{{ commit.author_email }}</a>> +<b>Date:</b> {{ commit.authored }} +<b>Committer:</b> {{ commit.committer }} <<a href="mailto:{{ commit.committer_email }}">{{ commit.committer_email }}</a>> +<b>Committed:</b> {{ commit.committed }} - {{ commit.message }} - </pre> +{{ commit.message }} +</pre> </div> {% endblock %}