Skip to content

Commit

Permalink
#17 support non-prefixed "page spread" rendio property
Browse files Browse the repository at this point in the history
  • Loading branch information
danielweck committed Oct 18, 2014
1 parent dc67c1c commit b2a3fe2
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions LauncherOSX/LOXSpineItem.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand All @@ -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]);
Expand Down Expand Up @@ -116,4 +122,4 @@ - (NSDictionary *)toDictionary
}


@end
@end

0 comments on commit b2a3fe2

Please sign in to comment.