Habitual

Guide

Make an EPUB that Habitual can read

Habitual can import a year of daily readings as one EPUB file and read it with no signal: the day's text, Listen, a theme line in the morning nudge, and an optional weekly reading. Any EPUB whose chapters are titled by date works. This page lists what the app looks for. The sample almanac editions use every piece; unzip one to see a working example.

1. One chapter per day, titled by its date

Each day is its own XHTML file in the book's reading order (the spine). The app takes the date from the chapter's <title>, or failing that its first <h2>, then its first <h1>. These forms are understood, in English or the phone's language:

When the titles carry no year, the app takes it from the book's dc:date, then from a four-digit year in the book's title. Chapters with no date (a title page, notes) are fine and are skipped as days.

2. Theme line, body and citation

<h2>Thursday, January 1</h2>
<p class="themeScrp">One line that sums up the day</p>
<div class="bodyTxt">
  <p>The day's text, in as many paragraphs as you like.</p>
  <p>Farmer's Calendar, January 1923</p>
</div>

3. References (optional)

A link from a day's chapter to another page of the book that is not itself a day, such as <a href="notes-january.xhtml">, brings that page's text in under the day, so it can be read without leaving it.

4. A weekly reading (optional)

One undated chapter can hold a schedule: a heading for each month, each followed by a list. Every item starts with the day of the month its week begins, then what to read, and links to that week's text in the same chapter. At least two months must be listed.

<h2>January</h2>
<ul>
  <li><a href="#week-1">5</a> Old Farmer 1-2</li>
  <li><a href="#week-2">12</a> Old Farmer 3-4</li>
</ul>

<div id="week-1">
  <p><sup>1</sup>First sentence. <sup>2</sup>Second sentence.</p>
  <p><strong>2</strong> <sup>1</sup>The next numbered section begins.</p>
</div>

The label is a name followed by section numbers. In the text, each paragraph after the first opens with its section number in bold, and the parts within it are numbered as superscripts. The app cuts each week into daily portions at those numbers, so give a week at least seven of them. Once a file with a schedule is imported, the weekly reading can be switched on as a stop of its own.

5. Put it together

An EPUB is a ZIP file with a fixed layout. Any EPUB editor makes one, such as Sigil or Calibre. By hand, it takes three parts:

Zip it with mimetype first and uncompressed:

zip -X0 my-year.epub mimetype
zip -Xr9D my-year.epub META-INF OEBPS

EPUBCheck reports anything malformed.

6. Import it

In Habitual, open Settings, Texts, and the text the file belongs to. Under Import, choose the file from Files, or paste its web address and tap Download and import. Importing the same year again replaces it. The file stays on that phone.

If you publish a file each year at an address that includes the year, put that address under Next year with {yyyy} for the four-digit year or {yy} for two digits, for example https://example.org/readings-{yyyy}.epub. The app then offers to download the current year's file when it is missing and, from November 1, tells you once when next year's is there. Nothing downloads until you tap.