Add result handler to templates

This commit is contained in:
Christoph Hagen
2022-12-02 10:25:54 +01:00
parent 6e24c27fdc
commit 6a52f62402
15 changed files with 60 additions and 25 deletions

View File

@@ -10,4 +10,6 @@ struct BackNavigationTemplate: Template {
static let templateName = "back.html"
let raw: String
let results: GenerationResultsHandler
}

View File

@@ -10,4 +10,6 @@ struct BoxTemplate: Template {
static let templateName = "box.html"
var raw: String
let results: GenerationResultsHandler
}

View File

@@ -9,4 +9,6 @@ struct OverviewSectionCleanTemplate: Template {
static let templateName = "overview-section-clean.html"
let raw: String
let results: GenerationResultsHandler
}

View File

@@ -12,4 +12,6 @@ struct OverviewSectionTemplate: Template {
static let templateName = "overview-section.html"
let raw: String
let results: GenerationResultsHandler
}

View File

@@ -12,5 +12,7 @@ struct PageHeadTemplate: Template {
let raw: String
let results: GenerationResultsHandler
static let templateName = "head.html"
}

View File

@@ -15,4 +15,6 @@ struct PageImageTemplate: Template {
let raw: String
let results: GenerationResultsHandler
}

View File

@@ -15,6 +15,8 @@ struct PageLinkTemplate: Template {
let raw: String
let results: GenerationResultsHandler
func makePath(components: [String]) -> String {
components.joined(separator: " » ") //  » ")
}

View File

@@ -23,6 +23,8 @@ struct PageVideoTemplate: Template {
let raw: String
let results: GenerationResultsHandler
func generate<T>(sources: [VideoSource], options: T) -> String where T: Sequence, T.Element == VideoOption {
let sourcesCode = sources.map(makeSource).joined(separator: "\n")
let optionCode = options.map { $0.rawValue }.joined(separator: " ")

View File

@@ -20,6 +20,8 @@ struct LargeThumbnailTemplate: Template, ThumbnailTemplate {
let raw: String
let results: GenerationResultsHandler
func makeCorner(text: String) -> String {
"<span class=\"corner\"><span>\(text)</span></span>"
}
@@ -36,6 +38,8 @@ struct SquareThumbnailTemplate: Template, ThumbnailTemplate {
static let templateName = "thumbnail-square.html"
let raw: String
let results: GenerationResultsHandler
}
struct SmallThumbnailTemplate: Template, ThumbnailTemplate {
@@ -45,5 +49,7 @@ struct SmallThumbnailTemplate: Template, ThumbnailTemplate {
static let templateName = "thumbnail-small.html"
let raw: String
let results: GenerationResultsHandler
}

View File

@@ -12,4 +12,6 @@ struct TopBarTemplate: Template {
static let templateName = "bar.html"
var raw: String
let results: GenerationResultsHandler
}