Import old content, load from disk
This commit is contained in:
72
CHDataManagement/Model/LocalizedPage.swift
Normal file
72
CHDataManagement/Model/LocalizedPage.swift
Normal file
@@ -0,0 +1,72 @@
|
||||
import Foundation
|
||||
|
||||
/**
|
||||
A localized page contains the page content of a single language,
|
||||
including the title, url path and required resources
|
||||
|
||||
*/
|
||||
final class LocalizedPage: ObservableObject {
|
||||
|
||||
/**
|
||||
The string to use when creating the url for the page.
|
||||
|
||||
Defaults to ``id`` if unset.
|
||||
*/
|
||||
@Published
|
||||
var urlString: String
|
||||
|
||||
/**
|
||||
The headline to use when showing the entry on it's own page
|
||||
*/
|
||||
@Published
|
||||
var title: String
|
||||
|
||||
@Published
|
||||
var lastModified: Date?
|
||||
|
||||
/**
|
||||
The url used on the old version of the website.
|
||||
|
||||
Needed to redirect links to their new locations.
|
||||
*/
|
||||
let originalUrl: String?
|
||||
|
||||
/**
|
||||
All files which occur in the content and are stored.
|
||||
- Note: This property defaults to an empty set.
|
||||
*/
|
||||
@Published
|
||||
var files: Set<String> = []
|
||||
|
||||
/**
|
||||
All files which may occur in the content but are stored externally.
|
||||
|
||||
Missing files which would otherwise produce a warning are ignored when included here.
|
||||
- Note: This property defaults to an empty set.
|
||||
*/
|
||||
@Published
|
||||
var externalFiles: Set<String> = []
|
||||
|
||||
/**
|
||||
Specifies additional files which should be copied to the destination when generating the content.
|
||||
- Note: This property defaults to an empty set.
|
||||
*/
|
||||
@Published
|
||||
var requiredFiles: Set<String> = []
|
||||
|
||||
init(urlString: String,
|
||||
title: String,
|
||||
lastModified: Date? = nil,
|
||||
originalUrl: String? = nil,
|
||||
files: Set<String> = [],
|
||||
externalFiles: Set<String> = [],
|
||||
requiredFiles: Set<String> = []) {
|
||||
self.urlString = urlString
|
||||
self.title = title
|
||||
self.lastModified = lastModified
|
||||
self.originalUrl = originalUrl
|
||||
self.files = files
|
||||
self.externalFiles = externalFiles
|
||||
self.requiredFiles = requiredFiles
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user