aboutsummaryrefslogtreecommitdiffstats
path: root/internal/port/tpl/gopher.html
blob: c971847014b51b7d3ab9b58087fa79f5cc68519a (plain) (blame)
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
<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<title>{{ .Title }} - Gopher proxy</title>
		<link rel="stylesheet" href="{{ .Assets.Style }}" />
		{{- template "_fonts.html" . -}}
	</head>
	<body class="{{ if .IsPlain }}is-plain{{ end }}">
		<header class="header header-base">
      <div class="location">
        <a class="location__prefix">gopher://</a><a class="location__prefix location__prefix--mobile">://</a>
        {{- range $i, $item := .Nav -}}
          {{- if ne $i 0 -}}
            <span class="location__slash">/</span>
          {{- end -}}
          {{- if .Current -}}
            <span class="location__uripart">{{ .Label }}</span>
          {{- else -}}
            <a href="{{ .URL }}/" class="location__uripart">{{ .Label }}</a>
          {{- end -}}
        {{- end -}}
      </div>
      <div class="actions">
        {{- if .IsPlain -}}
          <div class="action"><a href="/gopher/{{ .URL | replace "^([^/]*)/0" "$1/9" }}">View raw</a></div>
        {{- end -}}
        <div class="action"><button class="settings-btn">Settings</button></div>
      </div>
    </header>

		<main class="wrap">
			<pre class="content content--has-monospace-font{{ if not .IsPlain }} content--has-type-annotations{{ end }}">
        {{- $content := "" -}}
        {{- $page := . -}}
        {{- range .Lines -}}
          {{- if ne $content "" -}}
            {{- $content = printf "%s\n" $content -}}
          {{- end -}}
          {{- if $page.IsPlain -}}
            {{- $content = printf "%s%s" $content (.Text | HTMLEscape) -}}
          {{- else -}}
            {{- if .Link -}}
              {{- $content = printf "%s%s" $content (printf "<span class=\"type-annotation\">%s  </span><a class=\"link link--%s\" href=\"%s\">%s</a>" .Type .Type .Link (.Text | HTMLEscape)) -}}
            {{- else -}}
              {{- $content = printf "%s%s" $content (printf "<span class=\"type-annotation\">     </span>%s" (.Text | HTMLEscape)) -}}
            {{- end -}}
          {{- end -}}
        {{- end -}}
        {{- $content | safeHtml -}}
			</pre>
		</main>

		{{- template "_modals.html" . -}}

		<script src="{{ .Assets.JS }}"></script>
	</body>
</html>