First version

This commit is contained in:
Christoph Hagen
2022-08-16 10:39:05 +02:00
parent 104c5151b4
commit 14b935249f
44 changed files with 2891 additions and 8 deletions

View File

@ -0,0 +1,13 @@
import Foundation
struct BackNavigationTemplate: Template {
enum Key: String, CaseIterable {
case url = "URL"
case text = "TEXT"
}
static let templateName = "back.html"
let raw: String
}

View File

@ -0,0 +1,12 @@
import Foundation
struct OverviewSectionCleanTemplate: Template {
enum Key: String, CaseIterable {
case items = "ITEMS"
}
static let templateName = "overview-section-clean.html"
let raw: String
}

View File

@ -0,0 +1,15 @@
import Foundation
struct OverviewSectionTemplate: Template {
enum Key: String, CaseIterable {
case url = "URL"
case title = "TITLE"
case items = "ITEMS"
case more = "MORE"
}
static let templateName = "overview-section.html"
let raw: String
}

View File

@ -0,0 +1,16 @@
import Foundation
struct PageHeadTemplate: Template {
enum Key: String, CaseIterable {
case author = "AUTHOR"
case title = "TITLE"
case description = "DESCRIPTION"
case image = "IMAGE"
case customPageContent = "CUSTOM"
}
let raw: String
static let templateName = "head.html"
}

View File

@ -0,0 +1,13 @@
import Foundation
struct PlaceholderTemplate: Template {
enum Key: String, CaseIterable {
case title = "TITLE"
case text = "TEXT"
}
static let templateName = "empty.html"
var raw: String
}

View File

@ -0,0 +1,50 @@
import Foundation
protocol ThumbnailTemplate {
func generate(_ content: [ThumbnailKey : String], shouldIndent: Bool) throws -> String
}
enum ThumbnailKey: String, CaseIterable {
case url = "URL"
case image = "IMAGE"
case image2x = "IMAGE_2X"
case title = "TITLE"
case corner = "CORNER"
}
struct LargeThumbnailTemplate: Template, ThumbnailTemplate {
typealias Key = ThumbnailKey
static let templateName = "thumbnail-large.html"
let raw: String
func makeCorner(text: String) -> String {
"<span class=\"corner\"><span>\(text)</span></span>"
}
func makeTitleSuffix(_ suffix: String) -> String {
"<span class=\"suffix\">\(suffix)</span>"
}
}
struct SquareThumbnailTemplate: Template, ThumbnailTemplate {
typealias Key = ThumbnailKey
static let templateName = "thumbnail-square.html"
let raw: String
}
struct SmallThumbnailTemplate: Template, ThumbnailTemplate {
typealias Key = ThumbnailKey
static let templateName = "thumbnail-small.html"
let raw: String
}

View File

@ -0,0 +1,15 @@
import Foundation
struct TopBarTemplate: Template {
enum Key: String, CaseIterable {
case title = "TITLE"
case titleLink = "TITLE_URL"
case elements = "ELEMENTS"
case languageButton = "LANG_BUTTON"
}
static let templateName = "bar.html"
var raw: String
}