Add convenience box command
This commit is contained in:
@ -1,13 +1,13 @@
|
||||
import Foundation
|
||||
|
||||
struct PlaceholderTemplate: Template {
|
||||
struct BoxTemplate: Template {
|
||||
|
||||
enum Key: String, CaseIterable {
|
||||
case title = "TITLE"
|
||||
case text = "TEXT"
|
||||
}
|
||||
|
||||
static let templateName = "empty.html"
|
||||
static let templateName = "box.html"
|
||||
|
||||
var raw: String
|
||||
}
|
@ -75,13 +75,7 @@ struct LocalizedSiteTemplate {
|
||||
// MARK: Content
|
||||
|
||||
func makePlaceholder(metadata: Element.LocalizedMetadata) -> String {
|
||||
makePlaceholder(title: metadata.placeholderTitle, text: metadata.placeholderText)
|
||||
}
|
||||
|
||||
func makePlaceholder(title: String, text: String) -> String {
|
||||
factory.placeholder.generate([
|
||||
.title: title,
|
||||
.text: text])
|
||||
factory.makePlaceholder(title: metadata.placeholderTitle, text: metadata.placeholderText)
|
||||
}
|
||||
|
||||
func makeBackLink(text: String, language: String) -> String {
|
||||
|
@ -16,7 +16,7 @@ final class TemplateFactory {
|
||||
|
||||
let overviewSectionClean: OverviewSectionCleanTemplate
|
||||
|
||||
let placeholder: PlaceholderTemplate
|
||||
let box: BoxTemplate
|
||||
|
||||
// MARK: Thumbnails
|
||||
|
||||
@ -64,7 +64,7 @@ final class TemplateFactory {
|
||||
self.topBar = try .init(in: templateFolder)
|
||||
self.overviewSection = try .init(in: templateFolder)
|
||||
self.overviewSectionClean = try .init(in: templateFolder)
|
||||
self.placeholder = try .init(in: templateFolder)
|
||||
self.box = try .init(in: templateFolder)
|
||||
self.largeThumbnail = try .init(in: templateFolder)
|
||||
self.squareThumbnail = try .init(in: templateFolder)
|
||||
self.smallThumbnail = try .init(in: templateFolder)
|
||||
@ -75,4 +75,12 @@ final class TemplateFactory {
|
||||
self.video = try .init(in: templateFolder)
|
||||
self.html = .init()
|
||||
}
|
||||
|
||||
// MARK: Convenience methods
|
||||
|
||||
func makePlaceholder(title: String, text: String) -> String {
|
||||
box.generate([
|
||||
.title: title,
|
||||
.text: text])
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user