MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Plugins (https://www.mobileread.com/forums/forumdisplay.php?f=268)
-   -   Pagelist plugin for print edition page numbers (https://www.mobileread.com/forums/showthread.php?t=265237)

Doitsu 09-15-2015 01:47 PM

Pagelist plugin for print edition page numbers
 
1 Attachment(s)
[Plugin] PageList - Generates print edition page numbers

Updated: July 1, 2021
Current Version: "0.3.1"

This plugin will generate NAV page list and/or NCX page list sections from page targets defined using the following special span tags:

Code:

<span epub:type="pagebreak" id="page1" title="1"/>
or
Code:

<span epub:type="pagebreak" id="page1">1</span>
(Both span types can have additional class attributes and the second variant can also have a title attribute.)

You can also manually edit the PageList.json file to have the plugin search for class attributes. For example, if you want to use the following span attributes:

Code:

<span class="com-rorohiko-pagestaker-style">1</span>
you'll need to use change the following entries in PageList.json:
Code:

{
  "tag": "span",
  "attribute": "epub:type",
  "value": "pagebreak"
}

to
Code:

{
  "tag": "span",
  "attribute": "class",
  "value": "com-rorohiko-pagestaker-style"
}

PageList.json will be automatically created when you run the plugin for the first time.
To display the PageList preferences folder, select Edit > Preferences > Open Preferences Location > plugins_prefs > PageList.

Installation:

To install the plugin open Sigil and select:

Plugins > Manage Plugins > Add Plugin > PageList_v0.3.1.zip > OK.

Usage:

To run the plugin select:

Plugins > Edit > PageList.

Note that this plugin will overwrite existing pagelist sections without warning. I.e., you might want to create a backup of your ebook before running this plugin.

After the page list was generated, you can test it with Apple Books or Azardi (Windows/OSX/Linux freeware).

Note that Azardi doesn't support the first, empty span declaration. It also apparently ignores the page list section. It's therefore not ideal for testing.

If you're using the second, non-empty span version, you might want to use the following style in epub3 books to hide the page number:

Code:

@namespace epub "http://www.idpf.org/2007/ops";

/* more CSS rules */

*[epub|type='pagebreak'] { display: none; }

This CSS rule will hide the page number in ADE3* or higher, Apple Books and Azardi, however, KindleGen will ignore it. You may want to use the empty span variant instead, because if you hide the page number span with display: none, KindleGen won't generate a pagemap.

BTW, page number target spans can be easily inserted with a clip.

1. Press Ctrl+Alt+C to open the Clip Editor.
2. Create a new clip and name it, for example, page-break.
3. Copy the following text to the Text field of the page-break clip:
Code:

<span epub:type="pagebreak" id="page\1">\1</span>
4. Save the clip and close the Clip Editor.

Then enter the page number in the Code View window, highlight it, right-click it and select Clips > page-break.

* Even ADE4 still doesn't support page lists in ePub3 books.

License: GNU General Public License v3 (GPL-3)

KevinH 09-15-2015 01:58 PM

Hi Doitsu,

Nice addition! I have added this to the Sigil Plugin Index thread.

KevinH

radius 09-24-2015 04:24 PM

Quote:

Originally Posted by Doitsu (Post 3171164)
After the pagelist was generated, you can test it with iBooks or Azardi (Windows/OSX/Linux freeware). (You could also compile the ePub with Kindle Previewer/KindleGen, generate an .apnx file with KindleUnpack and test the ebook with an eInk Kindle. However, the Kindle page display might be off by a page.

Can you explain the bolded part? It sounds like you are saying that kindleunpack will extract a .apnx file out of a Kindle book created with kindlegen (that was in turn, originally an epub that had your plugin run on it).

However, in the past when I've run kindleunpack I don't recall getting the .apnx, and in any case I thought it was a separate file that goes alongside any .mobi and isn't included inside it (ie: how would kindleunpack extract a file that wasn't inside in the first place).

I know I must be misunderstanding something somewhere :)

KevinH 09-24-2015 04:32 PM

Hi,
Kindlegen stores the info to create a separate apnx file inside the mobi it creates. Recent versions of KindleUnpack can extract it and even read in external apnx files alongside the azw3 file.

KevinH

Doitsu 09-24-2015 06:28 PM

Quote:

Originally Posted by radius (Post 3176499)
It sounds like you are saying that kindleunpack will extract a .apnx file out of a Kindle book created with kindlegen (that was in turn, originally an epub that had your plugin run on it).

KindleUnpack will generate an .apnx file, if the source file contained either a valid pagelist or a pagemap and was compiled with KindleGen. (Since pagemaps are an Adobe extension and'll cause epubs to fail epubcheck, I decided to generate only pagelists with the plugin.)

BTW, if you plan to add "real page numbers" to a self-published KDP book, you can save yourself the hassle, because, AFAIK, Amazon won't generate APNX files for self-published books, unless the author also published a print edition (with "real page numbers").

polizoto 12-23-2015 11:10 AM

After using the page-list plug in and then exporting to EPUB3 with EPUB3-itizer, I am still not getting the list of page numbers in my TOC. Any thoughts?

Doitsu 12-23-2015 11:34 AM

Quote:

Originally Posted by polizoto (Post 3228973)
After using the page-list plug in and then exporting to EPUB3 with EPUB3-itizer, I am still not getting the list of page numbers in my TOC. Any thoughts?

If you've used the latest version of the epub3 plugin, the page list section will be automatically hidden via css.

If nav.xhtml actually contains a page-list section, locate the style section and delete the page-list id marked in Magenta:

Code:

    <style type="text/css">
    nav#landmarks, nav#page-list { display:none; }
    ol { list-style-type: none; }
    </style>

Note that some ePub3 apps, e.g. Azardi, actually ignore the nav page-list section and won't display page numbers unless they've been marked using the following syntax:

Code:

<span epub:type="pagebreak" id="page1">1</span>
Other ePub3 apps won't display pagebreak page numbers in the book at all.

What app did you use for testing? If you used iBooks you'll need to activate the page number display, because they're hidden by default.

polizoto 12-23-2015 12:03 PM

I am testing with Readium and iBooks. I removed the page-list id from the nav.xhtml file.

I can see the page numbers that correspond with the chapters and sections of my ebook, but what I would like to do is have ALL the page numbers-- corresponding to chapter or section headings or not-- displayed for easier navigation. With which readers can this be accomplished?

polizoto 12-23-2015 12:13 PM

Here's what I am trying to accomplish:

1) Mark up all of the original page numbers from a textbook in my EPUB project
2) Export to EPUB3 with all the original page numbers in the TOC
3) The student can use the TOC in the EPUB3 player to navigate directly to the each original page in the textbook

Thank you,

Joseph

Doitsu 12-23-2015 01:02 PM

Quote:

Originally Posted by polizoto (Post 3229004)
[...] what I would like to do is have ALL the page numbers-- corresponding to chapter or section headings or not-- displayed for easier navigation. With which readers can this be accomplished?

Unfortunately, I don't know any reader that offers this feature.

AlPe 12-24-2015 09:36 AM

@Doitsu : I think that what @polizoto wants is to have the page numbers appear in the ToC as well. This way the resulting EPUB can cope with the lack of support for (proper) page-list in real-world apps.

For example, you can put them as children of the corresponding main ToC entry:

Code:

ToC
  - Cover
  -- 1
  - Preface
  -- 2
  -- 3
  - Introduction
  -- 4
  -- 5
  -- 6
  -- 7
  - First Chapter
  -- 8
  -- 9
  -- ...

Albeit against the "official blessings" of the IDPF, I think it would be an idea worth exploring, at least as an option in your plugin --- I guess it would not be too difficult for you to implement it, given you have all the machinery in place.

(Not sure how to deal with number gaps, or if collapsing ranges would work. These might be user options.)

DiapDealer 12-24-2015 09:50 AM

As useful as it might seem, I think it would be terribly unwieldy. Trying to navigate a ToC with a link to every, single page number would take me longer than just jumping to the right chapter and then nudging the progress slider 'til I get the right page-number.

Doitsu 12-24-2015 10:30 AM

Quote:

Originally Posted by DiapDealer (Post 3229591)
As useful as it might seem, I think it would be terribly unwieldy.

I also think that it'd be a bit unwieldy, but might be useful for debugging purposes. I might add it as an optional option.

@polizoto: ADE 4.x apparently allows you to click page target hyperlinks.

polizoto 12-29-2015 03:46 AM

Page Number Options
 
Alberto is correct-- As long as a particular does not support page number navigation separately from the TOC (like Azardi or Gitden Reader), I would like to provide all the page numbers in the TOC, if possible. This feature would be important in my workflow since I am preparing books for the blind and visually impaired for whom quick navigation via the TOC or another landmark screen + VoiceOver/JAWS is essential, no matter how unwieldy it might seem to us sighted folks. I am surprised that IDPF, which consists of many of the DAISY consortium people, did not keep this fact in mind because EPUB3 has practically meant the death of DAISY, yet all DAISY books contain this feature.

Thanks for the consideration,

Joseph

Doitsu 12-29-2015 08:46 PM

Quote:

Originally Posted by polizoto (Post 3231610)
Alberto is correct-- As long as a particular does not support page number navigation separately from the TOC (like Azardi or Gitden Reader), I would like to provide all the page numbers in the TOC, if possible.

Have you tested your ePub3 books with the latest edition of ADE 4.5.x? It allows you to click on page list links (without HTML changes).
(In the Android version, you'll have to select: > Contents ▼ > Page List; in the PC version, you can select the Page List links from the Table Of Contents pane of the main dialog box.)

David Kudler 03-15-2016 05:27 PM

May I ask what is probably a silly question?

How the heck do I generate page numbers/spans when exporting from InDesign (CC) to a reflowable ePub3 file —*so that I can then use this plugin to generate a pagelist?

I can see that they're automatically there when I export to FXL. For a novel, do I have to go through and enter the #)@$*)@ things by hand, or is there something that I can do at the InDesign end to add the tags?

JSWolf 03-15-2016 05:34 PM

Is this compatible with ADE 2.0.1? If not, why not make it compatible?

Doitsu 03-15-2016 05:36 PM

Quote:

Originally Posted by David Kudler (Post 3281367)
How the heck do I generate page numbers/spans when exporting from InDesign (CC) to a reflowable ePub3 file —*so that I can then use this plugin to generate a pagelist?

Unfortunately, I can't help you with that. You might want to ask this question in the Workshop forum or the ePub forum.

David Kudler 03-15-2016 10:09 PM

Quote:

Originally Posted by Doitsu (Post 3281372)
Unfortunately, I can't help you with that. You might want to ask this question in the Workshop forum or the ePub forum.

Will do. Thanks for your help — and for the awesome plugins! :-D

Quote:

Originally Posted by JSWolf (Post 3281371)
Is this compatible with ADE 2.0.1? If not, why not make it compatible?

Um... ADE 2 doesn't handle ePub3 at all, does it? Pagelists are an ePub3 feature.

Tex2002ans 03-16-2016 04:53 AM

Quote:

Originally Posted by David Kudler (Post 3281505)
Um... ADE 2 doesn't handle ePub3 at all, does it?

Nope. I believe EPUB3 support was added in ADE 4.0.

Quote:

Originally Posted by David Kudler (Post 3281505)
Pagelists are an ePub3 feature.

Actually, pageLists can be done in EPUB2:

http://www.idpf.org/epub/20/spec/OPF...Section2.4.1.2

EPUB3 just changed the way it is done.

DiapDealer 03-16-2016 09:17 AM

For the record: ADE 2 will read/render text-based EPUB3s (novels primarily) just fine. You're correct that it doesn't support the multi-media aspects, or the scripting portions, or the fixed-layout portions of the EPUB3 spec, but "supporting" EPUB3 all depends on the EPUB itself. It's not like ADE 2 (or 3) says, "I can't open that." It, in fact, opens/renders many commercially-available EPUB3s just fine.

Offtopic though. My apologies, Doitsu. Back to pagelist/pagemap generation. ;)

Doitsu 03-16-2016 09:54 AM

Quote:

Originally Posted by Tex2002ans (Post 3281650)
I believe EPUB3 support was added in ADE 4.0.

That's correct, however, ADE 4.x won't display pagelist based page numbers in the book. (At least the Children's Literature test file, which worked fine with iBooks, didn't work with ADE 4.x; there's a Show Page Numbers menu item, but it doesn't seem to do anything. )

Quote:

Originally Posted by Tex2002ans (Post 3281650)
Actually, pageLists can be done in EPUB2:

That's also technically correct, but, AFAIK, there are no free ePub2 apps that actually support this feature. Even among dedicated ePub3 apps pagelist support isn't that great. AFAIK, the only free ePub3 apps that support pagelist page numbers are iBooks and Azardi Reader.

Quote:

Originally Posted by DiapDealer (Post 3281807)
Offtopic though. My apologies, Doitsu. Back to pagelist/pagemap generation. ;)

Your comments are always welcome, because they usually contain useful information or are at least entertaining. :)
The same goes, of course, for Tex2002ans who consistently provides high-quality answers.

Tex2002ans 03-16-2016 07:33 PM

Quote:

Originally Posted by Doitsu (Post 3281818)
That's also technically correct, but, AFAIK, there are no free ePub2 apps that actually support this feature. Even among dedicated ePub3 apps pagelist support isn't that great. AFAIK, the only free ePub3 apps that support pagelist page numbers are iBooks and Azardi Reader.

For EPUB3 readers, Readium works as well (and I assume any Readium SDK-based apps (there is probably a few on Android)).

Quote:

Originally Posted by Doitsu (Post 3281818)
The same goes, of course, for Tex2002ans who consistently provides high-quality answers.

*slips you some money under the table* :thumbsup:

LauraB7 11-17-2017 01:37 PM

I have a set of InDesign scripts to do this. It inserts conditional text with the page numbers inserted at the print page breaks. A post-export script will turn that <span> into the correct epub:type inflection and collect the pagelist to plop into the <nag> document.

See: http://www.bradytypesetting.com/rorohikoscripts

DiapDealer 11-17-2017 02:07 PM

Quote:

Originally Posted by LauraB7 (Post 3613392)
I have a set of InDesign scripts to do this. It inserts conditional text with the page numbers inserted at the print page breaks. A post-export script will turn that <span> into the correct epub:type inflection and collect the pagelist to plop into the <nag> document.

See: http://www.bradytypesetting.com/rorohikoscripts

<nag> document. :rofl:

I know this was a typo, and I know what you meant, but boy .... did it ever make me giggle! :D

David Kudler 11-25-2017 07:10 PM

Quote:

Originally Posted by DiapDealer (Post 3613409)
<nag> document. :rofl:

I know this was a typo, and I know what you meant, but boy .... did it ever make me giggle! :D

#eprdctn humor! :-)

David Kudler 08-08-2020 03:40 PM

I have a book that I'm converting that's widely used as a textbook in print, so this is great.

Just to be sure I understand what I have to do to make this work:
  1. Paste the epub:type="pagebreak" clip at the location where each pagebreak occurs in the physical copy
  2. Run the plugin

That's it, right?

I'm bummed that InDesign only supports pagelist export for fixed-format ePubs.

Doitsu 08-09-2020 01:50 AM

Quote:

Originally Posted by David Kudler (Post 4020873)
Just to be sure I understand what I have to do to make this work:
  1. Paste the epub:type="pagebreak" clip at the location where each pagebreak occurs in the physical copy
  2. Run the plugin

That's it, right?

For the clip to work, you need to insert the page number, highlight it and then select the clip.

For example, if you insert 12, highlight it, and apply the clip you'll get:

Code:

<span epub:type="pagebreak" id="page12">12</span>
The plugin will use this information for generating the pagelist entries.

If there already are anchor tags with page numbers and ids in your book, you can modify the PageList.json preference file to re-use them. For example, the following preferences

Code:

{
  "tag": "a",
  "attribute": "class",
  "value": "page"
}

tells the plugin to look for:

Code:

<a class="page" id="page1">1</a>
However, in epub3 books, you'll need to manually add the epub:type="pagebreak" attributes.

David Kudler 08-14-2020 03:58 PM

Quote:

Originally Posted by Doitsu (Post 4020993)
For the clip to work, you need to insert the page number, highlight it and then select the clip.

Thanks. That's what I understood; I just didn't express it very well. ;-)

I'm about to dive into this. Wish me luck.

Terry Brown 10-09-2020 02:08 PM

I have used the pagelist plugin to modify an epub, saved it and loaded it in iBooks on my iPad. iBooks recognizes the new file has page numbers and shows the option, in the table of contents, to "tap to show printed page numbers". However, when I do this, the page numbers in the table of contents do not change, and when I am reading the book, there are no page numbers shown on an individual page. When I tap to show the menu and chapter progress, the number of pages left in the chapter is shown, but this number is related to the iBooks page number, not the 'real book' page numbers I added (that is, the number of pages left in the chapter changes with font size.).

Is there something else I need to do to make the page numbers show up?

Doitsu 10-09-2020 02:42 PM

Quote:

Originally Posted by Terry Brown (Post 4045153)
Is there something else I need to do to make the page numbers show up?

AFAIK, printed page numbers only work in epub3 books. If your book is an epub2 book, you'll have to convert it to an epub3 book with the ePub3-itizer plugin.

If your book is an epub3 book, maybe the pagelist section in the Nav doc is missing, doesn't contain pagelist entries or the page number definitions point to the wrong target ids.

You might want to check your book with my EPUBCheck plugin, if you haven't already done so.

If EPUBCheck doesn't report any broken links, download this very simple MR epub3 book with a working pagelist section and compare the pagelist section and the page target definitions with your book.

tastytea 07-01-2021 04:23 PM

Hi, thanks for your plugin!
I have a book that records page numbers like this:
Code:

<span role="doc-pagebreak" id="pg_13" aria-label="13">
Changing PageList.json to:
Code:

{
  "tag": "span",
  "attribute": "role",
  "value": "doc-pagebreak"
}

did not suffice, I also had to change plugin.py like this:
Code:

diff --git a/plugin.py b/plugin.py
index 9bf6b68..26a6863 100644
--- a/plugin.py
+++ b/plugin.py
@@ -143,6 +143,8 @@ def run(bk):
            # title has priority over string
            if page_number.has_attr('title'):
                title = page_number['title']
+            elif page_number.has_attr('aria-label'):
+                title = page_number['aria-label']
            else:
                title = page_number.string

Could you add that to your plugin?

Doitsu 07-01-2021 05:18 PM

Quote:

Originally Posted by tastytea (Post 4135287)
Could you add that to your plugin?

Thanks for the suggestion! I added the two lines to plugin.py and attached a new version to the first post.


All times are GMT -4. The time now is 07:06 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.