Update icons, hide page title
This commit is contained in:
@ -0,0 +1,25 @@
|
||||
|
||||
struct IconCommandProcessor: CommandProcessor {
|
||||
|
||||
let commandType: ShorthandMarkdownKey = .icons
|
||||
|
||||
|
||||
let results: PageGenerationResults
|
||||
|
||||
init(content: Content, results: PageGenerationResults) {
|
||||
self.results = results
|
||||
}
|
||||
|
||||
func process(_ arguments: [String], markdown: Substring) -> String {
|
||||
var icons = [PageIcon]()
|
||||
for argument in arguments {
|
||||
guard let icon = PageIcon(rawValue: argument) else {
|
||||
results.invalid(command: .icons, markdown)
|
||||
continue
|
||||
}
|
||||
icons.append(icon)
|
||||
}
|
||||
results.require(icons: icons)
|
||||
return ""
|
||||
}
|
||||
}
|
@ -23,6 +23,8 @@ final class PageContentParser {
|
||||
|
||||
private let inlineLink: InlineLinkProcessor
|
||||
|
||||
private let icons: IconCommandProcessor
|
||||
|
||||
var largeImageWidth: Int {
|
||||
content.settings.pages.largeImageWidth
|
||||
}
|
||||
@ -39,6 +41,7 @@ final class PageContentParser {
|
||||
self.labelHandler = .init(content: content, results: results)
|
||||
self.audioPlayer = .init(content: content, results: results)
|
||||
self.inlineLink = .init(content: content, results: results, language: language)
|
||||
self.icons = .init(content: content, results: results)
|
||||
}
|
||||
|
||||
func generatePage(from content: String) -> String {
|
||||
@ -226,6 +229,8 @@ final class PageContentParser {
|
||||
return audioPlayer.process(arguments, markdown: markdown)
|
||||
case .tagLink:
|
||||
return handleTagLink(arguments, markdown: markdown)
|
||||
case .icons:
|
||||
return icons.process(arguments, markdown: markdown)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ final class PageGenerator {
|
||||
language: language,
|
||||
dateString: page.dateText(in: language),
|
||||
title: localized.title,
|
||||
showTitle: !localized.hideTitle,
|
||||
tags: tags,
|
||||
linkTitle: localized.linkPreviewTitle ?? localized.title,
|
||||
description: localized.linkPreviewDescription ?? "",
|
||||
|
@ -49,4 +49,8 @@ enum ShorthandMarkdownKey: String {
|
||||
/// Format: ``
|
||||
case audioPlayer = "audio-player"
|
||||
|
||||
/// Add svg icons to the page for use in html components
|
||||
/// Format: ``
|
||||
case icons
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user