Bug 115326 - Change multiple spaces to   upon HTML export
Summary: Change multiple spaces to   upon HTML export
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.0.0.2 rc
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:html
: 36447 (view as bug list)
Depends on:
Blocks: (X)HTML-Export
  Show dependency treegraph
 
Reported: 2018-01-31 09:33 UTC by seven
Modified: 2023-10-11 10:16 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Origin - example (8.95 KB, application/vnd.oasis.opendocument.text)
2018-01-31 09:33 UTC, seven
Details
Html document - libre office not show spaces between element in web brousers (861 bytes, text/html)
2018-01-31 09:34 UTC, seven
Details
LibreOffice Web Browser (screen example) (8.92 KB, image/png)
2018-01-31 09:38 UTC, seven
Details
MS Office Web Browser (screen example) (8.75 KB, image/png)
2018-01-31 09:39 UTC, seven
Details

Note You need to log in before you can comment on or make changes to this bug.
Description seven 2018-01-31 09:33:17 UTC
Created attachment 139462 [details]
Origin - example

Document have 2 element with spaces between.

Save as document in web file version not show in web brouser same like in writer.
Save in MS Office Word look good
Comment 1 seven 2018-01-31 09:34:11 UTC
Created attachment 139463 [details]
Html document - libre office not show spaces between element in web brousers
Comment 2 seven 2018-01-31 09:35:10 UTC
Created attachment 139464 [details]
Single web page Saved from MS Office Word - Show spaces between elements in web brouwsers
Comment 3 seven 2018-01-31 09:38:50 UTC
Created attachment 139465 [details]
LibreOffice Web Browser (screen example)
Comment 4 seven 2018-01-31 09:39:32 UTC
Created attachment 139466 [details]
MS Office Web Browser (screen example)
Comment 5 Buovjaga 2018-02-23 20:02:22 UTC
If you look at the MSO exported MHT file, it has this:

<p class=3DStandard>A<span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>B</p>

So yeah, the non-breaking space &nbsp; can of course be used to emulate such situations with multiple spaces. Note that the MHT is using some proprietary mso-tab-count for the tabs. HTML standard does not support tab characters, so it does not make sense to export them as HTML and expect them to look the same.

Let's change the summary and involve UX team.
Comment 6 Heiko Tietze 2018-02-24 09:40:58 UTC
(In reply to Buovjaga from comment #5)
>  HTML standard does not support tab characters,
> so it does not make sense to export them as HTML and expect them to look the
> same.

In HTML, &nbsp; is a non-breaking space and a bad workaround IMHO for multiple spaces (#20). The correct symbol for tab is "&#09;" while we save the plain #9, and "&#32;" for space (we save #20). Makes no difference though to change this.

Encapsulating multiple white spaces in <pre></pre> notation works as expected but I'm not sure if combining <pre> with normal text in one line is possible. In the end, HTML separates clearly between content and style and formatting with multiple white spaces is out of scope (and NOB thereby). Not to forget that the width of tabs can be defined freely in LibreOffice but is fix in HTML.


https://www.w3.org/MarkUp/html-spec/html-spec_13.html
https://www.w3.org/MarkUp/html3/specialchars.html
Comment 7 Buovjaga 2018-02-24 09:49:23 UTC
(In reply to Heiko Tietze from comment #6)
> Not to forget that the width of tabs can be defined freely in LibreOffice but is
> fix in HTML.

Yep, this is why it doesn't make sense.
Comment 8 Taylor Jenkins 2018-02-27 18:09:34 UTC
Tab width may be fixed in html, but it can be changed with css.
https://www.w3schools.com/cssref/tryit.asp?filename=trycss3_tab-size
Comment 9 Buovjaga 2018-02-27 18:12:10 UTC
(In reply to Taylor Jenkins from comment #8)
> Tab width may be fixed in html, but it can be changed with css.
> https://www.w3schools.com/cssref/tryit.asp?filename=trycss3_tab-size

Ok, that would be a nice to have. I don't think it matters much that it is not currently supported by IE or Edge: https://caniuse.com/#search=tab-size
Comment 10 Buovjaga 2018-02-27 18:16:01 UTC
(In reply to Buovjaga from comment #9)
> (In reply to Taylor Jenkins from comment #8)
> > Tab width may be fixed in html, but it can be changed with css.
> > https://www.w3schools.com/cssref/tryit.asp?filename=trycss3_tab-size
> 
> Ok, that would be a nice to have. I don't think it matters much that it is
> not currently supported by IE or Edge: https://caniuse.com/#search=tab-size

Might be a bit tricky to implement (?) and no idea, how the white-space: pre/pre-wrap requirements affect the usefulness: https://tympanus.net/codrops/css_reference/tab-size/
"The only case when a tab is rendered as a tab on the page is when the pre formatting rule is applied to the content, whether by including the content in a <pre> tag, or by setting the value of the white-space property to pre or pre-wrap. So it would only make sense to use the tab-size property in case we’re preserving the white spaces."
Comment 11 Thomas Lendo 2018-02-28 00:21:18 UTC
For me this is a problem LibO should solve and not the user should search for a way that LibO can export it to have it right-looking in exported HTML files. If a user wants have 3 spaces between characters, this should be preserved for HTML view as much as technically and semantically possible.

How this is achieved is another question, I haven't worked with HTML/CSS for a decade.
Comment 12 Heiko Tietze 2018-03-01 15:23:31 UTC
Recommend to not implement this hackish solution. It breaks the concept of HTML where content and style are clearly separated. The correct way is to define a style with the tab width for the respective paragraphs - and also do this for two or more spaces.

Got agreement on ESC but up to QA in the end as patches welcome and since we have similar solutions for empty paragraphs.
Comment 13 Michael Warner 2021-12-20 17:38:05 UTC
(In reply to Buovjaga from comment #9)
> (In reply to Taylor Jenkins from comment #8)
> > Tab width may be fixed in html, but it can be changed with css.
> > https://www.w3schools.com/cssref/tryit.asp?filename=trycss3_tab-size
> 
> Ok, that would be a nice to have. I don't think it matters much that it is
> not currently supported by IE or Edge: https://caniuse.com/#search=tab-size

It's supported by Edge now. I agree it doesn't matter that it's not supported by IE because even Microsoft wants people to stop using IE. 

https://caniuse.com/css3-tabsize
Comment 14 Buovjaga 2023-10-11 10:16:59 UTC
*** Bug 36447 has been marked as a duplicate of this bug. ***