Support passing either width or height
Anirudh Oppiliappan x@icyphox.sh
Tue, 21 Jun 2022 21:59:04 +0530
1 files changed,
6 insertions(+),
1 deletions(-)
jump to
M
html.go
→
html.go
@@ -614,9 +614,14 @@ if node.LinkData.Title != nil {
r.out(w, []byte(`" title="`)) escapeHTML(w, node.LinkData.Title) } - if node.LinkData.Width != 0 { + switch { + case node.LinkData.Width != 0 && node.LinkData.Height != 0: r.out(w, []byte(fmt.Sprintf(`" width="%d" height="%d`, node.LinkData.Width, node.LinkData.Height))) + case node.LinkData.Width != 0: + r.out(w, []byte(fmt.Sprintf(`" width="%d`, node.LinkData.Width))) + case node.LinkData.Height != 0: + r.out(w, []byte(fmt.Sprintf(`" height="%d`, node.LinkData.Height))) } r.out(w, []byte(`" />`)) }