25 lines
646 B
Swift
25 lines
646 B
Swift
|
|
struct IconCommand: CommandProcessor {
|
|
|
|
static let commandType: CommandType = .icons
|
|
|
|
let results: PageGenerationResults
|
|
|
|
init(content: Content, results: PageGenerationResults, language: ContentLanguage) {
|
|
self.results = results
|
|
}
|
|
|
|
func process(_ arguments: [String], markdown: Substring) -> String {
|
|
var icons = [PageIcon]()
|
|
for argument in arguments {
|
|
guard let icon = PageIcon(rawValue: argument) else {
|
|
invalid(markdown)
|
|
continue
|
|
}
|
|
icons.append(icon)
|
|
}
|
|
results.require(icons: icons)
|
|
return ""
|
|
}
|
|
}
|