also removes unused functions such as filetree.
+20
-9
appview/pages/funcmap.go
+20
-9
appview/pages/funcmap.go
···
26
26
"github.com/go-enry/go-enry/v2"
27
27
"github.com/yuin/goldmark"
28
28
emoji "github.com/yuin/goldmark-emoji"
29
-
"tangled.org/core/appview/filetree"
30
29
"tangled.org/core/appview/models"
31
30
"tangled.org/core/appview/oauth"
32
31
"tangled.org/core/appview/pages/markup"
···
335
334
},
336
335
"deref": func(v any) any {
337
336
val := reflect.ValueOf(v)
338
-
if val.Kind() == reflect.Ptr && !val.IsNil() {
337
+
if val.Kind() == reflect.Pointer && !val.IsNil() {
339
338
return val.Elem().Interface()
340
339
}
341
340
return nil
···
349
348
return template.HTML(data)
350
349
},
351
350
"cssContentHash": p.CssContentHash,
352
-
"fileTree": filetree.FileTree,
353
351
"pathEscape": func(s string) string {
354
352
return url.PathEscape(s)
355
353
},
···
367
365
return p.AvatarUrl(handle, "")
368
366
},
369
367
"langColor": enry.GetColor,
370
-
"layoutSide": func() string {
371
-
return "col-span-1 md:col-span-2 lg:col-span-3"
372
-
},
373
-
"layoutCenter": func() string {
374
-
return "col-span-1 md:col-span-8 lg:col-span-6"
375
-
},
368
+
"reverse": func(s any) any {
369
+
if s == nil {
370
+
return nil
371
+
}
372
+
373
+
v := reflect.ValueOf(s)
374
+
375
+
if v.Kind() != reflect.Slice {
376
+
return s
377
+
}
378
+
379
+
length := v.Len()
380
+
reversed := reflect.MakeSlice(v.Type(), length, length)
376
381
382
+
for i := range length {
383
+
reversed.Index(i).Set(v.Index(length - 1 - i))
384
+
}
385
+
386
+
return reversed.Interface()
387
+
},
377
388
"normalizeForHtmlId": func(s string) string {
378
389
normalized := strings.ReplaceAll(s, ":", "_")
379
390
normalized = strings.ReplaceAll(normalized, ".", "_")
History
2 rounds
0 comments
1 commit
expand
collapse
appview/pages: add "reverse" funcmap function
also removes unused functions such as filetree.
3/3 success
expand
collapse
expand 0 comments
pull request successfully merged
1 commit
expand
collapse
appview/pages: add "reverse" funcmap function
also removes unused functions such as filetree.