mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
tpl/diagrams: Rename Body to Inner
This relates to #9577 – there's no concept a body element in SVG, so we might as well use an exsisting "Hugo term".
This commit is contained in:
@@ -25,9 +25,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SVGDiagram interface {
|
type SVGDiagram interface {
|
||||||
Body() 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
|
SVG() template.HTML
|
||||||
|
|
||||||
|
// Width returns the width of the SVG.
|
||||||
Width() int
|
Width() int
|
||||||
|
|
||||||
|
// Height returns the height of the SVG.
|
||||||
Height() int
|
Height() int
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +43,7 @@ type goatDiagram struct {
|
|||||||
d goat.SVG
|
d goat.SVG
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d goatDiagram) Body() template.HTML {
|
func (d goatDiagram) Inner() template.HTML {
|
||||||
return template.HTML(d.d.Body)
|
return template.HTML(d.d.Body)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
{{ else }}
|
{{ else }}
|
||||||
viewBox="0 0 {{ .Width }} {{ .Height }}"
|
viewBox="0 0 {{ .Width }} {{ .Height }}"
|
||||||
{{ end }}>
|
{{ end }}>
|
||||||
{{ .Body }}
|
{{ .Inner }}
|
||||||
</svg>
|
</svg>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user