Simplify images, tag overview
This commit is contained in:
@@ -28,6 +28,10 @@ struct SecurityBookmark {
|
||||
|
||||
// MARK: Write
|
||||
|
||||
func fullPath(to relativePath: String) -> URL {
|
||||
url.appending(path: relativePath, directoryHint: .notDirectory)
|
||||
}
|
||||
|
||||
/**
|
||||
Write the data of an encodable value to a relative path in the content folder,
|
||||
or delete the file if nil is passed.
|
||||
@@ -68,7 +72,7 @@ struct SecurityBookmark {
|
||||
createParentFolder: Bool = true,
|
||||
ifFileExists overwrite: OverwriteBehaviour = .writeIfChanged) -> Bool {
|
||||
perform { url in
|
||||
let file = url.appending(path: relativePath, directoryHint: .notDirectory)
|
||||
let file = fullPath(to: relativePath)
|
||||
|
||||
if exists(file) {
|
||||
switch overwrite {
|
||||
|
@@ -56,7 +56,6 @@ final class Storage: ObservableObject {
|
||||
|
||||
// MARK: Pages
|
||||
|
||||
|
||||
private func pageContentFileName(_ id: String, _ language: ContentLanguage) -> String {
|
||||
"\(id)-\(language.rawValue).md"
|
||||
}
|
||||
@@ -236,6 +235,23 @@ final class Storage: ObservableObject {
|
||||
|
||||
// MARK: Files
|
||||
|
||||
/**
|
||||
The full path to a resource file in the content folder
|
||||
- Parameter file: The filename of the file
|
||||
- Note: Only for resource files, since path is relative to files folder
|
||||
*/
|
||||
func path(toFile file: String) -> URL? {
|
||||
contentScope?.fullPath(to: filePath(file: file))
|
||||
}
|
||||
|
||||
/**
|
||||
The full file path to a file in the output folder
|
||||
- Parameter relativePath: The path of the file relative to the output folder
|
||||
*/
|
||||
func outputPath(to relativePath: String) -> URL? {
|
||||
outputScope?.fullPath(to: relativePath)
|
||||
}
|
||||
|
||||
private func filePath(file fileId: String) -> String {
|
||||
filesFolderName + "/" + fileId
|
||||
}
|
||||
@@ -337,6 +353,7 @@ final class Storage: ObservableObject {
|
||||
}
|
||||
print("Found \(allImages.count) generated images")
|
||||
let images = Set(allImages)
|
||||
#warning("TODO: Fix counting generated images")
|
||||
return imageSet.reduce(into: [:]) { result, imageName in
|
||||
let prefix = imageName.fileNameWithoutExtension + "@"
|
||||
let versions = images.filter { $0.hasPrefix(prefix) }
|
||||
|
Reference in New Issue
Block a user