Skip to content

Commit

Permalink
tpl/diagrams: Rename the SVG accessor to Wrapped
Browse files Browse the repository at this point in the history
Not perfect, but it gets it in line with the other .Inner/.Wrapped combos.
  • Loading branch information
bep committed Feb 27, 2022
1 parent 3ad3900 commit fd0c1a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion markup/goldmark/codeblocks/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestCodeblocks(t *testing.T) {
tabWidth = 4
-- layouts/_default/_markup/render-codeblock-goat.html --
{{ $diagram := diagrams.Goat .Inner }}
Goat SVG:{{ substr $diagram.SVG 0 100 | safeHTML }} }}|
Goat SVG:{{ substr $diagram.Wrapped 0 100 | safeHTML }} }}|
Goat Attribute: {{ .Attributes.width}}|
-- layouts/_default/_markup/render-codeblock-go.html --
Go Code: {{ .Inner | safeHTML }}|
Expand Down
8 changes: 4 additions & 4 deletions tpl/diagrams/diagrams.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ import (
)

type SVGDiagram interface {
// Wrapped returns the diagram as an SVG, including the <svg> container.
Wrapped() template.HTML

// Inner returns the inner markup of the SVG.
// This allows for the <svg> container to be created manually.
Inner() template.HTML

// SVG returns the diagram as an SVG, including the <svg> container.
SVG() template.HTML

// Width returns the width of the SVG.
Width() int

Expand All @@ -47,7 +47,7 @@ func (d goatDiagram) Inner() template.HTML {
return template.HTML(d.d.Body)
}

func (d goatDiagram) SVG() template.HTML {
func (d goatDiagram) Wrapped() template.HTML {
return template.HTML(d.d.String())
}

Expand Down

0 comments on commit fd0c1a5

Please sign in to comment.