Improve Bible verse formatting and cleanup
This commit is contained in:
parent
7c62d56b67
commit
6fd960dd6f
|
@ -282,7 +282,7 @@
|
|||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastSwiftUpdateCheck = 1610;
|
||||
LastUpgradeCheck = 1620;
|
||||
LastUpgradeCheck = 1630;
|
||||
TargetAttributes = {
|
||||
EA2F9F7D2CF406E800B9F454 = {
|
||||
CreatedOnToolsVersion = 16.1;
|
||||
|
@ -412,6 +412,7 @@
|
|||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = TQMND62F2W;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
|
@ -476,6 +477,7 @@
|
|||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = TQMND62F2W;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
|
@ -507,7 +509,6 @@
|
|||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"Preview Content\"";
|
||||
DEVELOPMENT_TEAM = TQMND62F2W;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
|
@ -550,7 +551,6 @@
|
|||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"Preview Content\"";
|
||||
DEVELOPMENT_TEAM = TQMND62F2W;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
|
|
|
@ -28,8 +28,14 @@ class BibleService {
|
|||
.replacingOccurrences(of: "<[^>]+>", with: "", options: .regularExpression)
|
||||
.replacingOccurrences(of: """, with: "\"")
|
||||
.replacingOccurrences(of: "'", with: "'")
|
||||
.replacingOccurrences(of: "¶\\s*", with: "", options: .regularExpression) // Remove paragraph markers
|
||||
.replacingOccurrences(of: "NUN\\s+\\d+\\s+", with: "", options: .regularExpression) // Remove Hebrew letter prefixes
|
||||
.replacingOccurrences(of: "^[A-Z]+\\s+\\d+\\s+", with: "", options: .regularExpression) // Remove any other letter prefixes
|
||||
.replacingOccurrences(of: "^\\d+\\s*¶?\\s*", with: "", options: .regularExpression) // Remove verse numbers and paragraph markers at start
|
||||
.replacingOccurrences(of: "^\\d+(?=\\w)", with: "", options: .regularExpression) // Remove verse numbers stuck to text
|
||||
.replacingOccurrences(of: "\\s+\\d+\\s+", with: " ", options: .regularExpression) // Remove verse numbers in middle
|
||||
.replacingOccurrences(of: "\\([^)]*\\)", with: "", options: .regularExpression) // Remove parenthetical content
|
||||
.replacingOccurrences(of: "\\s+", with: " ", options: .regularExpression) // Normalize spaces
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +63,13 @@ class BibleService {
|
|||
|
||||
let (data, response) = try await URLSession.shared.data(for: request)
|
||||
|
||||
// Log raw response
|
||||
if let rawResponse = String(data: data, encoding: .utf8) {
|
||||
print("Raw Bible API Response:")
|
||||
print(rawResponse)
|
||||
print("\n")
|
||||
}
|
||||
|
||||
// Check for successful response
|
||||
guard let httpResponse = response as? HTTPURLResponse,
|
||||
(200...299).contains(httpResponse.statusCode) else {
|
||||
|
@ -66,6 +79,12 @@ class BibleService {
|
|||
let decoder = JSONDecoder()
|
||||
let apiResponse = try decoder.decode(BibleAPIResponse.self, from: data)
|
||||
|
||||
// Log cleaned content
|
||||
print("Cleaned verse content:")
|
||||
print(apiResponse.data.cleanContent)
|
||||
print("\nReference:", apiResponse.data.reference)
|
||||
print("\n")
|
||||
|
||||
return (verse: apiResponse.data.cleanContent, reference: apiResponse.data.reference)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue