refactor: rename RDReaderView -> RDEpubReaderView, update pod config and docs
- Rename source module from RDReaderView to RDEpubReaderView - Move all source files from Sources/RDReaderView/ to Sources/RDEpubReaderView/ - Update podspec: RDReaderView.podspec -> RDEpubReaderView.podspec - Update Podfile, demo project, and CocoaPods config for new pod name - Delete old RDReaderView pod support files from ReadViewDemo/Pods - Add new RDEpubReaderView pod support files - Update documentation (API ref, architecture, UML, conventions, etc.) - Add FixedLayoutRotationTests - Update .gitignore: exclude .DS_Store, manual unpack backups, _ssoft-output
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import Foundation
|
||||
|
||||
public enum RDEPUBCFICompatibility {
|
||||
public static func parseLossy(_ rawValue: String?) -> RDEPUBCFI? {
|
||||
try? RDEPUBCFIParser.parse(rawValue)
|
||||
}
|
||||
|
||||
public static func parseRangeLossy(_ rawValue: String?) -> RDEPUBCFIRange? {
|
||||
if let parsed = try? RDEPUBCFIParser.parseRange(rawValue) {
|
||||
return parsed
|
||||
}
|
||||
|
||||
guard let rawValue,
|
||||
!rawValue.isEmpty else {
|
||||
return nil
|
||||
}
|
||||
|
||||
let separators = ["..", "-"]
|
||||
let separator = separators.first(where: { rawValue.contains($0) })
|
||||
guard let separator else { return nil }
|
||||
let parts = rawValue.components(separatedBy: separator)
|
||||
guard parts.count == 2,
|
||||
let start = parseLossy(parts[0]),
|
||||
let end = parseLossy(parts[1]) else {
|
||||
return nil
|
||||
}
|
||||
return RDEPUBCFIRange(parent: nil, start: start, end: end)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user