Updated the DocCMiddleware middleware in the library target to support hosting from docc archives.

This commit is contained in:
2025-02-26 00:22:14 +01:00
parent 882f791181
commit d19d34fafb
2 changed files with 30 additions and 9 deletions
@@ -2,11 +2,19 @@ enum Path {
// MARK: Functions
static func archivePath(from path: String) -> String {
let pathComponents = path.split(separator: .forwardSlash)
return pathComponents.count > 1
? .init(format: .Format.archiveDocC, String(pathComponents[1]))
: .empty
}
static func archiveName(from path: String) -> String {
let pathComponents = path.split(separator: .forwardSlash)
return pathComponents.count > 1
? String(pathComponents[1]).lowercased()
? .init(pathComponents[1]).lowercased()
: .empty
}
@@ -37,5 +45,5 @@ private extension Character {
// MARK: - String+Formats
private extension String.Format {
static let archiveDocC = "%@.doccarchive"
static let archiveDocC = "/%@.doccarchive"
}