diff --git a/LauncherOSX/LOXSpineItem.mm b/LauncherOSX/LOXSpineItem.mm index e9cf252..dabbdf4 100644 --- a/LauncherOSX/LOXSpineItem.mm +++ b/LauncherOSX/LOXSpineItem.mm @@ -65,14 +65,8 @@ - (id)initWithSdkSpineItem:(ePub3::SpineItemPtr)sdkSpineItem fromPackage:(LOXPac _idref = [NSString stringWithUTF8String:str]; _sdkSpineItem = sdkSpineItem; - _page_spread = [self findProperty:@"page-spread-left" withPrefix:@"rendition"]; - if([_page_spread length] == 0) { - _page_spread = [self findProperty:@"page-spread-right" withPrefix:@"rendition"]; - if([_page_spread length] == 0) { - _page_spread = [self findProperty:@"page-spread-center" withPrefix:@"rendition"]; - } - } - + _page_spread = [self findProperty:@"page-spread" withOptionalPrefix:@"rendition"]; + _rendition_spread = [self findProperty:@"spread" withPrefix:@"rendition"]; _rendition_orientation = [self findProperty:@"orientation" withPrefix:@"rendition"]; @@ -87,6 +81,18 @@ - (id)initWithSdkSpineItem:(ePub3::SpineItemPtr)sdkSpineItem fromPackage:(LOXPac } +- (NSString *) findProperty:(NSString *)propName withOptionalPrefix:(NSString *)prefix +{ + NSString* value = [self findProperty:propName withPrefix:prefix]; + + if([value length] == 0) { + value = [self findProperty:propName withPrefix:@""]; + } + + return value; + +} + - (NSString *) findProperty:(NSString *)propName withPrefix:(NSString *)prefix { auto prop = _sdkSpineItem->PropertyMatching([propName UTF8String], [prefix UTF8String]); @@ -116,4 +122,4 @@ - (NSDictionary *)toDictionary } -@end \ No newline at end of file +@end