Add single file audio player, introduce blocks
This commit is contained in:
@ -46,7 +46,7 @@ struct AudioPlayerCommandProcessor: CommandProcessor {
|
||||
var amplitude: [AmplitudeSong] = []
|
||||
|
||||
for song in songs {
|
||||
guard let image = content.image(song.cover) else {
|
||||
guard let image = content.file(song.cover) else {
|
||||
results.missing(file: song.cover, containedIn: file)
|
||||
continue
|
||||
}
|
||||
@ -63,7 +63,11 @@ struct AudioPlayerCommandProcessor: CommandProcessor {
|
||||
results.warning("Song '\(song.file)' in file \(fileId) is not an audio file")
|
||||
continue
|
||||
}
|
||||
let coverUrl = image.absoluteUrl
|
||||
|
||||
let coverSize = 2 * content.settings.audioPlayer.playlistCoverImageSize
|
||||
let coverImage = image.imageVersion(width: coverSize, height: coverSize, type: image.type)
|
||||
let coverUrl = coverImage.outputPath
|
||||
results.require(image: coverImage)
|
||||
|
||||
let playlistItem = AudioPlayer.PlaylistItem(
|
||||
index: playlist.count,
|
||||
|
@ -13,7 +13,6 @@ struct ButtonCommandProcessor: CommandProcessor {
|
||||
}
|
||||
|
||||
/**
|
||||
Format: ``
|
||||
Format: ``
|
||||
Types:
|
||||
- Download: `download=<fileId>,<text>,<download-filename?>`
|
||||
|
@ -1,25 +0,0 @@
|
||||
import Splash
|
||||
|
||||
struct PageCodeProcessor {
|
||||
|
||||
private let codeHighlightFooter = "<script>hljs.highlightAll();</script>"
|
||||
|
||||
private let swift = SyntaxHighlighter(format: HTMLOutputFormat())
|
||||
|
||||
let results: PageGenerationResults
|
||||
|
||||
init(results: PageGenerationResults) {
|
||||
self.results = results
|
||||
}
|
||||
|
||||
func process(_ html: String, markdown: Substring) -> String {
|
||||
guard markdown.starts(with: "```swift") else {
|
||||
results.require(header: .codeHightlighting)
|
||||
results.require(footer: codeHighlightFooter)
|
||||
return html // Just use normal code highlighting
|
||||
}
|
||||
// Highlight swift code using Splash
|
||||
let code = markdown.between("```swift", and: "```").trimmed
|
||||
return "<pre><code>" + swift.highlight(code) + "</pre></code>"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user