Skip to content

Plain Text Mode silently drops <hr> scene separators (EPUB) #254

Description

@May47N

Symptom

In Plain Text Mode, <hr> elements are removed from the output EPUB and
nothing is put in their place. In fiction they usually mark a scene break, so
two unrelated scenes end up running together as continuous prose.

Measurement

One book, 78 XHTML files: 416 <hr> elements in the source, 0 in the
translated output.
No textual substitute either — no ---, *** or similar
line appears anywhere in the result.

They are load-bearing in this book. Two examples of what sits on either side
of one:

  • a dialogue scene ends, <hr>, then the character is packing in a different
    place at a different time
  • a scene ends, <hr>, then the very next paragraph names a different POV
    character and the narration switches to first person as someone else

The second case is the painful one: without the break the reader hits an "I"
that belongs to a different narrator and needs a paragraph or two to work out
what happened.

Cause

src/core/epub/plain_extractor.py:

  • BLOCK_TAGS = p, h1–h6, li, blockquote, pre — no hr
  • DROP_TAGS = svg, video, audio, iframe, form, script, style — no hr
  • CONTAINER_TAGS — no hr

So <hr> is never collected, and since the body is rebuilt from collected
blocks only, it disappears. It is not an explicit drop decision — it just
falls through.

Worth noting the comment right above DROP_TAGS: tables, figures and pictures
are deliberately not dropped, "otherwise that content would be silently
deleted from the output". A scene separator seems to fall under the same
principle.

Suggested direction

<hr> carries no text, so it does not need to reach the model. It only needs
to survive reassembly — e.g. treated as a void block that is re-emitted at its
original position, the way <img> elements are already anchored.

Config

  • v1.5.4, Docker, Plain Text Mode enabled
  • OpenRouter, mistralai/mistral-medium-3.1, English → Russian
  • MAX_TOKENS_PER_CHUNK=1800, PARALLEL_TRANSLATIONS=1

Same book as #253, different problem — filing separately since the mechanism
is unrelated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions