From acb7861cdadd24baa3d072b53f81344270b161f0 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Sun, 31 Jul 2022 17:34:02 +0100 Subject: [PATCH] Clean-up rendered HTML --- 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(-) diff --git a/templates/base.html b/templates/base.html index ff93441..3efe698 100644 --- a/templates/base.html +++ a/templates/base.html @@ -1,30 +1,33 @@ + {% block title %}rgit{% endblock %} - {% block head %}{% endblock %} - + {%- block head -%}{%- endblock %}
-

🏡 {% block header %}Git repository browser{% endblock %}

+

+ 🏡 + {% block header -%}Git repository browser{%- endblock %} +

-{% block nav %} +{%- block nav -%} -{% endblock %} +{%- endblock -%}
- {% block content %}{% endblock %} + {%- block content %}{% endblock -%}
-+ diff --git a/templates/index.html b/templates/index.html index a0f4c6f..2544395 100644 --- a/templates/index.html +++ a/templates/index.html @@ -12,44 +12,44 @@ - {% for (path, repositories) in repositories.iter() %} - {% if let Some(path) = path %} - {{ path }} - {% endif %} + {%- for (path, repositories) in repositories.iter() %} + {%- if let Some(path) = path %} + {{ path }} + {%- endif -%} - {%for repository in repositories %} - - - - {{ repository.name }} - - - - - {% if let Some(description) = repository.description %} - {{ description }} - {% else %} - Unnamed repository; edit this file 'description' to name the repository. - {% endif %} - - - - - {% if let Some(owner) = repository.owner %} - {{ owner }} - {% endif %} - - - - - - - - - {% endfor %} - {% endfor %} + {%- for repository in repositories %} + + + + {{- repository.name -}} + + + + + {%- if let Some(description) = repository.description -%} + {{- description -}} + {%- else -%} + Unnamed repository; edit this file 'description' to name the repository. + {%- endif -%} + + + + + {%- if let Some(owner) = repository.owner -%} + {{- owner -}} + {%- endif -%} + + + + + + + + + {%- endfor -%} + {%- endfor %} -{% endblock %}+{% endblock %} diff --git a/templates/repo/about.html b/templates/repo/about.html index 29ae116..c0e8565 100644 --- a/templates/repo/about.html +++ a/templates/repo/about.html @@ -1,25 +1,25 @@ {% extends "repo/base.html" %} -{% block head %} -{% if let Some(readme) = readme %} - {% if readme.0 == crate::git::ReadmeFormat::Markdown %} - - - {% endif %} -{% endif %} +{% block head -%} +{%- if let Some(readme) = readme -%} + {%- if readme.0 == crate::git::ReadmeFormat::Markdown %} + + + {%- 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 -%}
{{ readme.1 }}
- {% endmatch %} -{% else %} + {%- endmatch -%} +{%- else -%} No README in repository HEAD. -{% endif %} -{% endblock %}+{%- endif %} +{% endblock %} diff --git a/templates/repo/base.html b/templates/repo/base.html index 5a0a087..b4b58dc 100644 --- a/templates/repo/base.html +++ a/templates/repo/base.html @@ -1,10 +1,10 @@ {% extends "../base.html" %} {% block title %}{{ repo.display() }}{% endblock %} -{% block header %} -index : {{ repo.display() }} -{% endblock %} +{%- block header -%} + index : {{ repo.display() }} +{%- endblock -%} {% block nav %}