"""Original miniature book used for Luna full-book forward testing. Pass an output directory.""" from ebooklib import epub from pathlib import Path import sys OUT = Path(sys.argv[1]) if len(sys.argv) > 1 else Path('.work/luna-fixture') OUT.mkdir(parents=True, exist_ok=True) book = epub.EpubBook() book.set_identifier('urn:uuid:6a7c4302-c2ab-4e0d-b385-luna-test-2026') book.set_title('The Lantern Ledger: A Small Book About Big Decisions') book.set_language('en') book.add_author('Mira Vale') book.add_metadata('DC', 'description', 'An original miniature nonfiction-style book created for a complete EPUB translation workflow test.') book.add_metadata('DC', 'publisher', 'Fieldglass Press') book.add_metadata('DC', 'date', '2026') book.add_metadata('DC', 'rights', 'Copyright © 2026 Mira Vale. All rights reserved.') style = '''body { font-family: serif; line-height: 1.45; } h1 { margin-top: 1.8em; } .opening { font-size: 1.08em; } .caption { font-size: .9em; font-style: italic; } .small { font-size: .85em; }''' css = epub.EpubItem(uid='style', file_name='style/book.css', media_type='text/css', content=style) book.add_item(css) svg = '''''' img = epub.EpubItem(uid='lantern-art', file_name='images/lantern.svg', media_type='image/svg+xml', content=svg) book.add_item(img) def page(uid, title, body, file_name=None): item = epub.EpubHtml(title=title, file_name=file_name or f'{uid}.xhtml', lang='en', uid=uid) item.content = f'''
A Small Book About Big Decisions
by Mira Vale
An original translation-workflow test edition
''') intro = page('opening-note', 'Opening Note', '''At dusk, a room can make a plan look smaller than it is. The table holds one lamp, three cups, and a map whose edges curl upward. Outside, rain edits the street into reflections.
This little book follows the work of deciding: how people gather evidence, choose a direction, and explain what they have chosen. Its scenes are deliberately compact, but every section belongs to the complete book.
Names and examples appear here to exercise translation details. The imagined scenes are not reports of actual meetings.
''') p1c1 = page('ch1', 'Part I · The Signal', '''The Signal
The first clue was not a number. It was a question pencilled beside a number: “What would make this true?”
At the fictional company Northstar Works, analyst Lena Park kept a ledger of claims and their sources. She did not distrust confident people; she simply wanted confidence to leave a trail.
When the team discussed a distant market, one slide showed a steep line climbing into the future. Lena wrote down the assumptions beneath it: customers would arrive, costs would fall, and the calendar would behave.
That last assumption made everyone laugh. Then they checked it.
A useful forecast, she said, is not a promise. It is a map of what must happen for a promise to become plausible.
Her margin question traveled from the meeting room to the workshop wall, where it stayed long after the slide was replaced.
''') p1c2 = page('ch2', 'Part I · The Signal', '''In a translation exercise, a short name can carry a long shadow. A profile may introduce Masayoshi Son and later call him Masa. Those references point to one person; the shorter form is a familiar name, not a second executive.
Our fictional narrator imagines a conference hallway where an investor pauses at a hand-drawn chart. The point of the scene is not to claim that the encounter happened. It is to test whether a translator can preserve the distinction between a real public name and an invented setting.
“Keep the subject clear,” Lena tells a junior editor. “A pronoun should not make the reader guess which person is speaking.”
The editor adds a note to the style sheet: introduce the full name first, then use the established short form consistently.
''') p2c1 = page('ch3', 'Part II · The Choice', '''The Choice
A photograph can show a lamp, but it cannot show who paid the electricity bill.
When a picture enters a book, its caption becomes part of the argument. It identifies what the reader sees and, just as carefully, avoids claiming what the image cannot prove.
The team labels the illustration as a conceptual drawing. No real person or office is pictured. That short sentence protects the reader from mistaking atmosphere for evidence.
Lena places the image beside a paragraph about uncertainty. The lamp does not answer the question; it makes the question easier to see.
''') p2c2 = page('ch4', 'Part II · The Choice', '''A decision memo had one footnote: “The sample covers three districts, not the whole country.”1 Without that sentence, the chart looked broader than its evidence.
In review, Lena asked the writer to keep the note close to the claim. Readers should not have to search several pages to learn the boundary of a number.
The note did not weaken the recommendation. It made the recommendation precise enough to use.
At the bottom of the page, the editor added a return link so a reader could move from note to sentence and back again.
''') notes = page('notes', 'Notes', '''Photographs and captions, 10–11
''') rights = page('rights', 'Copyright', '''Copyright © 2026 Mira Vale.
All rights reserved. This original miniature book was written for software workflow evaluation. No portion is derived from an existing published book.
Illustration: “A light kept for the next decision,” created for this edition.
Published by Fieldglass Press, 2026.
''') book.toc = [ epub.Link('opening-note.xhtml', 'Opening Note', 'opening-note'), (epub.Section('Part I · The Signal'), [ epub.Link('ch1.xhtml', 'Chapter 1: A Question in the Margin', 'ch1'), epub.Link('ch2.xhtml', 'Chapter 2: The Name on the Door', 'ch2'), ]), (epub.Section('Part II · The Choice'), [ epub.Link('ch3.xhtml', 'Chapter 3: What the Photograph Leaves Out', 'ch3'), epub.Link('ch4.xhtml', 'Chapter 4: The Small Print', 'ch4'), ]), epub.Link('notes.xhtml', 'Notes', 'notes'), epub.Link('index.xhtml', 'Index', 'index'), epub.Link('rights.xhtml', 'Copyright', 'rights'), ] book.spine = [cover, intro, p1c1, p1c2, p2c1, p2c2, notes, index, rights] book.add_item(epub.EpubNcx()) # The title page is the opening spine item; the illustration appears in Chapter 3. outfile = OUT / 'source.epub' epub.write_epub(str(outfile), book) print(outfile)