2025-01-06 10:00:51 +01:00

25 lines
649 B
Swift

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
}
}