diff --git a/dict/main.go b/dict/main.go index d63fb4c..2261a1c 100644 --- a/dict/main.go +++ b/dict/main.go @@ -136,12 +136,7 @@ type Entry struct { type Definition struct { Definition string - PartOfSpeech []PartOfSpeech -} - -type PartOfSpeech struct { - Description string - Type string + PartOfSpeech []string } func ParseEntry(entry *jmdict.JmdictEntry, furiganaInfo *string) Entry { @@ -164,31 +159,9 @@ func ParseEntry(entry *jmdict.JmdictEntry, furiganaInfo *string) Entry { definition += "; " + glossary.Content } } - pos := make([]PartOfSpeech, len(sense.PartsOfSpeech)) - for i, posFull := range sense.PartsOfSpeech { - class := "" - if strings.Contains(posFull, "noun") { - class = "noun" - } else if strings.Contains(posFull, "adjective") { - class = "adjective" - } else if strings.Contains(posFull, "adverb") { - class = "adverb" - } else if strings.Contains(posFull, "verb") { - class = "verb" - } else if strings.Contains(posFull, "particle") { - class = "particle" - } else if strings.Contains(posFull, "phrase") { - class = "phrase" - } - pos[i] = PartOfSpeech{ - Description: posFull, - Type: class, - } - } - definitions[i] = Definition{ Definition: definition, - PartOfSpeech: pos, + PartOfSpeech: sense.PartsOfSpeech, } } // 1:ねが;3:いた @@ -431,20 +404,6 @@ func main() { }, []string{http.MethodGet}, )) - r.NotFoundHandler = http.HandlerFunc(httputils.GenerateHandler( - func(w http.ResponseWriter, r *http.Request) bool { return true }, - httputils.NewTemplateSet("index.html", "404.html"), - func(w http.ResponseWriter, r *http.Request) (template string, data any) { - w.WriteHeader(http.StatusNotFound) - return "404.html", nil - }, - []string{http.MethodGet}, - )) - r.Path("/logo.svg").Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - http.ServeFile(w, r, "static/logo.svg") - })) - r.Path("/overrides.css").Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - http.ServeFile(w, r, "static/overrides.css") - })) + r.PathPrefix("/").Handler(http.FileServer(http.Dir("static"))) log.Fatal(http.ListenAndServe(":3334", r)) } diff --git a/dict/static/overrides.css b/dict/static/overrides.css deleted file mode 100644 index 7c09cc5..0000000 --- a/dict/static/overrides.css +++ /dev/null @@ -1,55 +0,0 @@ -:root { - --bg: #282828 !important; - --fg: #ebdbb2 !important; - - --box-bg: #3c3836 !important; /* bg1 */ - --graphical-fg: #928374 !important; /* gray */ - - --info-graphical-fg: red !important; -} - -chip { - white-space: nowrap; -} - -.noun { - --box-bg: #79740e; - --accent: #b8bb26; - --graphical-fg: #98971a; -} - -.adjective { - --box-bg: #9d0006; - --accent: #fb4934; - --graphical-fg: #cc241d; -} - -.verb, .adverb { - --box-bg: #076678; - --accent: #83a598; - --graphical-fg: #458588; -} - -.particle { - --box-bg: #b57614; - --accent: #fabd2f; - --graphical-fg: #d79921; -} - -.phrase { - --box-bg: #8f3f71; - --accent: #d3869b; - --graphical-fg: #b16286; -} - -li { - margin-top: 0.75em; -} - -#results .box h3 a { - color: inherit; -} - -#results .box h3 a:not(:hover) { - text-decoration: none; -} \ No newline at end of file diff --git a/dict/templates/404.html b/dict/templates/404.html deleted file mode 100644 index bc894b1..0000000 --- a/dict/templates/404.html +++ /dev/null @@ -1,7 +0,0 @@ -{{- define "title" }}404 Not Found - {{ template "sitetitle" . }}{{- end -}} - -{{- define "results" -}} -{{- template "404" . }} -{{- end -}} - -{{- template "index" . -}} \ No newline at end of file diff --git a/dict/templates/index.html b/dict/templates/index.html index 87670a2..e16e3da 100644 --- a/dict/templates/index.html +++ b/dict/templates/index.html @@ -6,7 +6,17 @@
Looks like this page doesn't exist?
-