diff options
author | Feuerfuchs <git@feuerfuchs.dev> | 2020-05-18 18:02:20 +0200 |
---|---|---|
committer | Feuerfuchs <git@feuerfuchs.dev> | 2020-05-18 18:02:20 +0200 |
commit | e58fabd89f9708aaeb10e52f731759712034833f (patch) | |
tree | b845d41df1e91f01e4d66fb0a40fa9dc76c24dcd /internal/port/tpl/gemini.html | |
parent | WIP: Refactoring (diff) | |
download | gopherproxy-e58fabd89f9708aaeb10e52f731759712034833f.tar.gz gopherproxy-e58fabd89f9708aaeb10e52f731759712034833f.tar.bz2 gopherproxy-e58fabd89f9708aaeb10e52f731759712034833f.zip |
WIP: Refactoring
Diffstat (limited to 'internal/port/tpl/gemini.html')
-rw-r--r-- | internal/port/tpl/gemini.html | 62 |
1 files changed, 42 insertions, 20 deletions
diff --git a/internal/port/tpl/gemini.html b/internal/port/tpl/gemini.html index 08f1b8e..df50d50 100644 --- a/internal/port/tpl/gemini.html +++ b/internal/port/tpl/gemini.html | |||
@@ -7,28 +7,50 @@ | |||
7 | <link rel="stylesheet" href="{{ .Assets.Style }}" /> | 7 | <link rel="stylesheet" href="{{ .Assets.Style }}" /> |
8 | {{- template "_fonts.html" . -}} | 8 | {{- template "_fonts.html" . -}} |
9 | </head> | 9 | </head> |
10 | <body class="{{ if not .Lines }}is-plain{{ end }}"> | 10 | <body class="{{ if .IsPlain }}is-plain{{ end }}"> |
11 | {{- template "_header.html" . -}} | 11 | <header class="header header-base"> |
12 | <div class="location"> | ||
13 | <a class="location__prefix">gemini://</a><a class="location__prefix location__prefix--mobile">://</a> | ||
14 | {{- range $i, $item := .Nav -}} | ||
15 | {{- if ne $i 0 -}} | ||
16 | <span class="location__slash">/</span> | ||
17 | {{- end -}} | ||
18 | {{- if .Current -}} | ||
19 | <span class="location__uripart">{{ .Label }}</span> | ||
20 | {{- else -}} | ||
21 | <a href="{{ .URL }}/" class="location__uripart">{{ .Label }}</a> | ||
22 | {{- end -}} | ||
23 | {{- end -}} | ||
24 | </div> | ||
25 | <div class="actions"> | ||
26 | <div class="action"><button class="settings-btn">Settings</button></div> | ||
27 | </div> | ||
28 | </header> | ||
12 | 29 | ||
13 | <main class="wrap"> | 30 | <main class="wrap"> |
14 | <pre class="content content--has-monospace-font{{ if .Lines }} content--has-type-annotations{{ end }}"> | 31 | <div class="content{{ if not .IsPlain }} content--has-type-annotations{{ end }}"> |
15 | {{- if .Lines -}} | 32 | {{- range .Sections -}} |
16 | {{- $content := "" -}} | 33 | {{- if eq .Type "RAW_TEXT" -}} |
17 | {{- range .Lines -}} | 34 | <div class="section"><span class="section__type">```</span><pre class="section__content">{{- .Text -}}</pre></div> |
18 | {{- if ne $content "" -}} | 35 | {{- else if eq .Type "REFLOW_TEXT" -}} |
19 | {{- $content = printf "%s\n" $content -}} | 36 | <div class="section"><p class="section__content">{{- .Text -}}</p></div> |
20 | {{- end -}} | 37 | {{- else if eq .Type "LINK" -}} |
21 | {{- if .Link -}} | 38 | <div class="section"><span class="section__type">=></span><a class="section__content" href="{{ .URL }}">{{- .Text -}}</a></div> |
22 | {{- $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)) -}} | 39 | {{- else if eq .Type "HEADING_1" -}} |
23 | {{- else -}} | 40 | <div class="section"><span class="section__type">#</span><h1 class="section__content">{{- .Text -}}</h1></div> |
24 | {{- $content = printf "%s%s" $content (printf "<span class=\"type-annotation\"> </span>%s" (.Text | HTMLEscape)) -}} | 41 | {{- else if eq .Type "HEADING_2" -}} |
25 | {{- end -}} | 42 | <div class="section"><span class="section__type">##</span><h2 class="section__content">{{- .Text -}}</h2></div> |
26 | {{- end -}} | 43 | {{- else if eq .Type "HEADING_3" -}} |
27 | {{- $content | safeHtml -}} | 44 | <div class="section"><span class="section__type">###</span><h3 class="section__content">{{- .Text -}}</h3></div> |
28 | {{- else -}} | 45 | {{- else if eq .Type "LIST" -}} |
29 | {{- .RawText -}} | 46 | <div class="section"><ul class="section__content"> |
30 | {{- end -}} | 47 | {{- range .Items -}} |
31 | </pre> | 48 | <li>{{- . -}}</li> |
49 | {{- end -}} | ||
50 | </ul></div> | ||
51 | {{- end -}} | ||
52 | {{- end -}} | ||
53 | </div> | ||
32 | </main> | 54 | </main> |
33 | 55 | ||
34 | {{- template "_modals.html" . -}} | 56 | {{- template "_modals.html" . -}} |