Simplify images, tag overview

This commit is contained in:
Christoph Hagen
2025-01-04 08:44:26 +01:00
parent 4d4275e072
commit 22e7d9a05a
49 changed files with 603 additions and 509 deletions

View File

@ -1,39 +1,32 @@
struct RelatedPageLink {
/**
An element showing a box with info about a related page.
struct Image {
let url: String
let description: String
let size: Int
}
Contains an optional thumbnail image, a title and a description.
*/
struct RelatedPageLink: HtmlProducer {
/// The title of the linked page
let title: String
/// A short description of the linked page
let description: String
/// The url to the linked page
let url: String
let image: Image?
/// The optional thumbnail image to display
let image: ImageSet?
var content: String {
var result = ""
func populate(_ result: inout String) {
result += "<a href='\(url)' class='related-box-wrapper'>"
result += "<div class='related-box'>"
if let image {
result += WebsiteImage(
rawImagePath: image.url,
width: image.size,
height: image.size,
altText: image.description)
.content
result += image.content
}
result += "<div class='related-content'>"
result += "<h3>\(title)</h3>"
result += "<p>\(description)</p>"
result += "</div></div></a>" // Close related-box-wrapper, related-box
return result
}
}