Standard Ebooks

Producing an Ebook, Step by Step

This guide is meant to take you step-by-step through the creation of a complete Standard Ebook. While it might seem a little long, most of the text is a description of how to use various automated scripts. It can take just an hour or two for an experienced producer to produce a draft ebook for proofreading (depending on the complexity of the ebook, of course).

Our toolset is GNU/Linux-based, and producing an ebook from scratch currently requires working knowledge of the epub file format and of Unix-like systems like Mac or Linux.

Our toolset doesn’t yet work natively on Windows, but there are many ways to run Linux from within Windows.

If you don’t have this kind of technical expertise, you can still contribute! Check out our contributors page for details.

  1. Set up the Standard Ebooks toolset and make sure it’s up-to-date

    The Standard Ebooks project has a toolset that will help you produce an ebook. The toolset installs the se command, which has various subcommands related to creating Standard Ebooks. You can read the complete installation instructions, or if you already have pipx installed, run:

    pipx install standardebooks

    The toolset changes frequently, so if you’ve installed the toolset in the past, make sure to update the toolset before you start a new ebook:

    pipx upgrade standardebooks

    Once the toolset is installed, you can check which version you have with:

    se --version
  2. Select an ebook to produce

    The best place to look for public domain ebooks to produce is Project Gutenberg. If downloading from Gutenberg, be careful of the following:

    • There may be different versions of the same publication on Gutenberg, and the best one might not be the one with the most downloads. In particular, there could be a better translation that has fewer downloads because it was produced later, or there could be a version with better HTML markup. A great example of this phenomenon is the Gutenberg version of 20,000 Leagues Under the Seas. The most-downloaded version is an old translation widely criticized as being slapdash and inaccurate. The less popular version is a fresh, modern translation dedicated to the public domain.

    • Gutenberg usually offers both an HTML version and an epub version of the same ebook. Note that one is not always exactly the same as the other! A casual reader might assume that the HTML version is generated from the epub version, or the other way around; but for some reason the HTML and epub versions often differ in important ways, with the HTML version typically using fewer useless CSS classes, and including <em> elements that the epub version is often missing.

    Picking either the HTML or the epub version is fine as a starting point, but make sure to pick the one that appears to be the most accurate.

    For this guide, we’ll use The Strange Case of Dr. Jekyll and Mr. Hyde, by Robert Louis Stevenson. If you search for it on Gutenberg, you’ll find that there are two versions; the most popular one is a poor choice to produce, because the transcriber included the page numbers smack in the middle of the text! What a pain those’d be to remove. The less popular one is a better choice to produce, because it’s a cleaner transcription.

  3. Locate page scans of your book online

    As you produce your book, you’ll want to check your work against the actual page scans. Often the scans contain formatting that is missing from the source transcription. For example, older transcriptions sometimes throw away italics entirely, and you’d never know unless you looked at the page scans. So finding page scans is essential.

    Below are some good sources for page scans:

    Each of those sources allows you to filter results by publication date, so make sure you select 1925 and earlier to ensure they’re in the U.S. public domain.

    If you can’t find scans of your book at the above sources, and you’re using a Project Gutenberg transcription as source material, there’s a good chance that PGDP (the sister project of Project Gutenberg that does the actual transcriptions) has a copy of the scans they used accessible in their archives. You should only use the PGDP archives as a last resort; because their scans are not searchable, verifying typos becomes extremely time-consuming.

    Please keep the following important notes in mind when searching for page scans:

    • Make sure the scans you find are published in 1925 or earlier. You must verify the copyright page in the page scans before proceeding.

    • Often you’ll find different editions, published at different times by different publishers, for the same book. It’s worth the effort to quickly browse through each different one to get an idea of the kinds of changes the different publishers introduced. Maybe one edition is better than another!

    You’ll enter a link to the page scans you used in the content.opf metadata as a <dc:source> element.

  4. Create a Standard Ebooks epub skeleton

    An epub file is just a bunch of files arranged in a particular folder structure, then all zipped up. That means editing an epub file is as easy as editing a bunch of text files within a certain folder structure, then creating a zip file out of that folder.

    You can’t just arrange files willy-nilly, though—the epub standard expects certain files in certain places. So once you’ve picked a book to produce, create the basic epub skeleton in a working directory. se create-draft will create a basic Standard Ebooks epub folder structure, initialize a Git repository within it, and prefill a few fields in content.opf (the file that contains the ebook’s metadata).

    1. With the --pg-url option

      You can pass se create-draft the URL for the Project Gutenberg ebook, and it’ll try to download the ebook into ./src/epub/text/body.xhtml and prefill a lot of metadata for you:

      se create-draft --author="Robert Louis Stevenson" --title="The Strange Case of Dr. Jekyll and Mr. Hyde" --pg-url="" cd robert-louis-stevenson_the-strange-case-of-dr-jekyll-and-mr-hyde/

      Because Project Gutenberg ebooks are produced in different ways by different people, se create-draft has to make some guesses and it might guess wrong. Make sure to carefully review the data it prefills into ./src/epub/text/body.xhtml, ./src/epub/text/colophon.xhtml, and ./src/epub/content.opf.

      In particular, make sure that the Project Gutenberg license is stripped from ./src/epub/text/body.xhtml, and that the original transcribers in ./src/epub/text/colophon.xhtml and ./src/epub/content.opf are presented correctly.

    2. Without the --pg-url option

      If you prefer to do things by hand, that’s an option too.

      se create-draft --author="Robert Louis Stevenson" --title="The Strange Case of Dr. Jekyll and Mr. Hyde" cd robert-louis-stevenson_the-strange-case-of-dr-jekyll-and-mr-hyde/

      Now that we have the skeleton up, we’ll download Gutenberg’s HTML file for Jekyll directly into text/ folder and name it body.xhtml.

      wget -O src/epub/text/body.xhtml ""

      Many Gutenberg books were produced before UTF-8 became a standard, so we may have to convert to UTF-8 before we start work. First, check the encoding of the file we just downloaded. (Mac OS users, try file -I.)

      file -bi src/epub/text/body.xhtml

      The output is text/html; charset=iso-8859-1. That’s the wrong encoding!

      We can convert that to UTF-8 with iconv:

      iconv --from-code="ISO-8859-1" --to-code="UTF-8" < src/epub/text/body.xhtml > src/epub/text/tmp mv src/epub/text/tmp src/epub/text/body.xhtml
  5. Do a rough cleanup of the source text and perform the first commit

    If you inspect the folder we just created, you’ll see it looks something like this:

    A tree view of a new Standard Ebooks draft folder

    You can learn more about what the files in a basic Standard Ebooks source folder are all about before you continue.

    Now that we’ve got the source text, we have to do some very broad cleanup before we perform our first commit:

    • Remove the header markup and everything, including any Gutenberg text and the work title, up to the beginning of the actual public domain text. We’ll add our own header markup to replace what we’ve removed later.

      Jekyll doesn’t include front matter like an epigraph or introduction; if it did, that sort of stuff would be left in, since it’s part of the main text.

    • This edition of Jekyll includes a table of contents; remove that too. Standard Ebooks uses the ToC generated by the ereader, and doesn’t include one in the readable text.

    • Remove any footer text and markup after the public domain text ends. This includes the Gutenberg license—but don’t worry, we’ll credit Gutenberg in the colophon and metadata later. If you invoked se create-draft with the --pg-url option, then it may have already stripped the license for you and included some Gutenberg metadata.

    Now our source file looks something like this:

    <h2> STORY OF THE DOOR </h2> <p> Mr. Utterson the lawyer was a man of a rugged countenance that was never lighted by a smile; cold, scanty and embarrassed in discourse; backward in <!--snip all the way to the end...--> proceed to seal up my confession, I bring the life of that unhappy Henry Jekyll to an end. </p>

    Now that we’ve removed all the cruft from the top and bottom of the file, we’re ready for our first commit.

    Please use the following commit message for consistency with the rest of our ebooks:

    git add -A git commit -m "Initial commit"
  6. Split the source text at logical divisions

    The file we downloaded contains the entire work. Jekyll is a short work, but for longer work it quickly becomes impractical to have the entire text in one file. Not only is it a pain to edit, but ereaders often have trouble with extremely large files.

    The next step is to split the file at logical places; that usually means at each chapter break. For works that contain their chapters in larger “parts,” the part division should also be its own file. For example, see Treasure Island.

    To split the work, we use se split-file. se split-file takes a single file and breaks it in to a new file every time it encounters the markup <!--se:split-->. se split-file automatically includes basic header and footer markup in each split file.

    Notice that in our source file, each chapter is marked with an <h2> tag. We can use that to our advantage and save ourselves the trouble of adding the <!--se:split--> markup by hand:

    perl -pi -e "s|<h2|<\!--se:split--><h2|g" src/epub/text/body.xhtml

    (Note the slash before the ! for compatibility with some shells.)

    Now that we’ve added our markers, we split the file. se split-file puts the results in our current directory and conveniently names them by chapter number.

    se split-file src/epub/text/body.xhtml mv chapter* src/epub/text/

    Once we’re happy that the source file has been split correctly, we can remove it.

    rm src/epub/text/body.xhtml
  7. Clean up the source text

    If you open up any of the chapter files we now have in the src/epub/text/ folder, you’ll notice that the code isn’t very clean. Paragraphs are split over multiple lines, indentation is all wrong, and so on.

    If you try opening a chapter in a web browser, you’ll also likely get an error if the chapter includes any HTML entities, like &mdash;. This is because Gutenberg uses plain HTML, which allows entities, but epub uses XHTML, which doesn’t.

    We can fix all of this pretty quickly using se clean. se clean accepts as its argument the root of a Standard Ebook directory. We’re already in the root, so we pass it ..

    se clean .

    Finally, we have to do a quick runthrough of each file by hand to cut out any lingering Gutenberg markup that doesn’t belong. In Jekyll, notice that each chapter ends with some extra empty <div>s and <p>s. These were used by the original transcriber to put spaces between the chapters, and they’re not necessary anymore, so remove them before continuing.

    Now our chapter 1 source looks like this:

    <?xml version="1.0" encoding="utf-8"?> <html xmlns="" xmlns:epub="" epub:prefix="z3998:, se:" xml:lang="en-US"> <head> <title>Chapter 1</title> <link href="../css/core.css" rel="stylesheet" type="text/css"/> <link href="../css/local.css" rel="stylesheet" type="text/css"/> </head> <body epub:type="bodymatter z3998:fiction"> <section id="chapter-1" epub:type="chapter"> <h2>STORY OF THE DOOR</h2> <p>Mr. Utterson the lawyer was a man of a rugged countenance...</p> <!--snip all the way to the end...--> <p>"With all my heart," said the lawyer. "I shake hands on that, Richard."</p> </section> </body> </html>

    If you look carefully, you’ll notice that the <html> tag has the xml:lang="en-US" attribute, even though our source text uses British spelling! We have to change the xml:lang attribute for the source files to match the actual language, which in this case is en-GB. Let’s do that now:

    perl -pi -e "s|en-US|en-GB|g" src/epub/text/chapter*

    Note that we don’t change the language for the metadata or front/back matter files, like content.opf, titlepage.xhtml, or colophon.xhtml. Those must always be in American spelling, so they’ll always have the en-US language tag.

  8. Typogrify the source text and perform the second commit

    Now that we have a clean starting point, we can start getting the real work done. se typogrify can do a lot of the heavy lifting necessary to bring an ebook up to Standard Ebooks typography standards.

    Like se clean, se typogrify accepts as its argument the root of a Standard Ebook directory.

    se typogrify .

    Among other things, se typogrify does the following:

    • Converts straight quotes to curly quotes;

    • Adds no-break spaces where appropriate for some common abbreviations;

    • Normalizes ellipses;

    • Normalizes spacing in em-, en-, and double-em-dashes, as well as between nested quotation marks, and adds word joiners.

    While se typogrify does a lot of work for you, each ebook is totally different so there’s almost always more work to do that can only be done by hand. In Jekyll, you’ll notice that the chapter titles are in all caps. The S.E. standard requires chapter titles to be in title case, and se titlecase can do that for us.

    se titlecase accepts a string as its argument, and outputs the string in title case. Many text editors allow you to configure external macros—perfect for creating a keyboard shortcut to run se titlecase on selected text.

    Typography checklist

    There are many things that se typogrify isn’t well suited to do automatically. Check our complete typography manual to see exactly how to format the work. Below is a brief, but incomplete, list of common issues that arise in ebooks:

    • Elision. (i.e., &rsquo;) is used for elided letters in a word. se typogrify often gets this wrong, and you need to review your ebook by hand to ensure it didn't insert (&lsquo;) instead.

      Use this regex to examine potential candidates for correction: \s‘[a-z]

    • Coordinates. Use the prime and double prime glyphs for coordinates. These regexes helps match and replace coordinates:

      sed --regexp-extended --in-place "s|([0-9])+’|\1′|g" src/epub/text/* sed --regexp-extended --in-place "s|([0-9])+”|\1″|g" src/epub/text/*
    • Text in all caps. Text in all caps is almost never correct, and should either be converted to lowercase with the <em> tag (for spoken emphasis), <strong> (for extreme spoken emphasis), or <b> (for unsemantic small caps, like in storefront signs). This case-sensitive regex helps find candidates: (?<!en-)(?<!z3998:roman">)(?<![A-Z])[A-Z]{2,}(?!")

    • Sometimes se typogrify doesn’t close quotation marks near em-dashes correctly. Try to find such instances with this regex: —[’”][^<\s]

    • Two-em dashes should be used for elision.

    • Commas and periods should generally be inside quotation marks, not outside. This command helps find and replace them:

      se interactive-sr "/\v([’”])([,.])/\2\1/" src/epub/text/*

      When using this command, be careful to distinguish between the use of as a quotation mark and its use in elision or as part of a plural possessive (i.e. s’).

      Correct change:

      “Let’s have a game of ‘noses’, lads!”

      “Let’s have a game of ‘noses,’ lads!”

      Incorrect change:

      This wood now is not mine, but the peasants’.

      This wood now is not mine, but the peasants.’

    The second commit

    Once you’ve run se typogrify and you’ve searched the work for the common issues above, you can perform your second commit.

    git add -A git commit -m "Typogrify"
  9. Convert footnotes to endnotes and add a list of illustrations

    Works often include footnotes, either added by an annotator or as part of the work itself. Since ebooks don’t have a concept of a “page,” there’s no place for footnotes to go. Instead, we convert footnotes to a single endnotes file, which will provide popup references in the final epub.

    The endnotes file and the format for endnote links are standardized in the semantics manual.

    If you find that you accidentally mis-ordered an endnote, never fear! se reorder-endnotes will allow you to quickly rearrange endnotes in your ebook.

    If a work has illustrations besides the cover and title pages, we include a “list of illustrations” at the end of the book, after the endnotes but before the colophon. The LoI file is also standardized in the semantics manual.

    Jekyll doesn’t have any footnotes, endnotes, or illustrations, so we skip this step.

  10. Converting British quotation to American quotation

    If the work you’re producing uses British quotation style (single quotes for dialog versus double quotes in American), we have to convert it to American style. We use American style in part because it’s easier to programmatically convert from American to British than it is to convert the other way around. Skip this step if your work is already in American style.

    se british2american attempts to automate the conversion. Your work must already be typogrified (the previous step in this guide) for the script to work.

    se british2american .

    While se british2american tries its best, thanks to the quirkiness of English punctuation rules it’ll invariably mess some stuff up. Proofreading is required after running the conversion.

    After you’ve run the conversion, do another commit.

    git commit -am "Convert from British-style quotation to American style"

    This regex is useful for spotting incorrectly converted quotes next to em dashes: “[^”‘]+’⁠—(?=[^”]*?</p>;)

  11. Add semantics

    Part of the Standard Ebooks project is adding meaningful semantics wherever possible in the text. se semanticate does a little of that for us—for example, for some common abbreviations—but much of it has to be done by hand.

    Adding semantics means two things:

    1. Using meaningful tags to mark up the work: <em> when conveying emphatic speech instead of <i>, <abbr> to wrap abbreviations, <section> to mark structural divisions, using the xml:lang attribute to specify the language of a word or passage, and so on.

    2. Using the epub3 semantic inflection language to add deeper meaning to tags.

      Currently we use a mix of epub3 structural semantics, z3998 structural semantics for when the epub3 vocabulary isn’t enough, and our own S.E. semantics for when z3998 isn’t enough.

    Use se semanticate to do some common cases for you:

    se semanticate .

    se semanticate tries its best to correctly add semantics, but sometimes it’s wrong. For that reason you should review the changes it made before accepting them:

    git difftool

    Beyond that, adding semantics is mostly a by-hand process. See the Standard Ebooks Manual of Style for a detailed list of the kinds of semantics we expect in a Standard Ebook.

    Here’s a short list of some of the more common semantic issues you’ll encounter:

    • Semantics for italics: <em> should be used for when a passage is emphasized, as in when dialog is shouted or whispered. <i> is used for all other italics, with the appropriate semantic inflection. Older transcriptions usually use just <i> for both, so you must change them manually if necessary.

      Sometimes, transcriptions from Project Gutenberg may use ALL CAPS instead of italics. To replace these, you can use sed:

      sed --regexp-extended --in-place "s|[A-Z’]{2,}|<em>\L\1</em>|g" src/epub/text/*

      This will unfortunately replace language tags like en-US, so fix those up with this:

      sed --regexp-extended --in-place "s|en-<em>([a-z]+)</em>|en-\U\1|g" src/epub/text/*

      These replacements don’t take Title Caps into account, so use git diff to review the changes and fix errors before committing.

    • Semantics rules for chapter titles.

    • Semantics rules for abbreviations. Abbreviations should always be wrapped in the <abbr> tag and with the correct class attribute.

      Specifically, see the typography rules for initials. Wrap people’s initials in <abbr class="name">. This regex helps match initials: [A-Z]\.\s*([A-Z]\.\s*)+

    • Typography rules for times. Wrap a.m. and p.m. in <abbr class="time"> and add a no-break space between digits and a.m. or p.m.

    • Words or phrases in foreign languages should always be marked up with <i xml:lang="TAG">, where TAG is an IETF language tag. This app can help you look them up. If the text uses fictional or unspecific languages, use the “x-” prefix and make up a subtag yourself.

    • Semantics for poetry, verse, and song: Many Gutenberg productions use the <pre> tag to format poetry, verse, and song. This is, of course, semantically incorrect. See the Poetry section of the SEMOS for templates on how to semantically format poetry, verse, and song.

    After you’ve added semantics according to the Standard Ebooks Manual of Style, do another commit.

    git commit -am "Semanticate"
  12. Set <title> elements

    After you’ve added semantics and correctly marked up section headers, it’s time to update the <title> elements in each chapter to match their expected values.

    The se print-title tool takes a well-marked-up section header from a file, and prints the expected value for the <title> element to the terminal. It also has the --in-place option, which will allow us to update all the chapters at once:

    se print-title --in-place src/epub/text/*

    Once you’ve verified the titles look good, commit:

    git commit -am "Add titles"
  13. Modernize spelling and hyphenation

    Many older works use outdated spelling and hyphenation that would distract a modern reader. (For example, “to-night” instead of “tonight”). se modernize-spelling automatically removes hyphens from words that used to be compounded, but aren’t anymore in modern English spelling.

    Do run this tool on prose. Don’t run this tool on poetry.

    se modernize-spelling .

    After you run the tool, you must check what the tool did to confirm that each removed hyphen is correct. Sometimes the tool will remove a hyphen that needs to be included for clarity, or one that changes the meaning of the word, or it may result in a word that just doesn’t seem right. Re-introducing a hyphen is OK in these cases.

    Here’s a real-world example of where se modernize-spelling made the wrong choice: In The Picture of Dorian Gray chapter 11, Oscar Wilde writes:

    He possessed a gorgeous cope of crimson silk and gold-thread damask…

    se modernize-spelling would replace the dash in gold-thread so that it reads goldthread. Well goldthread is an actual word, which is why it’s in our dictionary, and why the script makes a replacement—but it’s the name of a type of flower, not a golden fabric thread! In this case, se modernize-spelling made an incorrect replacement, and we have to change it back.

    git usually compares changes line-by-line, but since lines an ebook can be very long, a line-level comparison can make spotting small changes difficult. Intead of just doing git diff, try the following command to highlight changes at the character level:

    git diff -U0 --word-diff-regex=.

    You can also enable color in your git output to make the output of that command more readable, and even assign it to a shortcut in your git configuration.

    Alternatively, you can use an external diff GUI to review changes:

    git difftool

    After you’ve reviewed the changes that the tool made, create an “[Editorial]” commit. This commit is important, because it gives purists an avenue to revert modernizing changes to the original text.

    Note how we preface this commit with “[Editorial]”. Any change you make to the source text that can be considered a modernization or editorial change should be prefaced like this, so that the git history can be easily searched by people looking to revert changes.

    git commit -am "[Editorial] Modernize hyphenation and spelling"
  14. Check for consistent diacritics

    Sometimes during transcription or even printing, instances of some words might have diacritics while others don’t. For example, a word in one chapter might be spelled châlet, but in the next chapter it might be spelled chalet.

    se find-mismatched-diacritics lists these instances for you to review. Spelling should be normalized across the work so that all instances of the same word are spelled in the same way. Keep the following in mind as you review these instances:

    • In modern English spelling, many diacritics are removed (like chalet). If in doubt, ask the S.E. Editor-in-Chief.

    • Even though diacritics might be removed in English spelling, they may be preserved in non-English text, or in proper names.

      He visited the hotel called the Châlet du Nord.

  15. Modernize spacing in select words

    Over time, spelling of certain common two-word phrases has evolved into a single word. For example, “someone” used to be the two-word phrase “some one,” which would read awkwardly to modern readers. This is our chance to modernize such phrases.

    Note that we use se interactive-sr to perform an interactive search and replace, instead of doing a global, non-interactive search and replace. This is because some phrases caught by the regular expression should not be changed, depending on context. For example, "some one" in the following snippet from Anton Chekhov’s short fiction should not be corrected:

    He wanted to think of some one part of nature as yet untouched...

    When running se interactive-sr, press y to accept a replacement and n to reject a replacement.

    Use the following regular expression invocations to correct a certain set of such phrases:

    • Correct change:

      She asked some one on the street. ➔

      She asked someone on the street.

      Incorrect change:

      But every clever crime is founded ultimately on some one quite simple fact⁠. ➔

      But every clever crime is founded ultimately on someone quite simple fact⁠.

      se interactive-sr "/\v([Ss])ome one/\1omeone/" src/epub/text/* git commit -am "[Editorial] some one -> someone"
    • Correct change:

      “Any one else on this floor?” he asked. ➔

      “Anyone else on this floor?” he asked.

      Incorrect change:

      It is not easy to restore lost property to any one of them. ➔

      It is not easy to restore lost property to anyone of them.

      se interactive-sr "/\v(<[Aa])ny one/\1nyone/" src/epub/text/* git commit -am "[Editorial] any one -> anyone"
    • Correct change:

      He was furious⁠—furious with himself, furious with every one. ➔

      He was furious⁠—furious with himself, furious with everyone.

      Incorrect change:

      I’m sure we missed ten for every one we saw. ➔

      I’m sure we missed ten for everyone we saw.

      se interactive-sr "/\v([Ee]ach and )@<\!([Ee])very one(\s+of)@\!/\2veryone/" src/epub/text/* git commit -am "[Editorial] every one -> everyone"
    • Correct change:

      Equip a ship with every thing apt for naval battle. ➔

      Equip a ship with everything apt for naval battle.

      Incorrect change:

      For there was no one more clever than he to do a hand’s turn at any and every thing. ➔

      For there was no one more clever than he to do a hand’s turn at any and everything.

      se interactive-sr "/\v([Ee])very thing/\1verything/" src/epub/text/* git commit -am "[Editorial] every thing -> everything"
    • Correct change:

      If you have any thing to say to us say it quickly. ➔

      If you have anything to say to us say it quickly.

      Incorrect change:

      Any man or any thing who faces me during these games, dies. ➔

      Any man or anything who faces me during these games, dies.

      se interactive-sr "/\v(<[Aa])ny thing/\1nything/" src/epub/text/* git commit -am "[Editorial] any thing -> anything"
    • Correct change:

      No; perhaps you will love her for ever. ➔

      No; perhaps you will love her forever.

      Incorrect change:

      I have been struggling on for ever so long without doing anything. ➔

      I have been struggling on forever so long without doing anything.

      se interactive-sr "/\v([Ff])or ever(>)/\1orever\2/" src/epub/text/* git commit -am "[Editorial] for ever -> forever"
    • Correct change:

      Not all, of course, but any way it is much better than the life here. ➔

      Not all, of course, but anyway it is much better than the life here.

      Incorrect change:

      And I’m not at fault in any way, and there’s no need for me to suffer. ➔

      And I’m not at fault in anyway, and there’s no need for me to suffer.

      se interactive-sr "/\v(in\s+)@<\!(<[Aa])ny way(\s+(of|to))@\!/\2nyway/" src/epub/text/* git commit -am "[Editorial] any way -> anyway"
    • Correct change:

      And in the mean time, he’ll also keep on being a laughing stock? ➔

      And in the meantime, he’ll also keep on being a laughing stock?

      Incorrect change:

      You’ve had an awful mean time, Ethan Frome. ➔

      You’ve had an awful meantime, Ethan Frome.

      se interactive-sr "/\v([Mm])ean time/\1eantime/" src/epub/text/* git commit -am "[Editorial] mean time -> meantime"
  16. Create the cover image

    Cover images for Standard Ebooks books have a standardized layout. The bulk of the work you’ll be doing is locating a suitable public domain painting to use. See the Art and Images section of the Standard Ebooks Manual of Style for details on assembling a cover image.

    As you search for an image, keep the following in mind:

    • Cover images must be in the public domain. Thanks to quirks in copyright law, this is harder to decide for paintings than it is for published writing. In general, Wikipedia is a good starting point for deciding if a work is in the public domain, but very careful research is required to confirm that status.

    • Find the largest possible cover image you can. Since the final image is 1400 × 2100, having to resize a small image will greatly reduce the quality of the final cover.

    • The image you pick should be a “fine art” oil painting so that all Standard Ebooks have a consistent cover style. This is actually easier than you think, because it turns out most public domain artwork is from the era of fine art.

    • You must provide proof of public domain status to the S.E. Editor-in-Chief in the form of a page scan of the painting from a 1925-or-older book, and the Editor-in-Chief must approve your selection before you can commit it to your repository.

    • The Standard Ebooks Editor-in-Chief has the final say on the cover image you pick, and it may be rejected for, among other things, poor public domain status research, being too low resolution, not fitting in with the “fine art” style, or being otherwise inappropriate for your ebook.

    What can we use for Jekyll? In 1885 Albert Edelfelt painted a portrait of Louis Pasteur in a laboratory. A crop of the lab equipment would be a good way to represent Dr. Jekyll’s lab.

    The cover file itself, cover.svg, is easy to edit. It automatically links to cover.jpg. All you have to do is open cover.svg with a text editor and edit the title and author. Make sure you have the League Spartan font installed on your system!

    After we’re done with the cover, we’ll have four files in ./images/:

    • cover.source.jpg is the raw image file we used for the cover. We keep it in case we want to make adjustments later. For Jekyll, this would be the raw Pasteur portrait downloaded from Wikipedia.

    • cover.jpg is the scaled cover image that cover.svg links to. This file is exactly 1400 × 2100. For Jekyll, this is a crop of cover.source.jpg that includes just the lab equipment, and resized up to our target resolution.

    • cover.svg is the completed cover image with the title and author. se build-images will take cover.svg, embed cover.jpg, convert the text to paths, and place the result in ./src/epub/images/ for inclusion in the final epub.

    • titlepage.svg is the completed titlepage image that se create-draft created for you.

  17. Create the titlepage image, build both the cover and titlepage, and commit

    Titlepage images for Standard Ebooks books are also standardized. See our the Art and Images section of the Standard Ebooks Manual of Style for details.

    se create-draft already created a completed titlepage for you. If the way it arranged the lines doesn’t look great, you can always edit the titlepage to make the arrangement of words on each line more aesthetically pleasing. Don’t use a vector editing program like Inkscape to edit it. Instead, open it up in your favorite text editor and type the values in directly.

    The source images for both the cover and the titlepage are kept in ./images/. Since the source images refer to installed fonts, and since we can’t include those fonts in our final ebook without having to include a license, we have to convert that text to paths for final distribution. se build-images does just that.

    se build-images .

    se build-images takes both ./images/cover.svg and ./images/titlepage.svg, converts text to paths, and embeds the cover jpg. The output goes to ./src/epub/images/.

    Once we built the images successfully, perform a commit.

    git add -A git commit -m "Add cover and titlepage images"
  18. Complete content.opf

    content.opf is the file that contains the ebook metadata like author, title, description, and reading order. Most of it will be filling in that basic information, and including links to various resources related to the text.

    The content.opf is standardized. See the Metadata section of the Standard Ebooks Manual of Style for details on how to fill out content.opf.

    As you complete the metadata, you’ll have to order the spine and the manifest in this file. Fortunately, Standard Ebooks has tools for that too: se print-manifest and se print-spine. Run these on our source directory and, as you can guess, they’ll print out the <manifest> and <spine> elements for this work.

    If you’re using a Mac, and thus the badly-behaved Finder program, you may find that it has carelessly polluted your work directory with useless .DS_Store files. Before continuing, you should find a better file manager program, then delete all of that litter with the following command. Otherwise, se print-manifest and se print-spine will include that litter in its output and your epub won’t be valid.

    find . -name ".DS_Store" -type f -delete

    Since this is the first time we’re editing content.opf, we’re OK with replacing both the manifest and spine elements with a guess at the correct contents. We can do this using the --in-place option. If we have to update the manifest or spine later, we can omit the option to print to standard output instead of altering content.opf directly.

    se print-manifest --in-place . se print-spine --in-place .

    The manifest is already in the correct order and doesn’t need to be edited. The spine, however, will have to be reordered to be in the correct reading order. Once you’ve done that, commit!

    git commit -am "Complete content.opf"
  19. Complete the table of contents

    The table of contents is a structured document that should let the reader easily navigate the book. In a Standard Ebook, it’s stored outside of the readable text directory with the assumption that the reading system will parse it and display a navigable representation for the user.

    Once you’ve completed the <spine> element in content.opf, you can use se print-toc to generate a table of contents for this ebook. Since this is the first time we’re generating a ToC for this ebook, use the --in-place flag to replace the template ToC file with the generated ToC.

    se print-toc --in-place .

    Review the generated ToC in ./src/epub/toc.xhtml to make sure se print-toc did the right thing. se print-toc is valuable tool to discover structural problems in your ebook. If an entry is arranged in a way you weren’t expecting, perhaps the problem isn’t with se print-toc, but with your HTML code—be careful! You may have to make changes by hand for complex or unusual books.

    Once you’re done, commit:

    git commit -am "Add ToC"
  20. Complete the colophon

    se create-draft put a skeleton colophon.xhtml file in the ./src/epub/text/ folder. Now that we have the cover image and artist, we can fill out the various fields there. Make sure to credit the original transcribers of the text (generally we assume them to be whoever’s name is on the file we download from Gutenberg) and to include a link back to the Gutenberg text we used, along with a link to any scans we used (from or, for example).

    You can also include your own name as the producer of this Standard Ebooks edition. Besides that, the colophon is standardized; don’t get too creative with it.

    The release and updated dates should be the same for the first release, and they should match the dates in content.opf. For now, leave them unchanged, as se prepare-release will automatically fill them in for you as we’ll describe later in this guide.

    git commit -am "Complete the colophon"
  21. Complete the imprint

    There’s also a skeleton imprint.xhtml file in the ./src/epub/text/ folder. All you’ll have to change here is the links to the transcription and page scans you used.

  22. Clean and lint before building

    Before you build the final ebook for you to proofread, it’s a good idea to check the ebook for some common problems you might run in to during production.

    First, run se clean one more time to both clean up the source files, and to alert you if there are XHTML parsing errors. Even though we ran se clean before, it’s likely that in the course of production the ebook got in to less-than-perfect markup formatting. Remember you can run se clean as many times as you want—it should always produce the same output.

    se clean .

    Now, run se lint. If your ebook has any problems, you’ll see some output listing them. If everything’s OK, then se lint will complete silently.

    se lint .
  23. Build and proofread, proofread, proofread!

    At this point we’re just about ready to build our proofreading draft! se build does this for us. We’ll run it with the --check flag to make sure the epub we produced is valid, and with the --kindle and --kobo flag to build a file for Kindles and Kobos too. If you won’t be using a Kindle or Kobo, you can omit those flags.

    se build --output-dir=$HOME/dist/ --kindle --kobo --check .

    If there are no errors, we’ll see five files in the brand-new ~/dist/ folder in our home directory:

    • the-strange-case-of-dr-jekyll-and-mr-hyde_advanced.epub is the zipped up version of our source. Unfortunately most ebook readers don’t fully support all of epub3’s capabilities yet, or the advanced CSS selectors and XHTML structure we use, so we’re more interested in…

    • the-strange-case-of-dr-jekyll-and-mr-hyde.epub, the compatible epub version of our ebook. This file is the raw source, plus various compatiblity fixes applied during our build process. If you don’t have a Kindle, this is the file you’ll be using to proofread.

    • the-strange-case-of-dr-jekyll-and-mr-hyde.kepub.epub is the Kobo version of our ebook. You can copy this to a Kobo using a USB cable.

    • the-strange-case-of-dr-jekyll-and-mr-hyde.azw3 is the Kindle version of our ebook. You can copy this to a Kindle using a USB cable.

    • thumbnail_xxxx_EBOK_portrait.jpg is a thumbnail file you can copy to your Kindle to have the cover art appear in your reader. A bug in Amazon’s software prevents the Kindle from reading cover images in side-loaded files; contact Amazon to complain.

    This is the step where you read the ebook and make adjustments to the text so that it conforms to our typography manual.

    All Standard Ebooks productions must be proofread at this stage to confirm that there are no typos, formatting errors, or typography errors. It’s extremely common for transcriptions sourced from Gutenberg to have various typos and formatting errors (like missing italics), and it’s also not uncommon for one of Standard Ebook’s tools to make the wrong guess about things like a closing quotation mark somewhere. As you proofread, it’s extremely handy to have a print copy of the book with you. For famous books that might just be a trip to your local library. For rarer books, or for those without a library nearby, there are several sites that provide free digital scans of public domain writing:

    If you end up using scans from one of these sources, you must mention it in the ebook’s colophon and as a <dc:source> item in content.opf.

    If you’re using a transcription from Project Gutenberg as the base for this ebook, you may wish to report typos you’ve found to them, so that they can correct their copy. Instructions for how to do so are here.

  24. Initial publication

    Now that we’ve proofread the work and corrected any errors we’ve found, we’re ready to release the finished ebook!

    It’s a good idea to run se typogrify and se clean one more time before releasing. Make sure to review the changes with git difftool before accepting them—se typogrify is usually right, but not always!

    • If you’re submitting your ebook to Standard Ebooks for review:

      Don’t run se prepare-release on an ebook you’re submitting for review!

      Contact the mailing list with a link to your GitHub repository to let them know you’re finished. A reviewer will review your production and work with you to fix any issues. They’ll then release the ebook for you.

    • If you’re producing this ebook for yourself, not for release at Standard Ebooks:

      Complete the initial publication by adding a release date, modification date, and final word count to content.opf and colophon.xhtml. se prepare-release does all of that for us.

      se prepare-release .

      With that done, we commit again using a commit message of “Initial publication” to signify that we’re all done with production, and now expect only proofreading corrections to be committed. (This may not actually be the case in reality, but it’s still a nice milestone to have.)

      git add -A git commit -m "Initial publication"

    Finally, build everything again.

    se build --output-dir=$HOME/dist/ --kindle --kobo --check .

    If the build completed successfully, congratulations! You’ve just finished producing a Standard Ebook!