From fc5fd2edd9b8282497e33a18300eab694d8a89c6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Jun 2024 13:02:08 +0200 Subject: refactor: switch to templ for HTML templates --- frontend/templates/blocks/error.gotmpl | 6 --- frontend/templates/blocks/option.gotmpl | 48 --------------------- frontend/templates/blocks/options.gotmpl | 25 ----------- frontend/templates/blocks/package.gotmpl | 69 ------------------------------- frontend/templates/blocks/packages.gotmpl | 30 -------------- frontend/templates/blocks/results.gotmpl | 21 ---------- frontend/templates/blocks/search.gotmpl | 37 ----------------- frontend/templates/index.gotmpl | 55 ------------------------ 8 files changed, 291 deletions(-) delete mode 100644 frontend/templates/blocks/error.gotmpl delete mode 100644 frontend/templates/blocks/option.gotmpl delete mode 100644 frontend/templates/blocks/options.gotmpl delete mode 100644 frontend/templates/blocks/package.gotmpl delete mode 100644 frontend/templates/blocks/packages.gotmpl delete mode 100644 frontend/templates/blocks/results.gotmpl delete mode 100644 frontend/templates/blocks/search.gotmpl delete mode 100644 frontend/templates/index.gotmpl (limited to 'frontend/templates') diff --git a/frontend/templates/blocks/error.gotmpl b/frontend/templates/blocks/error.gotmpl deleted file mode 100644 index 1352b2e..0000000 --- a/frontend/templates/blocks/error.gotmpl +++ /dev/null @@ -1,6 +0,0 @@ -{{- define "main" }} -

- {{ .Code }} - {{ .Message }} -

-{{- end }} diff --git a/frontend/templates/blocks/option.gotmpl b/frontend/templates/blocks/option.gotmpl deleted file mode 100644 index 2248708..0000000 --- a/frontend/templates/blocks/option.gotmpl +++ /dev/null @@ -1,48 +0,0 @@ -{{- define "main" }} - {{- with .Document }} -

{{ .Name }}

- {{ markdown .Description }} -
- {{- with .Type }} -
Type
-
{{ . }}
- {{- end }} - {{- with .Default }} - {{- if or .Text .Markdown }} -
Default
-
- {{- if .Markdown }} - {{ markdown .Markdown }} - {{- else }} -
{{ .Text }}
- {{- end }} -
- {{- end }} - {{- end }} - {{- with .Example }} - {{- if or .Text .Markdown }} -
Example
-
- {{- if .Markdown }} - {{ markdown .Markdown }} - {{- else }} -
{{ .Text }}
- {{- end }} -
- {{- end }} - {{- end }} - {{- with .RelatedPackages }} -
Related Packages
-
{{ . }}
- {{- end }} - {{- with .Declarations }} -
Declared
- {{- range . }} -
- {{ .Name }} -
- {{- end }} - {{- end }} -
- {{- end }} -{{- end }} diff --git a/frontend/templates/blocks/options.gotmpl b/frontend/templates/blocks/options.gotmpl deleted file mode 100644 index 5a08bae..0000000 --- a/frontend/templates/blocks/options.gotmpl +++ /dev/null @@ -1,25 +0,0 @@ -{{- define "hits" }} - - - - - - - - - {{- range . }} - {{- with .Data }} - - - - - {{- end }} - {{- end }} - -
TitleDescription
- {{ .Name }} - - {{ markdown (firstSentence .Description) }} - -
-{{- end }} diff --git a/frontend/templates/blocks/package.gotmpl b/frontend/templates/blocks/package.gotmpl deleted file mode 100644 index a42a8b1..0000000 --- a/frontend/templates/blocks/package.gotmpl +++ /dev/null @@ -1,69 +0,0 @@ -{{- define "main" }} - {{- with .Document }} -

- {{- if .Broken }} - {{ .Attribute }} - {{- else }} - {{ .Attribute }} - {{- end }} -

- {{- if .LongDescription }} - {{ markdown .LongDescription }} - {{- else }} -

{{ .Description }}

- {{- end }} -
- {{- with .MainProgram }} -
Main Program
-
- {{ . }} -
- {{- end }} - {{- with .Homepages }} -
Homepage
-
- {{- range . }} - {{ . }} - {{- end }} -
- {{- end }} - {{- with .Version }} -
Version
-
{{ . }}
- {{- end }} - {{- with .Licenses }} -
License
-
- {{- range . }} - {{- if .URL }} - {{ or .FullName .Name }} - {{- else }} - {{ or .FullName .Name }} - {{- end }} - {{- with .AppendixURL }} - Appendix - {{- end }} - {{- end }} -
- {{- end }} - {{- with .Maintainers }} -
Maintainer{{ if gt (len .) 1 }}s{{ end }}
-
- {{- range . }} - {{- if .Github }} - {{ .Name }} - {{- else }} - {{ .Name }} - {{- end }} - {{- end }} -
- {{- end }} - {{- with .Definition }} -
Defined
-
- Source -
- {{- end }} -
- {{- end }} -{{- end }} diff --git a/frontend/templates/blocks/packages.gotmpl b/frontend/templates/blocks/packages.gotmpl deleted file mode 100644 index cce97a0..0000000 --- a/frontend/templates/blocks/packages.gotmpl +++ /dev/null @@ -1,30 +0,0 @@ -{{- define "hits" }} - - - - - - - - - - {{- range . }} - {{- with .Data }} - - - - - - {{- end }} - {{- end }} - -
AttributeNameDescription
- {{- with .Attribute }} - {{ . }} - {{- end }} - - {{ .Name }} - - {{ .Description }} -
-{{- end }} diff --git a/frontend/templates/blocks/results.gotmpl b/frontend/templates/blocks/results.gotmpl deleted file mode 100644 index ef6e1f1..0000000 --- a/frontend/templates/blocks/results.gotmpl +++ /dev/null @@ -1,21 +0,0 @@ -{{- define "results" }} - {{- with .Results }} - {{- if gt .Total 0 }} - {{ block "hits" .Hits }} - {{ end }} - - {{- else }} - Nothing found - {{- end }} - {{- end }} -{{- end }} diff --git a/frontend/templates/blocks/search.gotmpl b/frontend/templates/blocks/search.gotmpl deleted file mode 100644 index 93ae545..0000000 --- a/frontend/templates/blocks/search.gotmpl +++ /dev/null @@ -1,37 +0,0 @@ -{{- define "main" }} - -
- {{- if .Results }} - {{ block "results" . }}{{ end }} - {{- end }} -
- - - -{{- end }} - -{{- define "head" }} - {{- with (index .Assets.Scripts "static/search.js") }} - - {{- end }} -{{- end }} diff --git a/frontend/templates/index.gotmpl b/frontend/templates/index.gotmpl deleted file mode 100644 index 7732dc8..0000000 --- a/frontend/templates/index.gotmpl +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - Searchix - {{- range .Assets.Stylesheets }} - - {{- end }} - {{ block "head" . }} - {{ end }} - {{ .ExtraHeadHTML }} - {{- range $key, $value := .Sources }} - - {{- end }} - - -
- -
-
- {{ block "main" . }} -

- Search Nix Packages and options from NixOS, Darwin and Home-Manager -

- Source code - {{ end }} -
- - - -- cgit 1.4.1