Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/support non prefixed page spread property #17

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions LauncherOSX/LOXSpineItem.mm
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,40 @@ - (id)initWithSdkSpineItem:(ePub3::SpineItemPtr)sdkSpineItem fromPackage:(LOXPac

auto manifestItem = sdkSpineItem->ManifestItem();
_href = [NSString stringWithUTF8String:manifestItem->BaseHref().c_str()];

_media_type = [NSString stringWithUTF8String:manifestItem->MediaType().c_str()];

_media_overlay_id = [[NSString alloc] initWithUTF8String: manifestItem->MediaOverlayID().c_str()];

_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_layout = [self findProperty:@"layout" withPrefix:@"rendition"];

_rendition_flow = [self findProperty:@"flow" withPrefix:@"rendition"];

}

return self;

}

- (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
2 changes: 1 addition & 1 deletion readium-sdk