Rework storage structs, link preview
This commit is contained in:
@ -4,11 +4,18 @@ struct SimpleImage: HtmlProducer {
|
||||
|
||||
let imagePath: String
|
||||
|
||||
let altText: String
|
||||
let altText: String?
|
||||
|
||||
private var imageAltText: String {
|
||||
guard let altText else {
|
||||
return ""
|
||||
}
|
||||
return " alt='\(altText.htmlEscaped())'"
|
||||
}
|
||||
|
||||
func populate(_ result: inout String) {
|
||||
result += "<div class='content-image svg-image'>"
|
||||
result += "<img src='\(imagePath)' loading='lazy' alt='\(altText)'/>"
|
||||
result += "<img src='\(imagePath)' loading='lazy'\(imageAltText)/>"
|
||||
result += "</div>"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user