Fix links to external pages
This commit is contained in:
@ -8,6 +8,8 @@ enum MinificationType {
|
||||
case css
|
||||
}
|
||||
|
||||
typealias PageMap = [(language: String, pages: [String : String])]
|
||||
|
||||
final class GenerationResultsHandler {
|
||||
|
||||
/// The content folder where the input data is stored
|
||||
@ -23,7 +25,7 @@ final class GenerationResultsHandler {
|
||||
|
||||
This relation is used to generate relative links to pages using the ``Element.id`
|
||||
*/
|
||||
private let pagePaths: [String: String]
|
||||
private let pageMap: PageMap
|
||||
|
||||
private let configuration: Configuration
|
||||
|
||||
@ -31,11 +33,11 @@ final class GenerationResultsHandler {
|
||||
|
||||
private let numberOfTotalPages: Int
|
||||
|
||||
init(in input: URL, to output: URL, configuration: Configuration, fileUpdates: FileUpdateChecker, pagePaths: [String: String], pageCount: Int) {
|
||||
init(in input: URL, to output: URL, configuration: Configuration, fileUpdates: FileUpdateChecker, pageMap: PageMap, pageCount: Int) {
|
||||
self.contentFolder = input
|
||||
self.fileUpdates = fileUpdates
|
||||
self.outputFolder = output
|
||||
self.pagePaths = pagePaths
|
||||
self.pageMap = pageMap
|
||||
self.configuration = configuration
|
||||
self.numberOfTotalPages = pageCount
|
||||
}
|
||||
@ -86,8 +88,8 @@ final class GenerationResultsHandler {
|
||||
|
||||
// MARK: Page data
|
||||
|
||||
func getPagePath(for id: String, source: String) -> String? {
|
||||
guard let pagePath = pagePaths[id] else {
|
||||
func getPagePath(for id: String, source: String, language: String) -> String? {
|
||||
guard let pagePath = pageMap.first(where: { $0.language == language})?.pages[id] else {
|
||||
missingLinkedPages[id] = source
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user