Skip to content

Commit

Permalink
Fix for issue 6199: EndNote .xml import to JabRef: PDF links are not …
Browse files Browse the repository at this point in the history
…imported correctly. (JabRef#6199)
  • Loading branch information
devinluo27 committed Apr 24, 2021
1 parent 23d7573 commit 40245c7
Show file tree
Hide file tree
Showing 6 changed files with 380 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,32 @@ private Optional<String> getUrl(Record record) {
}

private Optional<String> getUrlValue(Url url) {
return Optional.ofNullable(url)
.map(Url::getStyle)
.map(Style::getContent)
.map(this::clean);
Optional<List<Object>> urlContent = Optional.ofNullable(url).map(Url::getContent);
List<Object> list = urlContent.orElse(null);
Optional<String> ret;
if (list==null || list.size() == 0) {
return Optional.empty();
}
else {
boolean isStyleExist = false;
int style_index = -1;
for(int i =0 ; i < list.size(); i++) {
if(list.get(i) instanceof Style){
isStyleExist = true;
style_index = i;
}
}
if (!isStyleExist) {
ret = Optional.ofNullable((String) list.get(0))
.map(this::clean);
}
else {
ret = Optional.ofNullable((Style)list.get(style_index))
.map(Style::getContent)
.map(this::clean);
}
}
return ret;
}

private List<String> getKeywords(Record record) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/xjc/endnote/endnote.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@
</xs:complexType>
</xs:element>
<xs:element name="url">
<xs:complexType>
<xs:complexType mixed="true">
<xs:sequence>
<xs:element minOccurs="0" ref="style"/>
</xs:sequence>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@article{,
abstract = {test abstract},
author = {Ahmad, AS and Ormiston-Smith, N and Sasieni, PD},
doi = {10.1038/bjc.2014.606},
file = {:file\://localhost/Users/user/Documents/Bookends/Attachments/Ahmad%20et%20al%202015.pdf:PDF},
isbn = {1532-1827 (Electronic) 0007-0920 (Linking)},
keywords = {Age Factors; Aged; Aged, 80 and over; Female; Great Britain/epidemiology; Humans; Male; Middle Aged; Models, Statistical; Neoplasms/*epidemiology; Risk Assessment; Risk Factors; Sex Characteristics},
number = {5},
pages = {943-7},
title = {Trends in the lifetime risk of developing cancer in Great Britain: comparison of risk for those born from 1930 to 1960},
volume = {112},
year = {2015},
journal = {Br J Cancer},
note = {some notes},
url = {http://www.ncbi.nlm.nih.gov/pubmed/25647015},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8"?>
<xml>
<records>
<record>
<database name="Library1.bdb" path="/Users/user/Documents/Bookends/Library1.bdb">Library1.bdb</database>
<source-app name="Bookends" version="13.0.5">Bookends</source-app>
<rec-number>2954</rec-number>
<ref-type name="Journal Article">17</ref-type>
<contributors>
<authors>
<author>
<style face="normal" size="100%">Ahmad, AS</style>
</author>
<author>
<style face="normal" size="100%">Ormiston-Smith, N</style>
</author>
<author>
<style face="normal" size="100%">Sasieni, PD</style>
</author>
</authors>
</contributors>
<auth-address>
<style face="normal" size="100%">Queen Mary University of London, Centre for Cancer Prevention, Wolfson
Institute of Preventive Medicine, Charterhouse Square, London EC1M 6BQ, UK.&#xA;Cancer Research UK,
Head of Statistical Information, Angel Building, 407 St John Street, London EC1V 4AD, UK.
</style>
</auth-address>
<titles>
<title>
<style face="normal" size="100%">Trends in the lifetime risk of developing cancer in Great Britain:
comparison of risk for those born from 1930 to 1960
</style>
</title>
<secondary-title>
<style face="normal" size="100%">Br J Cancer</style>
</secondary-title>
</titles>
<pages>
<style face="normal" size="100%">943-7</style>
</pages>
<number>
<style face="normal" size="100%">5</style>
</number>
<volume>
<style face="normal" size="100%">112</style>
</volume>
<dates>
<year>
<style face="normal" size="100%">2015</style>
</year>
<pub-dates>
<date>
<style face="normal" size="100%">Mar 3</style>
</date>
</pub-dates>
</dates>
<keywords>
<keyword>
<style face="normal" size="100%">Age Factors</style>
</keyword>
<keyword>
<style face="normal" size="100%">Aged</style>
</keyword>
<keyword>
<style face="normal" size="100%">Aged, 80 and over</style>
</keyword>
<keyword>
<style face="normal" size="100%">Female</style>
</keyword>
<keyword>
<style face="normal" size="100%">Great Britain/epidemiology</style>
</keyword>
<keyword>
<style face="normal" size="100%">Humans</style>
</keyword>
<keyword>
<style face="normal" size="100%">Male</style>
</keyword>
<keyword>
<style face="normal" size="100%">Middle Aged</style>
</keyword>
<keyword>
<style face="normal" size="100%">Models, Statistical</style>
</keyword>
<keyword>
<style face="normal" size="100%">Neoplasms/*epidemiology</style>
</keyword>
<keyword>
<style face="normal" size="100%">Risk Assessment</style>
</keyword>
<keyword>
<style face="normal" size="100%">Risk Factors</style>
</keyword>
<keyword>
<style face="normal" size="100%">Sex Characteristics</style>
</keyword>
</keywords>
<abstract>
<style face="normal" size="100%">test abstract
</style>
</abstract>
<notes>
<style face="normal" size="100%">some notes
</style>
</notes>
<urls>
<related-urls>
<url>
<style face="normal" size="100%">http://www.ncbi.nlm.nih.gov/pubmed/25647015</style>
</url>
</related-urls>
<pdf-urls>
<url>
file://localhost/Users/user/Documents/Bookends/Attachments/Ahmad%20et%20al%202015.pdf
</url>
</pdf-urls>
</urls>
<isbn>
<style face="normal" size="100%">1532-1827 (Electronic)&#xD;0007-0920 (Linking)</style>
</isbn>
<electronic-resource-num>
<style face="normal" size="100%">10.1038/bjc.2014.606</style>
</electronic-resource-num>
<accession-num>
<style face="normal" size="100%">25647015</style>
</accession-num>
</record>
</records>
</xml>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@article{,
author = {Chapman, A. G.},
isbn = {0012-9658},
number = {1},
pages = {93-105},
title = {An ecological basis for reforestation of submariginal lands in the Central Hardwood Region},
volume = {18},
year = {1937},
journal = {Ecology},
note = {some notes},
url = {<Go to ISI>://000200148800007}
}
@book{,
author = {Strohecker, H. F.},
isbn = {0012-9658},
number = {1},
journal = {Ecology},
note = {some other notes},
pages = {162-168},
title = {A survey of soil temperatures in the Chicago area},
volume = {18},
url = {<Go to ISI>://000200148800014},
year = {1937}
}
Loading

0 comments on commit 40245c7

Please sign in to comment.