Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ae364aa
ListItem Render Hook
alexanderhansen Apr 26, 2022
acc3263
Update Tests
alexanderhansen May 2, 2022
4a659ee
Merge branch 'gohugoio:master' into listitem-render-hook
alexanderhansen May 2, 2022
106caac
ListItem Render Hook
alexanderhansen Apr 26, 2022
e751003
Update Tests
alexanderhansen May 2, 2022
b143fa6
Merge branch 'listitem-render-hook' of https://github.com/alexanderha…
alexanderhansen May 2, 2022
5e0eba9
List Render Hook
alexanderhansen May 2, 2022
5130a3d
With ordered parameter
alexanderhansen May 2, 2022
c025e3f
ListItem has no attributes
alexanderhansen May 2, 2022
156e671
Test for attributes
alexanderhansen May 2, 2022
5757d1d
First and Last sibling check for listitems
alexanderhansen May 5, 2022
1c954b9
Borrowed from Goldmark
alexanderhansen May 5, 2022
0de16a5
ListItem Render Hook
alexanderhansen Apr 26, 2022
b04f772
Update Tests
alexanderhansen May 2, 2022
595c696
List Render Hook
alexanderhansen May 2, 2022
9d3616a
With ordered parameter
alexanderhansen May 2, 2022
5e38325
ListItem has no attributes
alexanderhansen May 2, 2022
6ccad18
Test for attributes
alexanderhansen May 2, 2022
433d9cf
First and Last sibling check for listitems
alexanderhansen May 5, 2022
600e5a5
Borrowed from Goldmark
alexanderhansen May 5, 2022
4266674
Merge branch 'listitem-render-hook' of https://github.com/alexanderha…
alexanderhansen May 5, 2022
9199981
docs
alexanderhansen May 5, 2022
db2a4ca
Delete devcontainer.json
alexanderhansen May 5, 2022
3cb278b
Merge branch 'gohugoio:master' into listitem-render-hook
alexanderhansen Aug 3, 2022
c85708b
Merge branch 'gohugoio:master' into listitem-render-hook
alexanderhansen Dec 8, 2022
398be2d
Merge branch 'gohugoio:master' into listitem-render-hook
alexanderhansen Apr 6, 2023
3b2b6b1
Add Context to Renderer
alexanderhansen Apr 6, 2023
967447f
Merge branch 'gohugoio:master' into listitem-render-hook
alexanderhansen Apr 14, 2023
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ListItem has no attributes
  • Loading branch information
alexanderhansen committed May 2, 2022
commit c025e3f5c42457dcddf0af8312264a9b0ce8ec8f
8 changes: 5 additions & 3 deletions hugolib/content_render_hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ Inner Block: {{ .Inner | .Page.RenderString (dict "display" "block" ) }}
b.WithTemplatesAdded("_default/_markup/render-image.html", `IMAGE: {{ .Page.Title }}||{{ .Destination | safeURL }}|Title: {{ .Title | safeHTML }}|Text: {{ .Text | safeHTML }}|END`)
b.WithTemplatesAdded("_default/_markup/render-heading.html", `HEADING: {{ .Page.Title }}||Level: {{ .Level }}|Anchor: {{ .Anchor | safeURL }}|Text: {{ .Text | safeHTML }}|Attributes: {{ .Attributes }}|END`)
b.WithTemplatesAdded("docs/_markup/render-heading.html", `Docs Level: {{ .Level }}|END`)
b.WithTemplatesAdded("_default/_markup/render-list.html", `LIST: {{ .Text | safeHTML }} {{ .Attributes }} {{ .IsOrdered }} `)
b.WithTemplatesAdded("_default/_markup/render-listitem.html", `LISTITEM: {{ .Text | safeHTML }} {{ .Attributes }}`)
b.WithTemplatesAdded("_default/_markup/render-list.html", `LIST: {{ .Text | safeHTML }}|{{ .Attributes }}|{{ .IsOrdered }} `)
b.WithTemplatesAdded("_default/_markup/render-listitem.html", `LISTITEM: {{ .Text | safeHTML }}`)
b.WithContent("customview/p1.md", `---
title: Custom View
---
Expand Down Expand Up @@ -203,7 +203,9 @@ title: With List Items
- Dog
- Cat
- Mouse **Fat**
- Bird{.parrot}
- Bird
{.parrot}
{.animals}
`, "blog/p10.md", `---
title: With Ordered List
---
Expand Down
2 changes: 0 additions & 2 deletions markup/converter/hooks/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ type ListItemContext interface {
Offset() int
FirstChild() interface{}
Parent() interface{}

AttributesProvider
}

type ListItemRenderer interface {
Expand Down
14 changes: 6 additions & 8 deletions markup/goldmark/render_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ type listItemContext struct {
offset int
firstChild interface{}
parent interface{}
*attributes.AttributesHolder
}

func (ctx listItemContext) Page() interface{} {
Expand Down Expand Up @@ -506,13 +505,12 @@ func (r *hookedRenderer) renderListItem(w util.BufWriter, source []byte, node as
err := hli.RenderListItem(
w,
listItemContext{
page: ctx.DocumentContext().Document,
text: hstring.RenderedString(text),
plainText: string(n.Text(source)),
offset: int(n.Offset),
firstChild: n.FirstChild(),
parent: n.Parent(),
AttributesHolder: attributes.New(n.Attributes(), attributes.AttributesOwnerGeneral),
page: ctx.DocumentContext().Document,
text: hstring.RenderedString(text),
plainText: string(n.Text(source)),
offset: int(n.Offset),
firstChild: n.FirstChild(),
parent: n.Parent(),
},
)

Expand Down