skoji / gepub

a generic EPUB library for Ruby : supports EPUB 3
Other
240 stars 42 forks source link

It isn't clear how to set linear=no when adding item to book #119

Closed slonopotamus closed 2 years ago

slonopotamus commented 4 years ago

Suppose, I have:

book = GEPUB::Book.new
item = book.add_ordered_item 'nav.xhtml'

This will add <itemref idref="nav.xhtml"/> to <spine> in package.opf.

Now I want to set linear="no" attribute for this itemref. How I do that?

skoji commented 4 years ago

You can add linear="no" by doing this in current API.

book = GEPUB::Book.new
item = book.add_ordered_item 'nav.xhtml'
book.spine.itemref_by_id[item.id].linear = 'no'

Yes, I know it is not clear and not clean at all. I will consider to add more clear API for linear and page-spread.

slonopotamus commented 2 years ago

I ended up not using linear="no" because it works inconsistently across ebook readers, so there isn't much value fixing this issue.