Refactor page content generators

This commit is contained in:
Christoph Hagen
2025-01-06 10:00:51 +01:00
parent 245534e989
commit 301dbad0a5
36 changed files with 760 additions and 566 deletions

View 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: `![box](<title>;<body>)`
*/
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
}
}