Show an estimated page count for each built book
Bindery counts the pages as the last step of a build, from the text of the ePub. The story list and the OPDS catalog show the count. A story has no count until its book is built. The method follows "Paragraphs (APNX Accurate)" of the Count Pages plugin for calibre. Bindery counts each paragraph that a reader sees, so the same text gives the same count as <p> elements, as <div> elements and as lines with <br> between them. An empty paragraph is not counted.
This commit is contained in:
@@ -650,6 +650,37 @@ always the site name.
|
||||
replaces only the ePub file. So edits that you make in CWA stay, and later changes on the site show
|
||||
in the ePub but not in the CWA catalog.
|
||||
|
||||
## Page count
|
||||
|
||||
The story list shows an estimated page count beside the chapter count. The OPDS catalog shows it in the
|
||||
description of a book. Bindery counts the pages as the last step when it builds an ePub, so the count
|
||||
includes your replacement rules and the line-break setting. A story shows no page count until Bindery
|
||||
builds its book.
|
||||
|
||||
The method comes from "Paragraphs (APNX Accurate)" in the
|
||||
[Count Pages plugin](https://github.com/kiwidude68/calibre_plugins/wiki/Count-Pages) for calibre:
|
||||
|
||||
- A paragraph start is one line. Each 70 characters of text is one more line.
|
||||
- A page is 31 lines.
|
||||
- A page is at most 2400 characters. This limit sets the count of a book with almost no paragraphs.
|
||||
|
||||
The plugin counts either the `<p>` elements or the `<div>` elements of a book as its paragraphs. Bindery
|
||||
counts each paragraph that a reader sees:
|
||||
|
||||
- Text starts a paragraph after a `<br>`, and after the start or the end of a block element such as `<p>`,
|
||||
`<div>`, `<li>` or a heading.
|
||||
- A run of `<br>` elements is one paragraph break.
|
||||
- An element that only holds other blocks is not a paragraph.
|
||||
- The cells of a table row share one line.
|
||||
- A paragraph with no text is not counted. This includes a paragraph that holds only a no-break space,
|
||||
which some stories put between paragraphs as a blank line.
|
||||
|
||||
So the same text gives the same count as `<p>` elements, as `<div>` elements, and as lines with `<br>`
|
||||
between them. For a book that uses `<p>` elements and has no empty paragraphs, the count is within about 1%
|
||||
of the count of the plugin. The plugin counts each empty paragraph as a line, so its count is higher for a
|
||||
book that has many of them.
|
||||
The count is an estimate and differs from the page count of a printed book.
|
||||
|
||||
## Replacement rules
|
||||
|
||||
A rule is a regular expression, a replacement and optional flags (`i`, `s`, `m`, `x`). Bindery uses
|
||||
|
||||
Reference in New Issue
Block a user