Bug 129353 - FILEOPEN Bibliography contents is imported outside of bibliography field in a DOCX
Summary: FILEOPEN Bibliography contents is imported outside of bibliography field in a...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3.0.4 release
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:6.5.0 target:6.4.1 target:6.3.5
Keywords: implementationError
: 124512 130290 132785 (view as bug list)
Depends on:
Blocks: Bibliography DOCX
  Show dependency treegraph
 
Reported: 2019-12-12 19:48 UTC by Mike Kaganski
Modified: 2021-02-17 14:19 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
A bibliography with an empty first paragraph (13.50 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-12-12 19:48 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2019-12-12 19:48:23 UTC
Created attachment 156523 [details]
A bibliography with an empty first paragraph

The attachment DOCX has one citation field, and one bibliography field. The bibliography has an empty leading paragraph inside (that is how it was in an original customer document), and then two entries. It is imported into LibreOffice with an empty paragraph inside the bibliography field, but both bibliography entries are imported as simple paragraphs after (outside) the bibliography field. Note that Word 2016 imports them: the empty paragraph and the following entries - inside the field.

The problem is that the bibliography field and its first entry have this XML definition:

>                ...
>                <w:sdt>
>                    ...
>                    <w:sdtContent>
>                        <w:p>
>                            ...
>                            <w:r>
>                                <w:fldChar w:fldCharType="begin"/>
>                            </w:r>
>                            <w:r>
>                                <w:instrText xml:space="preserve"> BIBLIOGRAPHY </w:instrText>
>                            </w:r>
>                            <w:r>
>                                <w:fldChar w:fldCharType="separate"/>
>                            </w:r>
>                        </w:p>
>                        <w:p>
>                            ...
>                            <w:r>
>                                ...
>                                <w:t xml:space="preserve">Christie, A. (1922). </w:t>
>                            </w:r>
>                            ...

while usually it looks like

>                ...
>                <w:sdt>
>                    ...
>                    <w:sdtContent>
>                        <w:p>
>                            ...
>                            <w:r>
>                                <w:fldChar w:fldCharType="begin"/>
>                            </w:r>
>                            <w:r>
>                                <w:instrText xml:space="preserve"> BIBLIOGRAPHY </w:instrText>
>                            </w:r>
>                            <w:r>
>                                <w:fldChar w:fldCharType="separate"/>
>                            </w:r>
>                            <w:r>
>                                ...
>                                <w:t xml:space="preserve">Christie, A. (1922). </w:t>
>                            </w:r>
>                            ...

Note that in the "usual" XML, the run with <w:fldChar w:fldCharType="separate"/> element is immediately followed by another run with the first entry, which therefore is inside the paragraph entry defining the bibliography field; while in problematic XML, the run with <w:fldChar w:fldCharType="separate"/> element is the last run of the paragraph defining bibliography field, and the first entry is in the following paragraph.

Reproduced with Version: 4.3.0.4
Build ID: 62ad5818884a2fc2e5780dd45466868d41009ec0

and Version: 6.5.0.0.alpha0+ (x64)
Build ID: 6cdab5c92cecf90090ba72dfa6c22edf0d41028f
CPU threads: 12; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win; 
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: CL

The 4.3 is the first to import bibliography fields as fields, so implementation error.
Comment 1 Aron Budea 2019-12-12 23:22:59 UTC
Confirmed using 6.5.0.0.alpha0+ (775a06361639ffc539fda20d44b9610c98005d9b) / Ubuntu.
Comment 2 Mike Kaganski 2019-12-13 06:38:47 UTC
https://gerrit.libreoffice.org/85089
Comment 3 Commit Notification 2019-12-16 16:25:11 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5cdb14345842c07eb1a466897753da910e9488f8

tdf#129353, tdf#129402: fix node creation on index import

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2020-01-09 07:19:40 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/e76fcb8f169acac3d81bdaf9b126cc4c98e2eb8e

tdf#129353, tdf#129402: fix node creation on index import

It will be available in 6.4.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2020-01-09 11:16:19 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/commit/3018dcbf12fe96e57fe52dc1b2d7a1235b480eef

tdf#129353, tdf#129402: fix node creation on index import

It will be available in 6.3.5.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Xisco Faulí 2020-01-30 13:10:23 UTC
*** Bug 130290 has been marked as a duplicate of this bug. ***
Comment 7 Justin L 2020-04-11 16:41:39 UTC
*** Bug 124512 has been marked as a duplicate of this bug. ***
Comment 8 Timur 2020-05-21 10:40:40 UTC
*** Bug 132785 has been marked as a duplicate of this bug. ***