Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export to MS Office 2007 (*.xml) of @electronic and @online records *mistakenly duplicates* BibTeX 'Title' to MS Office 'Publicationtitle' field #10807

Closed
2 tasks done
balanco opened this issue Jan 19, 2024 · 1 comment · Fixed by #10864
Labels
export / save good first issue An issue intended for project-newcomers. Varies in difficulty. microsoft office

Comments

@balanco
Copy link

balanco commented Jan 19, 2024

JabRef version

5.12 (latest release)

Operating system

Windows

Details on version and operating system

Windows 11 (current)

Checked with the latest development build (copy version output from About dialog)

  • I made a backup of my libraries before testing the latest development version.
  • I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

One-sentence summary of the issue:

JabRef Export to MS Office 2007 (*.xml) of BibTeX records of type @Electronic and @Online mistakenly duplicates the content of the Title field to the MS Office Publicationtitle field in the exported XML file: it should not do that (this issue does not exist for other types, e.g., @Book)

Steps to reproduce the behavior:

  1. In JabRef, allocate a new library and copy-paste this minimal BibTeX record:

@Electronic{Author,
author = {Some Author},
title = {The Title},
url = {https://somewhere.net/example/address},
urldate = {2024-01-19},
}

  1. File -> Export this record as type MS Office 2007 (*.xml) into a file test.xml

  2. The exported file "test.xml" mistakenly contains both, a "Title" and a "Publicationtitle" field (highlighted in bolditalic in the following file dump):

<b:Sources xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography"&nbsp;xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography"&nbsp;SelectedStyle="">
    <b:Source>
        <b:BIBTEX_Entry>electronic</b:BIBTEX_Entry>
        <b:SourceType>ElectronicSource</b:SourceType>
        <b:Title>The Title</b:Title>
        <b:Tag>Author</b:Tag>
        <b:URL>https://somewhere.net/example/address</b:URL>
        <b:YearAccessed>2024</b:YearAccessed>
        <b:MonthAccessed>January</b:MonthAccessed>
        <b:DayAccessed>19</b:DayAccessed>
        <b:Author>
            <b:Author>
                <b:NameList>
                    <b:Person>
                        <b:Last>Author</b:Last>
                        <b:First>Some</b:First>
                    </b:Person>
                </b:NameList>
            </b:Author>
        </b:Author>
        <b:PublicationTitle>The Title</b:PublicationTitle>
    </b:Source>
</b:Sources>

To illustrate the follow-up consequences of the bug in MS Word:

  1. Open a blank MS Word document

  2. Load the file "test.xml" via:

    1. References -> Manage Sources -> Browse… and then
    2. select and Copy -> the loaded record from the Sources available in test pane into the Current List pane and
    3. Close the "Source Manager" dialog window
    (the duplicate title is already displayed in the Preview pane of the dialog window)

  3. Insert a bibliography into the empty document, via:

    1. References -> Bibliography
    2. Select the first style, Bibliography, offered in the pop-up menu

  4. The inserted bibliography consists of the following record:
    Author, S. (n.d.). The Title. The Title. Retrieved January 19, 2024, from https://somewhere.net/example/address
     
    Note the duplicate title.

As mentioned at the beginning, the same issue exists for records of type @Online, but not for e.g., type @Book.

Appendix

Related Source Code:

File src/main/java/org/jabref/logic/msbib/MSBibConverter.java:

   108	        // TODO: currently only Misc can happen
   109	        if ("ElectronicSource".equals(msBibType) || "Art".equals(msBibType) || "Misc".equals(msBibType)) {
   110	            result.publicationTitle = entry.getFieldLatexFree(StandardField.TITLE).orElse(null);
   111	        }

(addendum 2024-01-20):
In the meantime I verified that removing the first clause "ElectronicSource".equals(msBibType) indeed suffices to correct the behavior (kudos to the maintainers of https://devdocs.jabref.org/ ).
I have not investigated the mapping of BibTeX @misc to MS Office Misc mentioned in https://docs.jabref.org/advanced/knowledge/msofficebibfieldmapping (visited 2024-01-20)).

So, the patched lines just read
(File src/main/java/org/jabref/logic/msbib/MSBibConverter.java, lines 108ff.):

  // TODO: currently only Misc can happen
  // 2024-01-20 balanco@github: removed condition/case "ElectronicSource".equals(msBibType)
  //    that generated MS Office bibliographic records with
  //    _duplicate_ "Title" and "Publicationtitle" fields.
  if ("Art".equals(msBibType) || "Misc".equals(msBibType)) {
     result.publicationTitle = entry.getFieldLatexFree(StandardField.TITLE).orElse(null);
  }

<EOT>

@Siedlerchr Siedlerchr added the good first issue An issue intended for project-newcomers. Varies in difficulty. label Jan 19, 2024
@github-project-automation github-project-automation bot moved this to Free to take in Good First Issues Jan 19, 2024
@koppor koppor moved this from Free to take to Reserved in Candidates for University Projects Jan 28, 2024
@koppor koppor moved this from Free to take to Reserved in Good First Issues Jan 28, 2024
@Siedlerchr
Copy link
Member

@balanco Feel free to create a PR

dhrax21 added a commit to dhrax21/jabref that referenced this issue Feb 7, 2024
github-merge-queue bot pushed a commit that referenced this issue Feb 9, 2024
* #10807 BibTeX 'Title' to MS Office 'Publicationtitle' field

* added_testfile_and_changelog_for_#10864

* modified_testfile_and_changelog_for_#10864
@github-project-automation github-project-automation bot moved this from Reserved to Done in Good First Issues Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
export / save good first issue An issue intended for project-newcomers. Varies in difficulty. microsoft office
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants