Refactor page content generators
This commit is contained in:
24
CHDataManagement/Generator/Commands/BoxCommand.swift
Normal file
24
CHDataManagement/Generator/Commands/BoxCommand.swift
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
struct BoxCommand: CommandProcessor {
|
||||
|
||||
static let commandType: CommandType = .box
|
||||
|
||||
let results: PageGenerationResults
|
||||
|
||||
init(content: Content, results: PageGenerationResults, language: ContentLanguage) {
|
||||
self.results = results
|
||||
}
|
||||
|
||||
/**
|
||||
Format: ``
|
||||
*/
|
||||
func process(_ arguments: [String], markdown: Substring) -> String {
|
||||
guard arguments.count > 1 else {
|
||||
invalid(markdown)
|
||||
return ""
|
||||
}
|
||||
let title = arguments[0]
|
||||
let text = arguments.dropFirst().joined(separator: ";")
|
||||
return ContentBox(title: title, text: text).content
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user