Rework content commands, add audio player
This commit is contained in:
@@ -4,14 +4,6 @@ extension Content {
|
||||
("/" + path).replacingOccurrences(of: "//", with: "/")
|
||||
}
|
||||
|
||||
private func pathPrefix(for file: FileResource) -> String {
|
||||
switch file.type {
|
||||
case .image: return settings.paths.imagesOutputFolderPath
|
||||
case .video: return settings.paths.videosOutputFolderPath
|
||||
default: return settings.paths.filesOutputFolderPath
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Paths to items
|
||||
|
||||
func absoluteUrlPrefixForTag(_ tag: Tag, language: ContentLanguage) -> String {
|
||||
@@ -22,20 +14,6 @@ extension Content {
|
||||
absoluteUrlPrefixForTag(tag, language: language) + ".html"
|
||||
}
|
||||
|
||||
func absoluteUrlToPage(_ page: Page, language: ContentLanguage) -> String {
|
||||
// TODO: Record link to trace connections between pages
|
||||
makeCleanAbsolutePath(settings.pages.pageUrlPrefix + "/" + page.localized(in: language).urlString)
|
||||
}
|
||||
|
||||
/**
|
||||
Get the url path to a file in the output folder.
|
||||
The result is an absolute path from the output folder for use in HTML.
|
||||
*/
|
||||
func absoluteUrlToFile(_ file: FileResource) -> String {
|
||||
let path = pathPrefix(for: file) + "/" + file.id
|
||||
return makeCleanAbsolutePath(path)
|
||||
}
|
||||
|
||||
// MARK: Find items by id
|
||||
|
||||
func page(_ pageId: String) -> Page? {
|
||||
@@ -50,8 +28,8 @@ extension Content {
|
||||
files.first { $0.id == videoId && $0.type.isVideo }
|
||||
}
|
||||
|
||||
func file(id: String) -> FileResource? {
|
||||
files.first { $0.id == id }
|
||||
func file(_ fileId: String) -> FileResource? {
|
||||
files.first { $0.id == fileId }
|
||||
}
|
||||
|
||||
func tag(_ tagId: String) -> Tag? {
|
||||
|
Reference in New Issue
Block a user