-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add EndNote XML Exporter + Rehaul Importer #11157
Conversation
src/main/java/org/jabref/logic/exporter/EndnoteXmlExporter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/exporter/EndnoteXmlExporter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/exporter/EndnoteXmlExporter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/exporter/EndnoteXmlExporter.java
Outdated
Show resolved
Hide resolved
…bref into fix-for-issue-11137
In general looks good to me. As a follow up task and PR you can think about converting it to a StreamWriter (StaX). |
Yes, in fact I had a couple of plans for the follow up PRs I'm going to put regarding this.
|
@Siedlerchr On resolving the changelog conflict on Github itself, it's saying I "dismissed" your review. I'm sorry, that was accidental. |
Please do add the test here well. This makes the migration to stax easier Because you then have already a working test to verfiy the functionality. |
On it. |
Export & Import for |
@@ -1,5 +1,6 @@ | |||
@article{, | |||
address = {Cent States Forest Expt Stn, Columbus, OH USA}, | |||
alt-title = {Ecology}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
improvement: if alt-title
matches journal
, then remove alt-title
. Maybe, a cleanup at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the same apply if booktitle
matches alt-title
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have done that.
@@ -15,6 +16,7 @@ @article{ | |||
} | |||
@book{, | |||
address = {Univ Chicago, Chicago, IL USA}, | |||
alt-title = {Ecology}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(comment for below)
Here, I see journal
set. This is wrong. If the entry is not an article
, that field should go into booktitle
or another field. Please try to check the table https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management#BibTeX and think on a case-by-case basis. As fallback, just use booktitle
before loosing the field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the original import test xml, it was present as alt-title
.
Somewhere I had read during all this that booktitle
in the bib is handled by secondary-title
in the Endnote xml format. So I'll modify the bib and the xml, and change the StandardField of secondary-type to BOOKTITLE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, have to undo this. It's importing as booktitle even for articles. Will try to do it the way you suggested.
Review hint: The diff between two commits can be retrieved by URL hacking: 60f3ae2...0527ec7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments
} | ||
case "urls" -> { | ||
handleUrlList(reader, fields, linkedFiles); | ||
case "periodical", "alt-periodical" -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this, the order periodical
and alt-periodical
matters. Just leave out alt-periodical
- or store it in the field alt-periodical
(and keep it if it differs from periodical
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking every sub-field of alt-periodical felt tedious, and also on checking the Endnote dtd I see no alt-periodical
. So I decided to leave out.
When I leave out alt-periodical
, a journal
field comes up in case of a Book. I might be missing something very obvious. Let us take a look at a test case:
It is as if it is ignoring the parent being unrecognized alt-periodical
, and going in and setting the full-title
into the journal field.
How do I prevent this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, found it! It was getting imported in the default case. Fixed it.
} | ||
// Cleanup: Remove alt-title if it matches the journal | ||
String journalOrBooktitle = entry.getField(StandardField.JOURNAL).or(() -> entry.getField(StandardField.BOOKTITLE)).orElse(""); | ||
if (entry.hasField(new UnknownField("alt-title"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exctract new UnknownField("alt-title")
to class constant FIELD_ALT_TITLE
. You can use intellij refactoring extract field - Ctrl+Shift+F.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Closes #11137
I am attempting to write an EndNote XML Exporter for JabRef.
I have successfully been able to implement the exporter, but there are a few catches, which will hopefully be addressed in follow-up issues and PRs:
Journal/Booktitle values beginning with "IEEE" are not captured:Original Library:
On export and import:
The author/editor of the third entry changes from "Madrigal" to "Marigal and o S." (refer to the same pair of screenshots).@koppor @Siedlerchr @HoussemNasri @ThiloteE @calixtus
The code is in a very raw stage right now, if you have time to go through it and suggest enhancements, please do.Importer changes:
The importer had to be tweaked a little to include fields such as
tertiary-title
corresponding to the Book title/Journal, otherwise the column would remain empty:Similarly, many other fields that were not retrieved by the importer as visible in BibTeX source were added to create a one-to-one mapping between the source entry and the one produced by a round trip export-import. The function
convertRefNameToType
was also modified to add some Entrytypes that were not recognized before.Update: Major changes have taken place, please follow the discussion for details.
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)