detached 4f492b9

Remove types from each string entry for a type map string interface

commit
4f492b99b316edf86c516ff39d1cee9551e1f286
author
bnema · · 2023-09-03 05:11 UTC
committer
bnema · · 2023-09-04 06:59 UTC
parent
2f72eed
signature
unsigned
2 files · +4 -25
M internal/ui/templates/components.gohtml +2 -2
@@ -4,7 +4,7 @@
44 <h1
55 class="text-5xl fw100 animate-bounce-alt animate-count-infinite animate-duration-1s"
66 >
7- {{ .Body.Header.HelloWorld }}
7+ {{ .body.header.helloworld }}
88 </h1>
99 </div>
1010
@@ -12,6 +12,6 @@
1212 <h1
1313 class="text-5xl fw100 animate-bounce-alt animate-count-infinite animate-duration-1s"
1414 >
15- {{ .Body.Div.Hello }}
15+ {{ .body.div.hello }}
1616 </h1>
1717 </div>
@@ -4,7 +4,7 @@
4 <h14 <h1
5 class="text-5xl fw100 animate-bounce-alt animate-count-infinite animate-duration-1s"5 class="text-5xl fw100 animate-bounce-alt animate-count-infinite animate-duration-1s"
6 >6 >
7- {{ .Body.Header.HelloWorld }}7+ {{ .body.header.helloworld }}
8 </h1>8 </h1>
9 </div>9 </div>
10 10
@@ -12,6 +12,6 @@
12 <h112 <h1
13 class="text-5xl fw100 animate-bounce-alt animate-count-infinite animate-duration-1s"13 class="text-5xl fw100 animate-bounce-alt animate-count-infinite animate-duration-1s"
14 >14 >
15- {{ .Body.Div.Hello }}15+ {{ .body.div.hello }}
16 </h1>16 </h1>
17 </div>17 </div>
M pkg/utils/parser.go +2 -23
@@ -9,29 +9,7 @@ import (
99 )
1010
1111 // Yaml Parser
12-type Meta struct {
13- Title string `yaml:"title"`
14- Description string `yaml:"description"`
15- Keywords string `yaml:"keywords"`
16-}
17-
18-type Header struct {
19- Meta Meta `yaml:"meta"`
20- HelloWorld string `yaml:"helloworld"`
21-}
22-
23-type Body struct {
24- Header Header `yaml:"header"`
25- Div struct {
26- Hello string `yaml:"hello"`
27- } `yaml:"div"`
28-}
29-
30-type LangData struct {
31- Header Header `yaml:"header"`
32- Body Body `yaml:"body"`
33-}
34-
12+type LangData map[string]interface{}
3513 type YamlData struct {
3614 EN LangData `yaml:"en"`
3715 FR LangData `yaml:"fr"`
@@ -59,6 +37,7 @@ func ReadDataFromYAML() (YamlData, error) {
5937 if err := yaml.Unmarshal(content, &data); err != nil {
6038 return data, fmt.Errorf("failed to unmarshal strings.yaml: %w", err)
6139 }
40+ fmt.Println(data)
6241
6342 return data, nil
6443 }
@@ -9,29 +9,7 @@ import (
9 )9 )
10 10
11 // Yaml Parser11 // Yaml Parser
12-type Meta struct {12+type LangData map[string]interface{}
13- Title string `yaml:"title"`
14- Description string `yaml:"description"`
15- Keywords string `yaml:"keywords"`
16-}
17-
18-type Header struct {
19- Meta Meta `yaml:"meta"`
20- HelloWorld string `yaml:"helloworld"`
21-}
22-
23-type Body struct {
24- Header Header `yaml:"header"`
25- Div struct {
26- Hello string `yaml:"hello"`
27- } `yaml:"div"`
28-}
29-
30-type LangData struct {
31- Header Header `yaml:"header"`
32- Body Body `yaml:"body"`
33-}
34-
35 type YamlData struct {13 type YamlData struct {
36 EN LangData `yaml:"en"`14 EN LangData `yaml:"en"`
37 FR LangData `yaml:"fr"`15 FR LangData `yaml:"fr"`
@@ -59,6 +37,7 @@ func ReadDataFromYAML() (YamlData, error) {
59 if err := yaml.Unmarshal(content, &data); err != nil {37 if err := yaml.Unmarshal(content, &data); err != nil {
60 return data, fmt.Errorf("failed to unmarshal strings.yaml: %w", err)38 return data, fmt.Errorf("failed to unmarshal strings.yaml: %w", err)
61 }39 }
40+ fmt.Println(data)
62 41
63 return data, nil42 return data, nil
64 }43 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 106

↑↓ moveenter openesc close