First version
This commit is contained in:
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
16
WebsiteGenerator/Templates/Elements/PageHeadTemplate.swift
Normal file
16
WebsiteGenerator/Templates/Elements/PageHeadTemplate.swift
Normal 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"
|
||||
}
|
@ -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
|
||||
}
|
50
WebsiteGenerator/Templates/Elements/ThumbnailTemplate.swift
Normal file
50
WebsiteGenerator/Templates/Elements/ThumbnailTemplate.swift
Normal 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
|
||||
}
|
||||
|
15
WebsiteGenerator/Templates/Elements/TopBarTemplate.swift
Normal file
15
WebsiteGenerator/Templates/Elements/TopBarTemplate.swift
Normal 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
|
||||
}
|
Reference in New Issue
Block a user