Bug 130510 - Since version 6.4 Writer loses the comments during HTML import
Summary: Since version 6.4 Writer loses the comments during HTML import
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.0.3 release
Hardware: All All
: medium normal
Assignee: peter.88213
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: HTML-Import
  Show dependency treegraph
 
Reported: 2020-02-07 17:40 UTC by peter.88213
Modified: 2020-02-10 14:58 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
A html example file (1.93 KB, text/html)
2020-02-08 09:48 UTC, peter.88213
Details

Note You need to log in before you can comment on or make changes to this bug.
Description peter.88213 2020-02-07 17:40:51 UTC
Description:
Up to version 6.3, it was common for Writer (like OpenOffice Writer) to take HTML comments when importing HTML documents.
Since version 6.4, HTML comments seem to get lost upon HTML import.

Use Case: Generate documents by scripting, with extra metadata (such as section summaries) shown as comments. 


Steps to Reproduce:
1. Generate a simple valid HTML document with some HTML comments inserted within paragraphs.
2. Open the document with Writer.

Actual Results:
The document does not contain any comments.

Expected Results:
Each HTML comment is converted into a Writer comment and shows up at least in the navigator.


Reproducible: Always


User Profile Reset: No



Additional Info:
Behaviour has changed since LibreOffice version 6.4.0.3.
Deinstalling version 6.4.0.3 and going back to version 6.3.4.2 fixes the problem.
Comment 1 Kevin Suo 2020-02-08 03:03:13 UTC
Would you please attach one minimum html file "with extra metadata (such as section summaries) shown as comments"?
Comment 2 peter.88213 2020-02-08 09:48:41 UTC
Created attachment 157741 [details]
A html example file
Comment 3 Dieter 2020-02-09 17:20:45 UTC
Peter, following your steps, I can can see no difference between the html file opening with Writer or with Firefox or Chrome.

I'm not familiar with html-files, but whre can I see html comments within your file? Do I need a special editor?
Comment 4 sdc.blanco 2020-02-09 22:58:49 UTC
Open attachment 157741 [details] with

6.3.4.2 :  see 3 comments

7.0.0.0.alpha :  no comments shown 

Additional information.

Possible to use 7.0.0.0.alpha to save comments in an .html file, but on "reload" the comments are not visible.  (but they are visible in 6.3.4.2)

(To see comments, open the .html file with a text editor (e.g., Notepad in Windows, vi or kate in linux).  Look for entries that start "<!--"  and end "-->" 
The text strings between the -- will appear in 6.3.x, but not in 7.0.0.0.alpha. )
Comment 5 Dieter 2020-02-10 07:04:17 UTC
I also see comments in 

Version: 6.3.4.2 (x64)
Build-ID: 60da17e045e08f1793c57c00ba83cdfce946d0aa
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; VCL: win; 
Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE
Calc: threaded

but not in

Version: 7.0.0.0.alpha0+ (x64)
Build ID: eeb2d19e77d6dc47c68e8ba0920a02cf64a1247b
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: default; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-GB
Calc: threaded
Comment 6 peter.88213 2020-02-10 07:26:11 UTC
I want to clarify that I am referring to the component "swriter.exe" and not to the HTML editor component "sweb.exe" (which reads HTML files by default). The problem occurs when converting between HTML and ODT. 

Note: Web browsers usually don't show HTML comments.
Comment 7 Xisco Faulí 2020-02-10 10:56:14 UTC
Regression introduced by:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=9219242d42b7b0e5b00d7a1997cc7fcf35894627

author	Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>	2019-09-06 10:50:49 +0200
committer	Thorsten Behrens <Thorsten.Behrens@CIB.de>	2019-09-06 15:30:00 +0200
commit 9219242d42b7b0e5b00d7a1997cc7fcf35894627 (patch)
tree a8f025f024db035801d30a237331747e83bc6f42
parent 77e39d55457385eb1585034e8e461ad9ba77e707 (diff)
Disable inserting HTML comments as notes by default

Bisected with: bibisect-linux64-6.4

Adding Cc: to Samuel Mehrbrodt

@Samuel, so it seems some people use comments in html files.
Would it be possible to hide them by default and make it possible to show them from the View menu ?
Comment 8 Samuel Mehrbrodt (allotropia) 2020-02-10 11:17:08 UTC
So there is already a config option for this. Search expert config for "IgnoreComments" and set to false.

I don't see any reason why this should be on by default, as usually html comments are not meant to be seen by the user.
In the special case mentioned by the bug reporter, he should just switch the config option.
Comment 9 sdc.blanco 2020-02-10 11:59:39 UTC
Perhaps Samuel's advice should be added to the relevant help page:
https://help.libreoffice.org/7.0/en-US/text/shared/01/about_meta_tags.html

(I could make that change -- but would need advice about a correct formulation. I guess a sentence at the end of the "Import Tips" section?)

or if this is a common action, then perhaps this control should be added as a checkbox in Tools - Options - Load/Save - HTML Compatibility?
Comment 10 peter.88213 2020-02-10 13:17:09 UTC
I had a look at commit 9219242d42b7b0e5b00d7a1997cc7fcf35894627 causing the new behaviour. 
Obviously, there was no requirement for that modification. 
I suggest to revert the change and not to bloat LibreOffice's user interface.
Comment 11 Samuel Mehrbrodt (allotropia) 2020-02-10 14:14:45 UTC
(In reply to peter.88213 from comment #10)
> I had a look at commit 9219242d42b7b0e5b00d7a1997cc7fcf35894627 causing the
> new behaviour. 
> Obviously, there was no requirement for that modification. 
> I suggest to revert the change and not to bloat LibreOffice's user interface.

The fix was done primarily for LibreOffice Online. When copying/pasting any text on Windows 10, Windows would automatically add comments like "<!--StartFragment-->" and "<!--EndFragment-->". Those were then imported by LO Online when pasting any text.
Comment 12 peter.88213 2020-02-10 14:58:10 UTC
Samuel, 

thank you for clarifying the issue. Since the problem does not apply to the desktop version (I just tested it on Win 10 / LO6.3.4.2 / Firefox and Edge), I suggest to restrict the modification to the online version. 

Differences in behaviour between desktop and online variants are more likely to be accepted than changed behaviour upon update (may I remind of all the frustrating experiences with "windows as a service"?).