struct WebsiteImage { private let prefix1x: String private let prefix2x: String private let altText: String private let ext: String init(image: FeedEntryData.Image) { self.init(rawImagePath: image.rawImagePath, width: image.width, height: image.height, altText: image.altText) } init(rawImagePath: String, width: Int, height: Int, altText: String) { let (prefix, ext) = rawImagePath.fileNameAndExtension self.prefix1x = "\(prefix)@\(width)x\(height)" self.prefix2x = "\(prefix)@\(width*2)x\(height*2)" self.altText = altText.htmlEscaped() self.ext = ext ?? "jpg" } var content: String { var result = "" result += "" result += "" result += "\(altText)" result += "" return result } }