Full generation, file type cleanup
This commit is contained in:
@ -1,25 +0,0 @@
|
||||
import Foundation
|
||||
|
||||
struct FileOnDisk {
|
||||
|
||||
let type: FileType
|
||||
|
||||
let url: URL
|
||||
|
||||
let name: String
|
||||
|
||||
init(image: String, url: URL) {
|
||||
let ext = image.fileExtension!
|
||||
let type = ImageFileType(fileExtension: ext)!
|
||||
self.type = .image(type)
|
||||
self.url = url
|
||||
self.name = image
|
||||
}
|
||||
|
||||
init(type: FileType, url: URL, name: String) {
|
||||
self.type = type
|
||||
self.url = url
|
||||
self.name = name
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,12 @@ struct PageFile {
|
||||
let german: LocalizedPageFile
|
||||
|
||||
let english: LocalizedPageFile
|
||||
|
||||
/**
|
||||
Specifies additional files which should be copied to the destination when generating the content.
|
||||
- Note: This property defaults to an empty set.
|
||||
*/
|
||||
let requiredFiles: [String]?
|
||||
}
|
||||
|
||||
extension PageFile: Codable {
|
||||
@ -30,22 +36,6 @@ struct LocalizedPageFile {
|
||||
|
||||
let url: String
|
||||
|
||||
/**
|
||||
The files (images, videos, other files) used in the page.
|
||||
*/
|
||||
let files: [String]
|
||||
|
||||
/**
|
||||
The additional files required for the page to function correctly, but which are not stored with the content.
|
||||
*/
|
||||
let externalFiles: [String]
|
||||
|
||||
/**
|
||||
Specifies additional files which should be copied to the destination when generating the content.
|
||||
- Note: This property defaults to an empty set.
|
||||
*/
|
||||
let requiredFiles: [String]
|
||||
|
||||
let title: String
|
||||
|
||||
let linkPreviewImage: String?
|
||||
|
@ -1,11 +0,0 @@
|
||||
import Foundation
|
||||
|
||||
struct PageOnDisk {
|
||||
|
||||
let page: PageFile
|
||||
|
||||
let deContentUrl: URL
|
||||
|
||||
let enContentUrl: URL
|
||||
}
|
||||
|
@ -1,18 +1,11 @@
|
||||
import Foundation
|
||||
|
||||
struct NavigationItemReference: Codable {
|
||||
|
||||
let type: ItemType
|
||||
|
||||
let id: String
|
||||
}
|
||||
|
||||
struct SettingsFile {
|
||||
|
||||
let paths: PathSettingsFile
|
||||
|
||||
/// The tags to show in the navigation bar
|
||||
let navigationItems: [NavigationItemReference]
|
||||
let navigationItems: [String]
|
||||
|
||||
let posts: PostSettingsFile
|
||||
|
||||
|
@ -95,6 +95,12 @@ final class Storage: ObservableObject {
|
||||
return contentScope.readString(at: path)
|
||||
}
|
||||
|
||||
func hasPageContent(for pageId: String, language: ContentLanguage) -> Bool {
|
||||
guard let contentScope else { return false }
|
||||
let path = pageContentPath(page: pageId, language: language)
|
||||
return contentScope.hasFile(at: path)
|
||||
}
|
||||
|
||||
/**
|
||||
Delete all files associated with pages that are not in the given set
|
||||
- Note: This function requires a security scope for the content path
|
||||
|
Reference in New Issue
Block a user