Commit b51a073

mo khan <mo@mokhan.ca>
2026-01-31 03:13:43
refactor: fix indentation in some of the html templates
1 parent 076a5bc
internal/templates/blob.gohtml
@@ -1,70 +1,63 @@
 {{- /*gotype: mokhan.ca/antonmedv/gitmal/pkg/templates.BlobParams */ -}}
 {{ define "head" }}
-    <style>
-        [id] {
-          scroll-margin-top: var(--header-height);
-        }
-
-        pre {
-          border: 1px solid var(--c-border);
-          border-top: none;
-          border-bottom-left-radius: var(--border-radius);
-          border-bottom-right-radius: var(--border-radius);
-        }
-
-        pre {
-          margin: 0;
-          padding: 8px 16px;
-          overflow-x: auto;
-          white-space: pre;
-          word-spacing: normal;
-          word-break: normal;
-          word-wrap: normal;
-          tab-size: 4;
-          font-family: var(--font-family-mono), monospace;
-        }
-
-        pre > code {
-          display: block;
-          padding: 0 16px;
-          width: fit-content;
-          min-width: 100%;
-          line-height: var(--code-line-height);
-          font-size: var(--code-font-size);
-        }
-
-        .border {
-          border: 1px solid var(--c-border);
-          border-top: none;
-          border-bottom-left-radius: 6px;
-          border-bottom-right-radius: 6px;
-        }
-
-        .binary-file {
-          padding: 8px 16px;
-          font-style: italic;
-        }
-
-        .image {
-          padding: 8px 16px;
-          text-align: center;
-        }
-
-        .image img {
-          max-width: 100%;
-          height: auto;
-        }
-    </style>
+<style>
+  [id] {
+    scroll-margin-top: var(--header-height);
+  }
+  pre {
+    border: 1px solid var(--c-border);
+    border-top: none;
+    border-bottom-left-radius: var(--border-radius);
+    border-bottom-right-radius: var(--border-radius);
+  }
+  pre {
+    margin: 0;
+    padding: 8px 16px;
+    overflow-x: auto;
+    white-space: pre;
+    word-spacing: normal;
+    word-break: normal;
+    word-wrap: normal;
+    tab-size: 4;
+    font-family: var(--font-family-mono), monospace;
+  }
+  pre > code {
+    display: block;
+    padding: 0 16px;
+    width: fit-content;
+    min-width: 100%;
+    line-height: var(--code-line-height);
+    font-size: var(--code-font-size);
+  }
+  .border {
+    border: 1px solid var(--c-border);
+    border-top: none;
+    border-bottom-left-radius: 6px;
+    border-bottom-right-radius: 6px;
+  }
+  .binary-file {
+    padding: 8px 16px;
+    font-style: italic;
+  }
+  .image {
+    padding: 8px 16px;
+    text-align: center;
+  }
+  .image img {
+    max-width: 100%;
+    height: auto;
+  }
+</style>
 {{ end }}
 
 {{ define "body" }}
-    {{ template "header" . }}
-    {{ if .IsImage }}
-        <div class="image border">{{.Content}}</div>
-    {{ else if .IsBinary}}
-        <div class="binary-file border">Binary file</div>
-    {{ else }}
-        {{ .Content }}
-    {{ end }}
+  {{ template "header" . }}
+  {{ if .IsImage }}
+    <div class="image border">{{.Content}}</div>
+  {{ else if .IsBinary}}
+    <div class="binary-file border">Binary file</div>
+  {{ else }}
+    {{ .Content }}
+  {{ end }}
 {{ end }}
 
internal/templates/branches.gohtml
@@ -1,58 +1,53 @@
 {{- /*gotype: mokhan.ca/antonmedv/gitmal/pkg/templates.BranchesParams*/ -}}
 {{ define "head" }}
-    <style>
-      .branches {
-        border: 1px solid var(--c-border);
-        border-radius: var(--border-radius);
-        overflow: hidden;
-      }
-
-      .branch-row {
-        display: flex;
-        align-items: center;
-        gap: 12px;
-        height: 44px;
-        padding-inline: 16px;
-        border-bottom: 1px solid var(--c-border);
-        background-color: var(--c-bg-elv);
-      }
-
-      .branch-row:last-child {
-        border-bottom: none;
-      }
-
-      .branch-row a {
-        color: var(--c-text-1);
-      }
-
-      .branch-row a:hover {
-        color: var(--c-brand-2);
-        text-decoration: none;
-      }
-
-      .badge {
-        font-size: 12px;
-        color: var(--c-text-2);
-        border: 1px solid var(--c-border);
-        padding: 2px 6px;
-        border-radius: 999px;
-      }
-    </style>
+<style>
+  .branches {
+    border: 1px solid var(--c-border);
+    border-radius: var(--border-radius);
+    overflow: hidden;
+  }
+  .branch-row {
+    display: flex;
+    align-items: center;
+    gap: 12px;
+    height: 44px;
+    padding-inline: 16px;
+    border-bottom: 1px solid var(--c-border);
+    background-color: var(--c-bg-elv);
+  }
+  .branch-row:last-child {
+    border-bottom: none;
+  }
+  .branch-row a {
+    color: var(--c-text-1);
+  }
+  .branch-row a:hover {
+    color: var(--c-brand-2);
+    text-decoration: none;
+  }
+  .badge {
+    font-size: 12px;
+    color: var(--c-text-2);
+    border: 1px solid var(--c-border);
+    padding: 2px 6px;
+    border-radius: 999px;
+  }
+</style>
 {{ end }}
 
 {{ define "body" }}
-    <h1>Branches</h1>
-    <div class="branches">
-        {{ if .Branches }}
-            {{ range .Branches }}
-                <div class="branch-row">
-                    <a href="{{ .Href }}">{{ .Name }}</a>
-                    {{ if .IsDefault }}<span class="badge">default</span>{{ end }}
-                    <a href="{{ .CommitsHref }}" style="margin-left:auto; font-size:13px; color: var(--c-text-2)">commits →</a>
-                </div>
-            {{ end }}
-        {{ else }}
-            <div class="branch-row">(no branches)</div>
-        {{ end }}
-    </div>
+  <h1>Branches</h1>
+  <div class="branches">
+    {{ if .Branches }}
+      {{ range .Branches }}
+        <div class="branch-row">
+          <a href="{{ .Href }}">{{ .Name }}</a>
+          {{ if .IsDefault }}<span class="badge">default</span>{{ end }}
+          <a href="{{ .CommitsHref }}" style="margin-left:auto; font-size:13px; color: var(--c-text-2)">commits →</a>
+        </div>
+      {{ end }}
+    {{ else }}
+      <div class="branch-row">(no branches)</div>
+    {{ end }}
+  </div>
 {{ end }}
internal/templates/commit.gohtml
@@ -1,220 +1,220 @@
 {{- /*gotype: mokhan.ca/antonmedv/gitmal/pkg/templates.CommitParams*/ -}}
 {{ define "head" }}
-    <style>
-      h1 code {
-        border-radius: var(--border-radius);
-        background: var(--c-bg-alt);
-        padding: 4px 8px;
-        font-family: var(--font-family-mono), monospace;
-        font-weight: 500;
-      }
-
-      .commit {
-        display: flex;
-        flex-direction: column;
-        gap: 16px;
-        margin-bottom: 16px;
-      }
-
-      .commit-info {
-        display: flex;
-        flex-direction: row;
-        gap: 8px;
-        align-items: flex-end;
-      }
-
-      .commit-author {
-        color: var(--c-text-1);
-        font-weight: 600;
-        min-width: 0;
-        overflow-wrap: break-word;
-      }
-
-      .commit-date {
-        color: var(--c-text-2);
-        font-size: 12px;
-        font-family: var(--font-family-mono), monospace;
-      }
-
-      .commit-message {
-        border: 1px solid var(--c-border);
-        border-radius: var(--border-radius);
-        padding: 16px;
-      }
-
-      .ref-badges {
-        display: inline-flex;
-        gap: 6px;
-        margin-left: 8px;
-      }
-
-      .badge {
-        font-size: 12px;
-        color: var(--c-text-2);
-        border: 1px solid var(--c-border);
-        padding: 2px 6px;
-        border-radius: 999px;
-        white-space: nowrap;
-      }
-
-      .commit-subject {
-        font-size: 16px;
-        font-weight: 600;
-        line-height: 1.3;
-        hyphens: auto;
-      }
-
-      .commit-body {
-        margin-top: 16px;
-        white-space: pre-wrap;
-        line-height: 1.5;
-        hyphens: auto;
-      }
-
-      .commit-subinfo {
-        display: flex;
-        flex-direction: row;
-        gap: 16px;
-        justify-content: space-between;
-      }
-
-      .commit-layout {
-        display: grid;
-        grid-template-columns: 1fr;
-        gap: 16px;
-      }
-
-      @media (min-width: 960px) {
-        .commit-layout {
-          grid-template-columns: 300px 1fr;
-          align-items: start;
-        }
-
-        .files-tree {
-          position: sticky;
-          top: 16px;
-        }
-
-        .files-tree-content {
-          max-height: calc(100vh - var(--header-height) - 40px);
-          overflow: auto;
-        }
-      }
-
-      .files-tree {
-        border: 1px solid var(--c-border);
-        border-radius: var(--border-radius);
-      }
-
-      .files-tree-header {
-        display: flex;
-        flex-direction: row;
-        align-items: center;
-        padding-inline: 16px;
-        height: var(--header-height);
-        border-bottom: 1px solid var(--c-border);
-        border-top-left-radius: var(--border-radius);
-        border-top-right-radius: var(--border-radius);
-        background: var(--c-bg-alt);
-        font-size: 14px;
-        font-weight: 600;
-      }
-
-      .files-tree-content {
-        display: block;
-        padding-block: 6px;
-      }
-
-      .tree .children {
-        margin-left: 16px;
-        border-left: 1px dashed var(--c-border);
-      }
-
-      .tree .node {
-        display: flex;
-        align-items: center;
-        gap: 8px;
-        padding: 10px 16px;
-      }
-
-      .tree .file-name {
-        flex: 1;
-        font-weight: 500;
-        color: var(--c-text-1);
-        cursor: pointer;
-      }
-
-      .tree .file-name:hover {
-        color: var(--c-brand-2);
-        text-decoration: underline;
-      }
-
-      .tree .dir {
-        color: var(--c-dir);
-      }
-
-      .tree .file-added {
-        color: var(--c-green);
-      }
-
-      .tree .file-deleted {
-        color: var(--c-red);
-      }
-
-      .tree .file-renamed {
-        color: var(--c-yellow);
-      }
-
-      /* Per-file sections */
-
-      .files {
-        min-width: 0;
-      }
-
-      .file-section + .file-section {
-        margin-top: 16px;
-      }
-
-      pre {
-        border: 1px solid var(--c-border);
-        border-top: none;
-        border-bottom-left-radius: var(--border-radius);
-        border-bottom-right-radius: var(--border-radius);
-      }
-
-      pre {
-        margin: 0;
-        padding: 8px 16px;
-        overflow-x: auto;
-        white-space: pre;
-        word-spacing: normal;
-        word-break: normal;
-        word-wrap: normal;
-        tab-size: 4;
-        font-family: var(--font-family-mono), monospace;
-      }
-
-      pre > code {
-        display: block;
-        padding: 0 16px;
-        width: fit-content;
-        min-width: 100%;
-        line-height: var(--code-line-height);
-        font-size: var(--code-font-size);
-      }
-
-      .binary-file {
-        padding: 8px 16px;
-        font-style: italic;
-      }
-
-      .border {
-        border: 1px solid var(--c-border);
-        border-top: none;
-        border-bottom-left-radius: 6px;
-        border-bottom-right-radius: 6px;
-      }
-    </style>
+<style>
+  h1 code {
+    border-radius: var(--border-radius);
+    background: var(--c-bg-alt);
+    padding: 4px 8px;
+    font-family: var(--font-family-mono), monospace;
+    font-weight: 500;
+  }
+
+  .commit {
+    display: flex;
+    flex-direction: column;
+    gap: 16px;
+    margin-bottom: 16px;
+  }
+
+  .commit-info {
+    display: flex;
+    flex-direction: row;
+    gap: 8px;
+    align-items: flex-end;
+  }
+
+  .commit-author {
+    color: var(--c-text-1);
+    font-weight: 600;
+    min-width: 0;
+    overflow-wrap: break-word;
+  }
+
+  .commit-date {
+    color: var(--c-text-2);
+    font-size: 12px;
+    font-family: var(--font-family-mono), monospace;
+  }
+
+  .commit-message {
+    border: 1px solid var(--c-border);
+    border-radius: var(--border-radius);
+    padding: 16px;
+  }
+
+  .ref-badges {
+    display: inline-flex;
+    gap: 6px;
+    margin-left: 8px;
+  }
+
+  .badge {
+    font-size: 12px;
+    color: var(--c-text-2);
+    border: 1px solid var(--c-border);
+    padding: 2px 6px;
+    border-radius: 999px;
+    white-space: nowrap;
+  }
+
+  .commit-subject {
+    font-size: 16px;
+    font-weight: 600;
+    line-height: 1.3;
+    hyphens: auto;
+  }
+
+  .commit-body {
+    margin-top: 16px;
+    white-space: pre-wrap;
+    line-height: 1.5;
+    hyphens: auto;
+  }
+
+  .commit-subinfo {
+    display: flex;
+    flex-direction: row;
+    gap: 16px;
+    justify-content: space-between;
+  }
+
+  .commit-layout {
+    display: grid;
+    grid-template-columns: 1fr;
+    gap: 16px;
+  }
+
+  @media (min-width: 960px) {
+    .commit-layout {
+      grid-template-columns: 300px 1fr;
+      align-items: start;
+    }
+
+    .files-tree {
+      position: sticky;
+      top: 16px;
+    }
+
+    .files-tree-content {
+      max-height: calc(100vh - var(--header-height) - 40px);
+      overflow: auto;
+    }
+  }
+
+  .files-tree {
+    border: 1px solid var(--c-border);
+    border-radius: var(--border-radius);
+  }
+
+  .files-tree-header {
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    padding-inline: 16px;
+    height: var(--header-height);
+    border-bottom: 1px solid var(--c-border);
+    border-top-left-radius: var(--border-radius);
+    border-top-right-radius: var(--border-radius);
+    background: var(--c-bg-alt);
+    font-size: 14px;
+    font-weight: 600;
+  }
+
+  .files-tree-content {
+    display: block;
+    padding-block: 6px;
+  }
+
+  .tree .children {
+    margin-left: 16px;
+    border-left: 1px dashed var(--c-border);
+  }
+
+  .tree .node {
+    display: flex;
+    align-items: center;
+    gap: 8px;
+    padding: 10px 16px;
+  }
+
+  .tree .file-name {
+    flex: 1;
+    font-weight: 500;
+    color: var(--c-text-1);
+    cursor: pointer;
+  }
+
+  .tree .file-name:hover {
+    color: var(--c-brand-2);
+    text-decoration: underline;
+  }
+
+  .tree .dir {
+    color: var(--c-dir);
+  }
+
+  .tree .file-added {
+    color: var(--c-green);
+  }
+
+  .tree .file-deleted {
+    color: var(--c-red);
+  }
+
+  .tree .file-renamed {
+    color: var(--c-yellow);
+  }
+
+  /* Per-file sections */
+
+  .files {
+    min-width: 0;
+  }
+
+  .file-section + .file-section {
+    margin-top: 16px;
+  }
+
+  pre {
+    border: 1px solid var(--c-border);
+    border-top: none;
+    border-bottom-left-radius: var(--border-radius);
+    border-bottom-right-radius: var(--border-radius);
+  }
+
+  pre {
+    margin: 0;
+    padding: 8px 16px;
+    overflow-x: auto;
+    white-space: pre;
+    word-spacing: normal;
+    word-break: normal;
+    word-wrap: normal;
+    tab-size: 4;
+    font-family: var(--font-family-mono), monospace;
+  }
+
+  pre > code {
+    display: block;
+    padding: 0 16px;
+    width: fit-content;
+    min-width: 100%;
+    line-height: var(--code-line-height);
+    font-size: var(--code-font-size);
+  }
+
+  .binary-file {
+    padding: 8px 16px;
+    font-style: italic;
+  }
+
+  .border {
+    border: 1px solid var(--c-border);
+    border-top: none;
+    border-bottom-left-radius: 6px;
+    border-bottom-right-radius: 6px;
+  }
+</style>
 {{ end }}
 
 {{ define "body" }}
internal/templates/layout.gohtml
@@ -2,59 +2,50 @@
 <!DOCTYPE html>
 <html lang="en">
 <head>
-    <meta charset="UTF-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <title>{{ .Title }}</title>
-    <link rel="stylesheet" href="{{ .RootHref }}css/layout.css">
-    {{- if .NeedsMarkdownCSS }}<link rel="stylesheet" href="{{ .RootHref }}css/markdown.css">{{ end }}
-    {{- if .NeedsSyntaxCSS }}<link rel="stylesheet" href="{{ .RootHref }}css/syntax.css">{{ end }}
-    {{ template "head" . }}
+  <meta charset="UTF-8">
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+  <title>{{ .Title }}</title>
+  <link rel="stylesheet" href="{{ .RootHref }}css/layout.css">
+{{- if .NeedsMarkdownCSS }}<link rel="stylesheet" href="{{ .RootHref }}css/markdown.css">{{ end }}
+{{- if .NeedsSyntaxCSS }}<link rel="stylesheet" href="{{ .RootHref }}css/syntax.css">{{ end }}
+{{ template "head" . }}
 </head>
 <body>
 {{ template "svg" . }}
 <div class="menu">
-    <div class="menu-content">
-        <a href="{{ .RootHref }}index.html" class="project-name">{{ .Name }}</a>
-        <div class="menu-item {{ if eq .Selected "code" }}selected{{ end }}">
-            <a href="{{ .RootHref }}blob/{{ .CurrentRefDir }}/index.html">
-                <svg aria-hidden="true" width="16" height="16">
-                    <use xlink:href="#code"></use>
-                </svg>
-                Code
-            </a>
-        </div>
-        <div class="menu-item {{ if eq .Selected "branches" }}selected{{ end }}">
-            <a href="{{ .RootHref }}branches.html">
-                <svg aria-hidden="true" focusable="false" width="16" height="16">
-                    <use xlink:href="#branch"></use>
-                </svg>
-                Branches
-            </a>
-        </div>
-        <div class="menu-item {{ if eq .Selected "tags" }}selected{{ end }}">
-            <a href="{{ .RootHref }}tags.html">
-                <svg aria-hidden="true" focusable="false" width="16" height="16">
-                    <use xlink:href="#tag"></use>
-                </svg>
-                Tags
-            </a>
-        </div>
-        <div class="menu-item {{ if eq .Selected "commits" }}selected{{ end }}">
-            <a href="{{ .RootHref }}commits/{{ .CurrentRefDir }}/index.html">
-                <svg aria-hidden="true" focusable="false" width="16" height="16">
-                    <use xlink:href="#commit"></use>
-                </svg>
-                Commits
-            </a>
-        </div>
+  <div class="menu-content">
+    <a href="{{ .RootHref }}index.html" class="project-name">{{ .Name }}</a>
+    <div class="menu-item {{ if eq .Selected "code" }}selected{{ end }}">
+      <a href="{{ .RootHref }}blob/{{ .CurrentRefDir }}/index.html">
+        <svg aria-hidden="true" width="16" height="16"><use xlink:href="#code"></use></svg>
+        Code
+      </a>
     </div>
+    <div class="menu-item {{ if eq .Selected "branches" }}selected{{ end }}">
+        <a href="{{ .RootHref }}branches.html">
+          <svg aria-hidden="true" focusable="false" width="16" height="16"><use xlink:href="#branch"></use></svg>
+          Branches
+        </a>
+    </div>
+    <div class="menu-item {{ if eq .Selected "tags" }}selected{{ end }}">
+        <a href="{{ .RootHref }}tags.html">
+          <svg aria-hidden="true" focusable="false" width="16" height="16"><use xlink:href="#tag"></use></svg>
+          Tags
+        </a>
+    </div>
+    <div class="menu-item {{ if eq .Selected "commits" }}selected{{ end }}">
+        <a href="{{ .RootHref }}commits/{{ .CurrentRefDir }}/index.html">
+          <svg aria-hidden="true" focusable="false" width="16" height="16"><use xlink:href="#commit"></use></svg>
+          Commits
+        </a>
+    </div>
+  </div>
 </div>
 <main>
-    <div class="main-content">
-        {{ template "body" . }}
-    </div>
+  <div class="main-content">
+    {{ template "body" . }}
+  </div>
 </main>
-<footer>
-</footer>
+<footer></footer>
 </body>
 </html>
internal/templates/list.gohtml
@@ -82,8 +82,6 @@
           padding: 16px;
         }
       }
-
-      {{.CSSMarkdown}}
       {{ end }}
     </style>
 {{ end }}