import Foundation
struct HTMLElementsGenerator {
init() {
}
func make(title: String, suffix: String) -> String {
"\(title)\(suffix)"
}
// - TODO: Make link relative
func topBarWebsiteTitle(language: String) -> String {
"/\(language).html"
}
func topBarLanguageButton(_ language: String) -> String {
"\(language)"
}
func topBarNavigationLink(url: String, text: String, isActive: Bool) -> String {
"\(text)"
}
func linkPreviewImage(file: String) -> String {
""
}
func makePrevText(_ text: String) -> String {
"\(text)"
}
func makeNextText(_ text: String) -> String {
"\(text)"
}
func svgImage(file: String) -> String {
"""
"""
}
func svgImage(file: String, x: Int, y: Int, width: Int, height: Int) -> String {
"""
"""
}
func downloadButtons(_ buttons: [(file: String, text: String, downloadName: String?)]) -> String {
let content = buttons.map {
if let download = $0.downloadName {
return button(file: $0.file, text: $0.text, downloadName: download)
} else {
return button(file: $0.file, text: $0.text)
}
}.joined(separator: "\n")
return flexParagraph(content)
}
private func flexParagraph(_ content: String) -> String {
"""
\(content)
""" } private func button(file: String, text: String) -> String { """ \(text) """ } private func button(file: String, text: String, downloadName: String) -> String { """ \(text) """ } func scriptInclude(path: String) -> String { "" } func codeHighlightFooter() -> String { "" } }