mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
tpl/diagrams: Rename the SVG accessor to Wrapped
Not perfect, but it gets it in line with the other .Inner/.Wrapped combos.
This commit is contained in:
parent
3ad39001df
commit
fd0c1a5e9b
2 changed files with 5 additions and 5 deletions
|
@ -41,7 +41,7 @@ func TestCodeblocks(t *testing.T) {
|
||||||
tabWidth = 4
|
tabWidth = 4
|
||||||
-- layouts/_default/_markup/render-codeblock-goat.html --
|
-- layouts/_default/_markup/render-codeblock-goat.html --
|
||||||
{{ $diagram := diagrams.Goat .Inner }}
|
{{ $diagram := diagrams.Goat .Inner }}
|
||||||
Goat SVG:{{ substr $diagram.SVG 0 100 | safeHTML }} }}|
|
Goat SVG:{{ substr $diagram.Wrapped 0 100 | safeHTML }} }}|
|
||||||
Goat Attribute: {{ .Attributes.width}}|
|
Goat Attribute: {{ .Attributes.width}}|
|
||||||
-- layouts/_default/_markup/render-codeblock-go.html --
|
-- layouts/_default/_markup/render-codeblock-go.html --
|
||||||
Go Code: {{ .Inner | safeHTML }}|
|
Go Code: {{ .Inner | safeHTML }}|
|
||||||
|
|
|
@ -25,13 +25,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type SVGDiagram interface {
|
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.
|
// Inner returns the inner markup of the SVG.
|
||||||
// This allows for the <svg> container to be created manually.
|
// This allows for the <svg> container to be created manually.
|
||||||
Inner() template.HTML
|
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 returns the width of the SVG.
|
||||||
Width() int
|
Width() int
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ func (d goatDiagram) Inner() template.HTML {
|
||||||
return template.HTML(d.d.Body)
|
return template.HTML(d.d.Body)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d goatDiagram) SVG() template.HTML {
|
func (d goatDiagram) Wrapped() template.HTML {
|
||||||
return template.HTML(d.d.String())
|
return template.HTML(d.d.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue