Bug 128540 - EPUB export: use (X)HTML markup to set text direction
Summary: EPUB export: use (X)HTML markup to set text direction
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.3.2.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 142896 (view as bug list)
Depends on:
Blocks: EPUB-Export
  Show dependency treegraph
 
Reported: 2019-11-01 19:04 UTC by f.carbone80
Modified: 2023-06-24 15:32 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
The warning and error that I discovered (216.04 KB, image/jpeg)
2019-11-01 19:06 UTC, f.carbone80
Details
The EPUB that I have tested (18.26 MB, application/epub+zip)
2019-11-04 14:59 UTC, f.carbone80
Details
The .odt file from which I derived the EPUB file. (11.09 MB, application/vnd.oasis.opendocument.text)
2019-11-20 22:38 UTC, f.carbone80
Details
New Screenshot about the warning and Error (102.84 KB, image/jpeg)
2023-06-24 15:25 UTC, f.carbone80
Details

Note You need to log in before you can comment on or make changes to this bug.
Description f.carbone80 2019-11-01 19:04:34 UTC
Description:
Hi. I converted a Writer document in EPUB with the incorporated tool. After convertion I verified the .epub di pagina EPUB-Checker (last version of this tool) and It discovered some Error and Warning that I list below:

-- Error RSC-005
-- Error OPF-012
-- Warning RSC-017
-- Error CSS-001



Actual Results:
Create an .epub with Writer then use a validation program to check for problems.

Expected Results:
At this point, you should see the same errors that I did.


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 f.carbone80 2019-11-01 19:06:14 UTC
Created attachment 155455 [details]
The warning and error that I discovered
Comment 2 Julien Nabet 2019-11-01 22:27:15 UTC
3.3.2 is a very old version.
Could you give a try to 6.2.8 or brand new 6.3.3?
Also, if you still reproduce this, could you attach the file so we can try to reproduce this?
Of course, think about sanitizing it (see https://wiki.documentfoundation.org/QA/Bugzilla/Sanitizing_Files_Before_Submission)
Comment 3 f.carbone80 2019-11-04 08:30:29 UTC
Sorry It's 6.3.2.2. Now Version corrected.
Comment 4 f.carbone80 2019-11-04 14:59:36 UTC
Created attachment 155507 [details]
The EPUB that I have tested

The .epub is the test book that I have tested.
Comment 5 QA Administrators 2019-11-05 03:30:01 UTC Comment hidden (obsolete)
Comment 6 Julien Nabet 2019-11-07 16:11:34 UTC
To reproduce the problem, we need the original ODT file not the resulting EPUB file.
Comment 7 f.carbone80 2019-11-20 22:38:47 UTC
Created attachment 155990 [details]
The .odt file from which I derived the EPUB file.

Hello here the .odt file from which I derived the EPUB file. 
Sorry for delay.
Comment 8 Julien Nabet 2019-11-20 22:53:48 UTC
Version must correspond to the earliest affected one.
Comment 9 Julien Nabet 2019-11-20 23:00:13 UTC
On pc Debian x86-64 with master sources updated today, I converted your odt file into epub.
Then with epubcheck 4.1 from LO Debian testing package repo, I got:
Validating using EPUB version 3.2 rules.
WARNING(RSC-017): /tmp/epub-libreoffice.epub/OEBPS/sections/section0001.xhtml(2,50): Warning while parsing file: The 'head' element should have a 'title' child element.
WARNING(RSC-017): /tmp/epub-libreoffice.epub/OEBPS/toc.xhtml(2,93): Warning while parsing file: The 'head' element should have a 'title' child element.
ERROR(CSS-001): /tmp/epub-libreoffice.epub/OEBPS/styles/stylesheet.css(148,3): The 'direction' property must not be included in an EPUB Style Sheet.

Check finished with errors
Messages: 0 fatals / 1 error / 2 warnings / 0 infos

Let's put this one to NEW since there's at least 1 error.
Comment 10 Julien Nabet 2019-11-20 23:16:07 UTC
David: thought you might be interested in this one since it concerns epub
Comment 11 f.carbone80 2019-12-22 12:09:52 UTC
(In reply to Julien Nabet from comment #9)


Yes, Julien, these are the same mistakes that I found.
Comment 12 Stéphane Guillou (stragu) 2021-05-19 13:22:02 UTC
Exporting with LO 7.2 alpha1+, and checking with epubcheck 4.2.5, I get the same warnings and error as Julien:

Validating using EPUB version 3.2 rules.
WARNING(RSC-017): /home/stragu/Downloads/epub-libreoffice.epub/OEBPS/sections/section0001.xhtml(2,50): Warning while parsing file: The "head" element should have a "title" child element.
WARNING(RSC-017): /home/stragu/Downloads/epub-libreoffice.epub/OEBPS/toc.xhtml(2,93): Warning while parsing file: The "head" element should have a "title" child element.
ERROR(CSS-001): /home/stragu/Downloads/epub-libreoffice.epub/OEBPS/styles/stylesheet.css(148,3): The "direction" property must not be included in an EPUB Style Sheet.

The part of the stylesheet that causes the ERROR(CSS-001) is this one:

.body0 {
  -epub-writing-mode: horizontal-tb;
  -webkit-writing-mode: horizontal-tb;
  direction: ltr;
  writing-mode: horizontal-tb;
}

LibreOffice version:

Version: 7.2.0.0.alpha1+ / LibreOffice Community
Build ID: b1c0734ffe0f395757b6e0cea7830d820231afeb
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-05-18_03:16:20
Calc: threaded
Comment 13 Julien Nabet 2021-05-23 09:25:11 UTC
Mark: would it be possible to push this straightforward patch for "direction" part?
diff --git a/src/lib/EPUBBodyStyleManager.cpp b/src/lib/EPUBBodyStyleManager.cpp
index 93d9a5d..bedeb43 100644
--- a/src/lib/EPUBBodyStyleManager.cpp
+++ b/src/lib/EPUBBodyStyleManager.cpp
@@ -26,7 +26,6 @@ void EPUBBodyStyleManager::extractProperties(RVNGPropertyList const &pList, EPUB
     else // For the rest: lr, lr-tb, rl, rl-tb
     {
       mode = "horizontal-tb";
-      cssProps["direction"] = (mode == "rl-tb" || mode == "rl")?"rtl":"ltr";
     }
 
     cssProps["-epub-writing-mode"] = mode;
Comment 14 David Tardon 2021-05-24 20:11:44 UTC
(In reply to Julien Nabet from comment #13)
> Mark: would it be possible to push this straightforward patch for
> "direction" part?
> diff --git a/src/lib/EPUBBodyStyleManager.cpp
> b/src/lib/EPUBBodyStyleManager.cpp
> index 93d9a5d..bedeb43 100644
> --- a/src/lib/EPUBBodyStyleManager.cpp
> +++ b/src/lib/EPUBBodyStyleManager.cpp
> @@ -26,7 +26,6 @@ void
> EPUBBodyStyleManager::extractProperties(RVNGPropertyList const &pList, EPUB
>      else // For the rest: lr, lr-tb, rl, rl-tb
>      {
>        mode = "horizontal-tb";
> -      cssProps["direction"] = (mode == "rl-tb" || mode == "rl")?"rtl":"ltr";
>      }
>  
>      cssProps["-epub-writing-mode"] = mode;

No. That just removes the symptom without fixing the problem. The CSS property *should* be removed, but new code should be added that emits (X)HTML dir attribute. See https://www.w3.org/International/questions/qa-bidi-css-markup and https://github.com/w3c/epub-specs/issues/335 for more info.
Comment 15 Julien Nabet 2021-06-16 16:18:06 UTC
*** Bug 142896 has been marked as a duplicate of this bug. ***
Comment 16 QA Administrators 2023-06-17 03:15:18 UTC Comment hidden (obsolete)
Comment 17 f.carbone80 2023-06-24 15:22:56 UTC
Hello every one. I made a new test on LibreOffice 7.4.7.2 (x64), and I see that some problem stay alive.

The following are the problem that I've been encountered when I test the final EPUB with the application "pagina EPUB-Checker" v2.0.9 that include the last EPUBCheck 5.0.1.

-- Warning RSC-017 (The "head" element should have a "title" child element). Infact, in the xhtml file no title is present.
-- Error CSS-001 (The property "direction" is present in the CSS but it is an Error).
Comment 18 f.carbone80 2023-06-24 15:25:41 UTC
Created attachment 188077 [details]
New Screenshot about the warning and Error
Comment 19 Julien Nabet 2023-06-24 15:32:36 UTC
Version field must correspond to the earliest one.