https://bugs.documentfoundation.org/show_bug.cgi?id=141187

--- Comment #10 from Phil Stracchino <[email protected]> ---
(In reply to QA Administrators from comment #9)
> 
> To make sure we're focusing on the bugs that affect our users today,
> LibreOffice QA is asking bug reporters and confirmers to retest open,
> confirmed bugs which have not been touched for over a year.


I have just performed a fresh test export of my current novel-in-progress to
EPUB3 from LibreOffice.

Upon opening the resulting EPUB in Sigil, Sigil first warned me that the EPUB
contained HTML files that were 'not well formed or are missing a DOCTYPE, html,
head or body elements".  Viewing details, this applied to essentially all text
files in the EPUB including the toc.

I then compared the XHTML output to the source text.  The first bloc of Chapter
1 has the following text:


****

The cultists of Meshibal were a nasty lot.

It was widely known that they stole children; that they studied forbidden arts,
and summoned and bound demons for various purposes, none of them good; and
there was good reason to believe that they performed human sacrifices. 
Sacrifices above and beyond those unfortunate souls that they used as vessels
to hold summoned lesser demons, that is.

All of this was why Taren bore a letter of patent from the Syndic of Princes to
hunt them down, wherever and whenever he chanced to find them.  Alive was
acceptable, but in truth, dead was preferred.  It saved time, and prevented
ultimately-pointless arguments about which of the six Princes would bear the
costs of their incarceration and inevitable execution.

****


The first line above is bolded.  The words 'above and beyond' in the second
paragraph are oblique.  There is no other formatting.

LibreOffice 25.2.7.2's EPUB export generates the following HTML:


****

<p class="para15"><span class="span19">The cultists of Meshibal were a nasty
lot.</span></p>
<p class="para12"><span class="span12">It was </span><span
class="span12">widely</span><span class="span12"> known that they stole
children; that they </span><span class="span12">studied forbidden arts, and
</span><span class="span12">summoned and bound demons </span><span
class="span12">for various purposes, none of them good;</span><span
class="span12"> and there was good reason to believe </span><span
class="span12">that </span><span class="span12">they performed human
sacrifices. </span><span class="span12">&#160;</span><span
class="span12">Sacrifices </span><span class="span13">above and
beyond</span><span class="span12"> those unfortunate souls that they used
</span><span class="span12">as vessels </span><span class="span12">to hold
summoned </span><span class="span12">lesser </span><span class="span12">demons,
that is.</span></p>
<p class="para12"><span class="span12">All of this was why Taren bore a letter
of patent from the Syndic of Princes to hunt them down, </span><span
class="span12">wherever and whenever he chanced to find them</span><span
class="span12">. </span><span class="span12">&#160;</span><span
class="span12">Alive was </span><span class="span12">acceptable</span><span
class="span12">, but </span><span class="span12">in truth</span><span
class="span12">, dead was preferred. </span><span
class="span12">&#160;</span><span class="span12">It saved time, </span><span
class="span12">and prevented </span><span
class="span12">ultimately-</span><span class="span12">pointless arguments about
which </span><span class="span12">of the six P</span><span
class="span12">rince</span><span class="span12">s</span><span class="span12">
would bear the costs of </span><span class="span12">their</span><span
class="span12"> incarceration and </span><span class="span12">inevitable
</span><span class="span12">execution.</span></p>

****


The volume of SPAN tags exceeds the volume of actual text *by a factor of two*,
and more than 95% of the time it breaks a span to immediately begin a new span
*of the same class*.  The boundaries of every single edit become span breaks.

The same paragraph converted using Pandoc, after minimal hand-editing to
restore double spaces after periods,  looks like this:


****

    <p><b>The cultists of Meshibal were a nasty lot.</b></p>

    <p>It was widely known that they stole children; that they studied
forbidden arts, and summoned and bound demons for various purposes, none of
them good; and there was good reason to believe that they performed human
sacrifices.&#160; Sacrifices <i>above and beyond<i> those unfortunate souls
that they used as vessels to hold summoned lesser demons, that is.</p>

    <p>All of this was why Taren bore a letter of patent from the Syndic of
Princes to hunt them down, wherever and whenever he chanced to find them.&#160;
Alive was acceptable, but in truth, dead was preferred.&#160; It saved time,
and prevented ultimately-pointless arguments about which of the six Princes
would bear the costs of their incarceration and inevitable execution.</p>

****


I will give LibreOffice/libepubgen credit for using non-breaking spaces
(&#160;) to preserve double spaces, which pandoc does not.  However, it does it
slightly wrong, replacing a double space with ' &#160;' rather than with
'&#160; '.  This simple ordering change may seem an unimportant distinction,
but its importance is this:  ' &#160;' that comes at the end of a displayed
line on screen results in an anomalous hanging space at the beginning of the
next line, while '&#160; ' renders correctly with no spurious space.


Before I switched to generating my EPUBs using pandoc, I wrote myself a cleaner
tool in Perl to go through and strip out only *all of the redundant* SPANs.  It
typically cut the size of each file by around 60%.  My co-author and I on our
collaborative novel found it literally less work to strip out ALL of the
formatting and then go in and re-apply it *by hand* than to try to fix what
LibreOffice exported.

The core of the problem here is libepubgen.  It is abandonware that has not
seen a commit since 2018.

Please consider re-evaluating this EPUB export architecture.  I would strongly
advise re-engineering it around Pandoc or forking and incorporating Pandoc's
ODT-to-XHTML engine.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to