summaryrefslogtreecommitdiff
path: root/internal/templates/blob.gohtml
blob: a1e54e7d9a41739cf6d013504a8dc02de19a683b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{{- /*gotype: mokhan.ca/xlgmokha/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>
{{- 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}}
{{- end}}