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