-
-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Describe the bug
I've been having some trouble attempting to add widgets to embedded content pages. It appears that the behavior when setting htmlcore.Context ElementHandlers func is inconsistent.
How to reproduce
As a test, I've created the following three files which are embedded with the other content
content/ab.md
+++
URL = "/ab"
Title = "ab"
Categories = ["diode"]
+++
<ab>
template text
content/ab1.md
+++
URL = "/ab1"
Title = "ab1"
Categories = ["diode"]
+++
<ab1>
template text
content/1ab.md
+++
URL = "/1ab"
Title = "1ab"
Categories = ["diode"]
+++
<1ab>
template text
I set the element handlers in order to add a button to each one in an identical way
log.Println("setting ab element handler")
ctx.ElementHandlers["ab"] = func(ctx *htmlcore.Context) bool {
f := core.NewFrame(ctx.BlockParent)
tree.AddChild(f, func(w *core.Button) {
w.SetText("test1234")
})
return true
}
log.Println("setting 1ab element handler")
ctx.ElementHandlers["1ab"] = func(ctx *htmlcore.Context) bool {
f := core.NewFrame(ctx.BlockParent)
tree.AddChild(f, func(w *core.Button) {
w.SetText("test1234")
})
return true
}
log.Println("setting ab1 element handler")
ctx.ElementHandlers["ab1"] = func(ctx *htmlcore.Context) bool {
f := core.NewFrame(ctx.BlockParent)
tree.AddChild(f, func(w *core.Button) {
w.SetText("test1234")
})
return true
}
Then I do core build web
or go run .
the application ; the result is the same either way:



-
It seems as though I'm unable to add the a widget as expected via setting ctx.ElementHandlers for that content page when the markdown content filename starts with a number.(?!)
-
I also note that unwanted spaces are added between numbers and letters for content pages as shown in the category menu in the images above
-
I also note that the content pages listed in the categories menu on the left are prepended with
Content/
in an undesired way.
Example code
Relevant output
Platform
Linux
Metadata
Metadata
Assignees
Labels
Type
Projects
Status