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

Chapter display request #16

Closed
mapline opened this issue Feb 17, 2013 · 12 comments
Closed

Chapter display request #16

mapline opened this issue Feb 17, 2013 · 12 comments
Assignees

Comments

@mapline
Copy link

mapline commented Feb 17, 2013

Hi jgoguen
I don't know if it is possible or easy to do to ensure that the Chapter number as well a page is shown at foot of page?
eg One book shows "Chap V - PG. 35 OF 38" and another " PG. 15 OF 33".
First example "" class="calibre1">Chapter V ""
Second example ""class="calibre1">""
Could this be an enhancement?
Thanks Michael
Will not let me display line of html

@ghost ghost assigned jgoguen Feb 17, 2013
@jgoguen
Copy link
Owner

jgoguen commented Feb 17, 2013

I think I might be able to do this, but it will depend a lot on how the TOC is constructed whether I can do this reliably. And it's something that I would set up as an option, default off, because there may be chapter names instead that may be preferred to be shown over "Chapter X". Some investigation will need to be done.

@mapline
Copy link
Author

mapline commented Feb 17, 2013

Many thanks as I would like to know which chap as Kobo gives chap details not number. Await your further comments.
I seems .kepub.epub is ok in ver 2.4 although I have not received it yet.

@jgoguen
Copy link
Owner

jgoguen commented Feb 18, 2013

So, it seems like it would be possible to do, but there's no way it could be reliable. The closest I could come would be to find all navPoint elements with class="chapter" and run an incrementing counter to replace whatever chapter text is there with "Chapter X". However, this could be misleading and end up just as confusing for you as having only the text display. Take this fragment of a TOC file from a professionally-published ebook:

<navPoint class="chapter" id="971c6981-4d9a-4738-87df-9f7f11c6bb0f" playOrder="1">
    <navLabel>
        <text>Dedication</text>
    </navLabel>
    <content src="Into_the_Woods_split_001.html"/>
</navPoint>
<navPoint class="chapter" id="ba1a9e96-3f89-4ddd-a0d3-b6bee7d43883" playOrder="2">
    <navLabel>
        <text>The Hollows</text>
    </navLabel>
    <content src="Into_the_Woods_split_003.html"/>
</navPoint>
<navPoint class="chapter" id="eb50b2f0-cf6b-4fb2-a5cc-13da5cc3035c" playOrder="3">
    <navLabel>
        <text>The Bespelled</text>
    </navLabel>
    <content src="Into_the_Woods_split_004.html"/>
</navPoint>

What you should see as chapter titles down at the bottom of the page is:

  1. Dedication
  2. The Hollows
  3. Chapter 1 (alternatively: Chapter 1 — The Bespelled)

What you would actually see, because these navPoint elements all have class="chapter" even where they should have something more appropriate, is this:

  1. Chapter 1 — Dedication
  2. Chapter 2 — The Hollows
  3. Chapter 3 — The Bespelled

I can implement this, find all navPoint elements that claim to be chapters, but based on a sample from my personal library from different professional publishers it's highly likely that you would find the end result to be more confusing. I couldn't find any books in my library that would only show a page number, but the results would be the same as for books that do show chapter text of some kind. Take the same NCX fragment as above, but modified to remove the identifying text:

<navPoint class="chapter" id="971c6981-4d9a-4738-87df-9f7f11c6bb0f" playOrder="1">
    <content src="Into_the_Woods_split_001.html"/>
</navPoint>
<navPoint class="chapter" id="ba1a9e96-3f89-4ddd-a0d3-b6bee7d43883" playOrder="2">
    <content src="Into_the_Woods_split_003.html"/>
</navPoint>
<navPoint class="chapter" id="eb50b2f0-cf6b-4fb2-a5cc-13da5cc3035c" playOrder="3">
    <content src="Into_the_Woods_split_004.html"/>
</navPoint>

Based on what we already know, we should see something like this:

  1. Page 1 of 1
  2. Page 1 of 1
  3. Chapter 1 — Page 1 of X

However, you would actually see that your book starts on "Chapter 3":

  1. Chapter 1 — Page 1 of 1
  2. Chapter 2 — Page 1 of 1
  3. Chapter 3 — Page 1 of X

A third case is where the chapter text already includes "Chapter X". For me, that would be very simple: don't touch it.

So, in short, I can do this if you want but I want to make sure you understand that the results are most likely going to appear to be incorrect even if this feature functions perfectly.

@giorgio130
Copy link

The text that appears on the footer are the names defined in the TOC... if this one is properly written, why would you want to change them?

@jgoguen
Copy link
Owner

jgoguen commented Feb 18, 2013

I don't think you can programmatically determine "properly written", so if this is to be done I think it will strictly be "only if there is no chapter text". I'm trying to think of how I could do it to be least confusing. I found a book after posting last night that has both chapter number and name in the TOC, so really it looks like it's only feasible to do this where no chapter text exists already.

@mapline
Copy link
Author

mapline commented Feb 18, 2013

Thanks for your thoughts.
As I new to epubs does the TOC determine to table of contents.
How can I paste a copy of of 2 TOC as examples
Many thanks
Michael

@jgoguen
Copy link
Owner

jgoguen commented Feb 18, 2013

Take a look at https://help.github.com/articles/github-flavored-markdown for details on how to format things. Specifically, you'll want the Syntax Highlighting section. The example there is for Ruby, but if you replace "ruby" with "xml" and paste in your XML that will do it. You can use the Preview tab right above the editor to see what your comment looks like before you submit it.

@mapline
Copy link
Author

mapline commented Feb 18, 2013

Thanks will do that.
Also "As I new to epubs does the TOC determine to table of contents?"

@jgoguen
Copy link
Owner

jgoguen commented Feb 18, 2013

Ahh, yes. For EPUB2 books, the NCX file (typically named toc.ncx in my experience) defines a few things:

  1. The Table of Contents that would be in a paper book, via the navMap element and its navPoint children.
  2. The order to show chapters in, via the playOrder attribute to navPoint, or by the order they appear in the document in the absence of playOrder.
  3. The title for each chapter, by the text content of navMap > navPoint > navLabel > text, and the file where the chapter starts, by the src attribute of navMap > navPoint > content.

@mapline
Copy link
Author

mapline commented Feb 22, 2013

Thanks for thoughts will come back with reply but may not be soon as wife just taken into hospital

@jgoguen
Copy link
Owner

jgoguen commented Feb 22, 2013

Take your time, I hope everything turns out well for you both.

@jgoguen
Copy link
Owner

jgoguen commented Mar 10, 2013

I'm going to close this for now. Once everything has settled down for you and you have time, feel free to re-open this bug report. Again, I hope everything is going well for you and for your wife.

@jgoguen jgoguen closed this as completed Mar 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants