CHGenerator/WebsiteGenerator/Generators/HTMLElementsGenerator.swift

38 lines
954 B
Swift
Raw Normal View History

import Foundation
struct HTMLElementsGenerator {
init() {
}
func make(title: String, suffix: String) -> String {
"\(title)<span class=\"suffix\">\(suffix)</span>"
}
2022-08-28 14:01:53 +02:00
// - TODO: Make link relative
func topBarWebsiteTitle(language: String) -> String {
"/\(language).html"
}
func topBarLanguageButton(_ language: String) -> String {
"<a href=\"\(language).html\">\(language)</a>"
}
func topBarNavigationLink(url: String, text: String, isActive: Bool) -> String {
"<a\(isActive ? " class=\"active\"" : "") href=\"/\(url)\">\(text)</a>"
}
func linkPreviewImage(file: String) -> String {
"<meta property=\"og:image\" content=\"\(file)\" />"
}
func makePrevText(_ text: String) -> String {
"<span class=\"icon-back\"></span>\(text)"
}
func makeNextText(_ text: String) -> String {
"\(text)<span class=\"icon-next\"></span>"
}
}