From 5aaea134fff43d0c8ea36faa3e5e82cd55073a22 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Thu, 2 Feb 2017 18:30:42 +0100 Subject: [PATCH 1/3] Fix export of number Export/import volumes <-> numberofvolume Export pubstate field as bibtex only field --- .../sf/jabref/logic/msbib/MSBibConverter.java | 5 +---- .../net/sf/jabref/logic/msbib/MSBibEntry.java | 1 - .../net/sf/jabref/logic/msbib/MSBibMapping.java | 4 ++-- .../exporter/BibTeXMLExporterTestFiles.java | 2 -- .../logic/exporter/MsBibExportFormatTest1.bib | 2 +- .../logic/exporter/MsBibExportFormatTest3.bib | 3 +++ .../logic/exporter/MsBibExportFormatTest7.bib | 17 +++++++++-------- .../logic/exporter/MsBibExportFormatTest7.xml | 3 ++- .../fileformat/MsBibImporterMsBibFieldsTest.bib | 2 +- 9 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/main/java/net/sf/jabref/logic/msbib/MSBibConverter.java b/src/main/java/net/sf/jabref/logic/msbib/MSBibConverter.java index 247e4e07544..cb993ff5fcf 100644 --- a/src/main/java/net/sf/jabref/logic/msbib/MSBibConverter.java +++ b/src/main/java/net/sf/jabref/logic/msbib/MSBibConverter.java @@ -12,7 +12,6 @@ public class MSBibConverter { private static final String MSBIB_PREFIX = "msbib-"; private static final String BIBTEX_PREFIX = "BIBTEX_"; - public static MSBibEntry convert(BibEntry entry) { MSBibEntry result = new MSBibEntry(); @@ -45,9 +44,7 @@ public static MSBibEntry convert(BibEntry entry) { result.broadcastTitle = entry.getField(FieldName.TITLE).orElse(null); } - if (!entry.getField(FieldName.ISSUE).isPresent()) { - result.number = entry.getField(FieldName.NUMBER).orElse(null); - } + result.number = entry.getField(FieldName.NUMBER).orElse(null); if ("Patent".equalsIgnoreCase(entry.getType())) { result.patentNumber = entry.getField(FieldName.NUMBER).orElse(null); diff --git a/src/main/java/net/sf/jabref/logic/msbib/MSBibEntry.java b/src/main/java/net/sf/jabref/logic/msbib/MSBibEntry.java index 935c46db699..8126cfbf8c2 100644 --- a/src/main/java/net/sf/jabref/logic/msbib/MSBibEntry.java +++ b/src/main/java/net/sf/jabref/logic/msbib/MSBibEntry.java @@ -79,7 +79,6 @@ class MSBibEntry { private static final Pattern DATE_PATTERN = Pattern .compile("(\\d{1,2})\\s*[.,-/]\\s*(\\d{1,2})\\s*[.,-/]\\s*(\\d{2,4})"); - public MSBibEntry() { //empty } diff --git a/src/main/java/net/sf/jabref/logic/msbib/MSBibMapping.java b/src/main/java/net/sf/jabref/logic/msbib/MSBibMapping.java index d1e36b383e6..aa27ebea408 100644 --- a/src/main/java/net/sf/jabref/logic/msbib/MSBibMapping.java +++ b/src/main/java/net/sf/jabref/logic/msbib/MSBibMapping.java @@ -34,6 +34,7 @@ public class MSBibMapping { biblatexToMsBib.put(FieldName.BOOKTITLE, "BookTitle"); biblatexToMsBib.put("shorttitle", "ShortTitle"); biblatexToMsBib.put(FieldName.NOTE, "Comments"); + biblatexToMsBib.put(FieldName.VOLUMES, "NumberVolumes"); //biblatexToMsBib.put(FieldName.BOOKTITLE, "ConferenceName"); //biblatexToMsBib.put(FieldName.PAGES, "Pages"); @@ -51,6 +52,7 @@ public class MSBibMapping { biblatexToMsBib.put(FieldName.KEYWORDS, BIBTEX_PREFIX + "KeyWords"); biblatexToMsBib.put(FieldName.CROSSREF, BIBTEX_PREFIX + "CrossRef"); biblatexToMsBib.put(FieldName.HOWPUBLISHED, BIBTEX_PREFIX + "HowPublished"); + biblatexToMsBib.put(FieldName.PUBSTATE, BIBTEX_PREFIX + "Pubstate"); biblatexToMsBib.put("affiliation", BIBTEX_PREFIX + "Affiliation"); biblatexToMsBib.put("contents", BIBTEX_PREFIX + "Contents"); biblatexToMsBib.put("copyright", BIBTEX_PREFIX + "Copyright"); @@ -61,7 +63,6 @@ public class MSBibMapping { biblatexToMsBib.put(FieldName.KEY, BIBTEX_PREFIX + "Key"); // MSBib only fields - biblatexToMsBib.put(MSBIB_PREFIX + "numberofvolume", "NumberVolumes"); biblatexToMsBib.put(MSBIB_PREFIX + "periodical", "PeriodicalTitle"); biblatexToMsBib.put(MSBIB_PREFIX + FieldName.DAY, "Day"); biblatexToMsBib.put(MSBIB_PREFIX + "accessed", "Accessed"); @@ -79,7 +80,6 @@ public class MSBibMapping { biblatexToMsBib.put(MSBIB_PREFIX + "productioncompany", "ProductionCompany"); } - public static String getBibLaTeXEntryType(String msbibType) { final String defaultType = BibtexEntryTypes.MISC.getName(); diff --git a/src/test/java/net/sf/jabref/logic/exporter/BibTeXMLExporterTestFiles.java b/src/test/java/net/sf/jabref/logic/exporter/BibTeXMLExporterTestFiles.java index 8d4226f58f5..59cce4f5845 100644 --- a/src/test/java/net/sf/jabref/logic/exporter/BibTeXMLExporterTestFiles.java +++ b/src/test/java/net/sf/jabref/logic/exporter/BibTeXMLExporterTestFiles.java @@ -33,7 +33,6 @@ import org.xmlunit.diff.ElementSelectors; import org.xmlunit.matchers.CompareMatcher; - @RunWith(Parameterized.class) public class BibTeXMLExporterTestFiles { @@ -50,7 +49,6 @@ public class BibTeXMLExporterTestFiles { @Rule public TemporaryFolder testFolder = new TemporaryFolder(); - @Parameters(name = "{0}") public static Collection fileNames() throws IOException, URISyntaxException { try (Stream stream = Files.list(Paths.get(BibTeXMLExporterTestFiles.class.getResource("").toURI()))) { diff --git a/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest1.bib b/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest1.bib index cb202e6c730..e0c3ab92a86 100644 --- a/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest1.bib +++ b/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest1.bib @@ -9,7 +9,6 @@ @Unpublished{ msbib-day = {5}, msbib-distributor = {dist}, msbib-medium = {med}, - msbib-numberofvolume = {10}, msbib-periodical = {peri}, msbib-productioncompany = {produktion}, msbib-recordingnumber = {record}, @@ -26,6 +25,7 @@ @Unpublished{ size = {1000}, sourcetype = {Interview}, timestamp = {2016.08.19}, + volumes = {10} } @Comment{jabref-meta: databaseType:biblatex;} diff --git a/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest3.bib b/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest3.bib index 2f1dcea8447..827608e5099 100644 --- a/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest3.bib +++ b/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest3.bib @@ -1,3 +1,4 @@ +% Encoding: UTF-8 @manual{raey, author = {5}, journal = {Wirtschaftsinformatik}, @@ -12,3 +13,5 @@ @manual{raey volume = {44}, year = {2002} } + +@Comment{jabref-meta: databaseType:bibtex;} diff --git a/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest7.bib b/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest7.bib index 3767d3c90b0..cc8394b1fea 100644 --- a/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest7.bib +++ b/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest7.bib @@ -1,13 +1,14 @@ % Encoding: UTF-8 -@article{Orlowski;2011, - author = {Adam Czarnecki; Cezary Orłowski;}, - title = {Application of Ontology In the ITIL Domain}, - year = {2011}, - publisher = {Oficyna Wydawnicza Politechniki Wrocławskiej}, - pages = {99--108}, - doi = {10.13140/2.1.3259.2169}, - journal = {Information Systems Architecture and Technology: Service Oriented Networked Systems}, +@Article{Orlowski;2011, + author = {Adam Czarnecki; Cezary Orłowski;}, + title = {Application of Ontology In the ITIL Domain}, + year = {2011}, + pages = {99--108}, + doi = {10.13140/2.1.3259.2169}, + pubstate = {submitted}, + journal = {Information Systems Architecture and Technology: Service Oriented Networked Systems}, + publisher = {Oficyna Wydawnicza Politechniki Wrocławskiej}, } @Comment{jabref-meta: databaseType:biblatex;} diff --git a/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest7.xml b/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest7.xml index 4126bf24e76..a7a386f6f55 100644 --- a/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest7.xml +++ b/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest7.xml @@ -1,6 +1,7 @@ - + +submitted 2011 article JournalArticle diff --git a/src/test/resources/net/sf/jabref/logic/importer/fileformat/MsBibImporterMsBibFieldsTest.bib b/src/test/resources/net/sf/jabref/logic/importer/fileformat/MsBibImporterMsBibFieldsTest.bib index 60157c7651b..d3d544d6547 100644 --- a/src/test/resources/net/sf/jabref/logic/importer/fileformat/MsBibImporterMsBibFieldsTest.bib +++ b/src/test/resources/net/sf/jabref/logic/importer/fileformat/MsBibImporterMsBibFieldsTest.bib @@ -9,7 +9,6 @@ @Article{ msbib-court = {court}, msbib-distributor = {dist}, msbib-medium = {med}, - msbib-numberofvolume = {10}, msbib-periodical = {Besondere Turingmaschinen}, msbib-productioncompany = {produktion}, msbib-recordingnumber = {record}, @@ -20,6 +19,7 @@ @Article{ price = {10}, school = {Gymnasium Unterrieden}, size = {1000}, + volumes = {10}, } @Comment{jabref-meta: databaseType:bibtex;} From 937628e80e7a3c6c1efff224666ffa1ab4e64a34 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Thu, 2 Feb 2017 18:38:48 +0100 Subject: [PATCH 2/3] Add changelot --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e00d5525c21..1d3e85eaacc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,10 +20,12 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - Redesigned journal abbreviations dialog. - Redesigned error console. - All file dialogs now use the native file selector of the OS. [#1711](https://github.com/JabRef/jabref/issues/1711) +- The MS-Office XML export now exports the field `volumes` and `pubstate`. ### Fixed - Repairs the handling of apostrophes in the LaTeX to unicode conversion. [#2500](https://github.com/JabRef/jabref/issues/2500) - + - We fixed the export of the `number` field in MS-Office XML export. [#2509](https://github.com/JabRef/jabref/issues/2509) + - The field `issue` is now always exported to the corresponding `issue` field in MS-Office XML. ### Removed From 7baa10de13a67aa2f6301d2a93ad532cd18eae7c Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Fri, 3 Feb 2017 11:02:47 +0100 Subject: [PATCH 3/3] Fix formatting --- CHANGELOG.md | 2 +- .../net/sf/jabref/logic/exporter/MsBibExportFormatTest1.bib | 2 +- .../logic/importer/fileformat/MsBibImporterMsBibFieldsTest.bib | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94808ae2c2c..35cf1319ab0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - Repairs the handling of apostrophes in the LaTeX to unicode conversion. [#2500](https://github.com/JabRef/jabref/issues/2500) - Fix import of journal title in ris format. [#2506](https://github.com/JabRef/jabref/issues/2506) - We fixed the export of the `number` field in MS-Office XML export. [#2509](https://github.com/JabRef/jabref/issues/2509) - - The field `issue` is now always exported to the corresponding `issue` field in MS-Office XML. + - The field `issue` is now always exported to the corresponding `issue` field in MS-Office XML. ### Removed diff --git a/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest1.bib b/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest1.bib index e0c3ab92a86..e545e82a15c 100644 --- a/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest1.bib +++ b/src/test/resources/net/sf/jabref/logic/exporter/MsBibExportFormatTest1.bib @@ -25,7 +25,7 @@ @Unpublished{ size = {1000}, sourcetype = {Interview}, timestamp = {2016.08.19}, - volumes = {10} + volumes = {10}, } @Comment{jabref-meta: databaseType:biblatex;} diff --git a/src/test/resources/net/sf/jabref/logic/importer/fileformat/MsBibImporterMsBibFieldsTest.bib b/src/test/resources/net/sf/jabref/logic/importer/fileformat/MsBibImporterMsBibFieldsTest.bib index d3d544d6547..979652b9119 100644 --- a/src/test/resources/net/sf/jabref/logic/importer/fileformat/MsBibImporterMsBibFieldsTest.bib +++ b/src/test/resources/net/sf/jabref/logic/importer/fileformat/MsBibImporterMsBibFieldsTest.bib @@ -19,7 +19,7 @@ @Article{ price = {10}, school = {Gymnasium Unterrieden}, size = {1000}, - volumes = {10}, + volumes = {10}, } @Comment{jabref-meta: databaseType:bibtex;}