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 number field as number if not patent or issue in office 07 xml #1931

Merged
merged 3 commits into from
Sep 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- [#1897](https://github.com/JabRef/jabref/issues/1897) Implemented integrity check for `year` field: Last four nonpunctuation characters should be numerals
- Address in MS-Office 2007 xml format is now imported as `location`
- [#1912](https://github.com/JabRef/jabref/issues/1912) Implemented integrity check for `edition` field: Should have the first letter capitalized (BibTeX), Should contain an integer or a literal (BibLaTeX)
- `number` field is now exported as `number` field in MS-Office 2007 xml format, if no `issue` field is present and the entry type is not `patent`
- `note` field is now exported as `comments` field in MS-Office 2007 xml format
- `comments` field in MS-Office 2007 xml format is now imported as `note` field
- [#463](https://github.com/JabRef/jabref/issues/463): Disable menu-item and toolbar-buttons while no database is open

### Fixed
Expand All @@ -29,6 +32,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- Fixed [#1663](https://github.com/JabRef/jabref/issues/1663): Better multi-monitor support
- Fixed [#1882](https://github.com/JabRef/jabref/issues/1882): Crash after saving illegal bibtexkey in entry editor
- Fixed field `location` containing only city is not exported correctly to MS-Office 2007 xml format
- Fixed field `key` field is not exported to MS-Office 2008 xml format

### Removed
- The non-supported feature of being able to define file directories for any extension is removed. Still, it should work for older databases using the legacy `ps` and `pdf` fields, although we strongly encourage using the `file` field.
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/net/sf/jabref/logic/msbib/MSBibConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ 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);
}

if ("Patent".equalsIgnoreCase(entry.getType())) {
result.patentNumber = entry.getField(FieldName.NUMBER).orElse(null);
result.number = null;
}

result.journalName = entry.getFieldOrAlias(FieldName.JOURNAL).orElse(null);
Expand All @@ -59,9 +64,6 @@ public static MSBibEntry convert(BibEntry entry) {
result.year = entry.getFieldOrAlias(FieldName.YEAR).orElse(null);
}

if (!entry.getField(FieldName.ISSUE).isPresent()) {
result.number = entry.getField(FieldName.NUMBER).orElse(null);
}
// Value must be converted
//Currently only english is supported
entry.getField(FieldName.LANGUAGE)
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/sf/jabref/logic/msbib/MSBibEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ public Element getEntryDom(Document document) {
addField(document, rootNode, "JournalName", journalName);
addField(document, rootNode, "PatentNumber", patentNumber);

addField(document, rootNode, "Number", number);

addField(document, rootNode, "StandardNumber", standardNumber);
addField(document, rootNode, "ConferenceName", conferenceName);

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/net/sf/jabref/logic/msbib/MSBibMapping.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public class MSBibMapping {
biblatexToMsBib.put(FieldName.EDITION, "Edition");
biblatexToMsBib.put(FieldName.PUBLISHER, "Publisher");
biblatexToMsBib.put(FieldName.BOOKTITLE, "BookTitle");
biblatexToMsBib.put("shorttitle", "ShortTitle");
biblatexToMsBib.put(FieldName.NOTE, "Comments");

//biblatexToMsBib.put(FieldName.BOOKTITLE, "ConferenceName");
//biblatexToMsBib.put(FieldName.PAGES, "Pages");
biblatexToMsBib.put(FieldName.CHAPTER, "ChapterNumber");
Expand All @@ -42,6 +45,7 @@ public class MSBibMapping {
biblatexToMsBib.put(FieldName.DOI, "DOI");
biblatexToMsBib.put(FieldName.URL, "URL");
// BibTeX/Biblatex only fields

biblatexToMsBib.put(FieldName.SERIES, BIBTEX_PREFIX + "Series");
biblatexToMsBib.put(FieldName.ABSTRACT, BIBTEX_PREFIX + "Abstract");
biblatexToMsBib.put(FieldName.KEYWORDS, BIBTEX_PREFIX + "KeyWords");
Expand All @@ -54,7 +58,8 @@ public class MSBibMapping {
biblatexToMsBib.put("size", BIBTEX_PREFIX + "Size");
biblatexToMsBib.put("intype", BIBTEX_PREFIX + "InType");
biblatexToMsBib.put("paper", BIBTEX_PREFIX + "Paper");
biblatexToMsBib.put("shorttitle", "ShortTitle");
biblatexToMsBib.put(FieldName.KEY, BIBTEX_PREFIX + "Key");

// MSBib only fields
biblatexToMsBib.put(MSBIB_PREFIX + "numberofvolume", "NumberVolumes");
biblatexToMsBib.put(MSBIB_PREFIX + "periodical", "PeriodicalTitle");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<b:Author/>
<b:Pages>237-248</b:Pages>
<b:JournalName>Wirtschaftsinformatik</b:JournalName>
<b:Number>3</b:Number>
<b:City>a</b:City>
<b:StateProvince/>
<b:CountryRegion/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<b:Sources xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" SelectedStyle="">
<b:Source>
<b:SourceType>Report</b:SourceType>
<b:BIBTEX_Entry>manual</b:BIBTEX_Entry>
<b:Tag>raey</b:Tag>
<b:LCID>0</b:LCID>
<b:Title>Agile Entwicklung Web-basierter Systeme</b:Title>
<b:Year>2002</b:Year>
<b:Volume>44</b:Volume>
<b:BIBTEX_Entry>manual</b:BIBTEX_Entry>
<b:SourceType>Report</b:SourceType>
<b:Title>Agile Entwicklung Web-basierter Systeme</b:Title>
<b:Tag>raey</b:Tag>
<b:Publisher>Gabler Verlag</b:Publisher>
<b:BIBTEX_KeyWords>software development processes; agile software development environments; time-to-market; Extreme Programming; Crystal methods family; Adaptive Software Development</b:BIBTEX_KeyWords>
<b:URL>http://dx.doi.org/10.1007/BF03250842</b:URL>
<b:Author>
<b:Author>
<b:NameList>
Expand All @@ -17,11 +21,8 @@
</b:Author>
</b:Author>
<b:Pages>237-248</b:Pages>
<b:Volume>44</b:Volume>
<b:StandardNumber>LCCN: 0937-6429</b:StandardNumber>
<b:Publisher>Gabler Verlag</b:Publisher>
<b:JournalName>Wirtschaftsinformatik</b:JournalName>
<b:URL>http://dx.doi.org/10.1007/BF03250842</b:URL>
<b:BIBTEX_KeyWords>software development processes; agile software development environments; time-to-market; Extreme Programming; Crystal methods family; Adaptive Software Development</b:BIBTEX_KeyWords>
<b:Number>3</b:Number>
<b:StandardNumber>LCCN: 0937-6429</b:StandardNumber>
</b:Source>
</b:Sources>
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<b:Sources xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" SelectedStyle="">
<b:Source>
<b:SourceType>Report</b:SourceType>
<b:BIBTEX_Entry>mastersthesis</b:BIBTEX_Entry>
<b:LCID>0</b:LCID>
<b:Title>Agile Entwicklung Web-basierter Systeme</b:Title>
<b:Year>2002</b:Year>
<b:Author/>
<b:Pages>237-248</b:Pages>
<b:Volume>44</b:Volume>
<b:StandardNumber> MRN: 0937-6429</b:StandardNumber>
<b:BIBTEX_Entry>mastersthesis</b:BIBTEX_Entry>
<b:SourceType>Report</b:SourceType>
<b:Title>Agile Entwicklung Web-basierter Systeme</b:Title>
<b:Publisher>Gabler Verlag</b:Publisher>
<b:BIBTEX_KeyWords>software development processes; agile software development environments; time-to-market; Extreme Programming; Crystal methods family; Adaptive Software Development</b:BIBTEX_KeyWords>
<b:URL>http://dx.doi.org/10.1007/BF03250842</b:URL>
<b:Author/>
<b:Pages>237-248</b:Pages>
<b:JournalName>Wirtschaftsinformatik</b:JournalName>
<b:Number>3</b:Number>
<b:StandardNumber> MRN: 0937-6429</b:StandardNumber>
<b:ThesisType>Master's thesis</b:ThesisType>
<b:URL>http://dx.doi.org/10.1007/BF03250842</b:URL>
<b:BIBTEX_KeyWords>software development processes; agile software development environments; time-to-market; Extreme Programming; Crystal methods family; Adaptive Software Development</b:BIBTEX_KeyWords>
</b:Source>
</b:Sources>
12 changes: 12 additions & 0 deletions src/test/resources/net/sf/jabref/logic/exporter/MsBibKeyTest.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
% Encoding: UTF-8

@Mycustomentrytype{SampleAuthor2012,
author = {SampleAuthor},
year = {2012},
date = {2012},
key = {MyStandardKey},
}

@Comment{jabref-meta: databaseType:biblatex;}

@Comment{jabref-entrytype: Mycustomentrytype: req[author;year/date;key] opt[]}
19 changes: 19 additions & 0 deletions src/test/resources/net/sf/jabref/logic/exporter/MsBibKeyTest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<b:Sources xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" SelectedStyle="">
<b:Source>
<b:BIBTEX_Key>MyStandardKey</b:BIBTEX_Key>
<b:Year>2012</b:Year>
<b:BIBTEX_Entry>mycustomentrytype</b:BIBTEX_Entry>
<b:SourceType>Misc</b:SourceType>
<b:Tag>SampleAuthor2012</b:Tag>
<b:Author>
<b:Author>
<b:NameList>
<b:Person>
<b:Last>SampleAuthor</b:Last>
</b:Person>
</b:NameList>
</b:Author>
</b:Author>
</b:Source>
</b:Sources>