Skip to content

Commit

Permalink
fix BibTeXML exporter to comply with unified month format
Browse files Browse the repository at this point in the history
  • Loading branch information
sfo committed Sep 9, 2019
1 parent 82e669d commit dff8170
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/org/jabref/logic/exporter/BibTeXMLExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;

import javax.xml.bind.JAXBContext;
Expand Down Expand Up @@ -40,6 +41,7 @@
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.Month;
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.types.EntryType;
Expand Down Expand Up @@ -153,6 +155,13 @@ private void parseInbook(Inbook inbook, BibEntry bibEntry, Entry entry) {
JAXBElement<BigInteger> number = new JAXBElement<>(new QName(BIBTEXML_NAMESPACE_URI, "number"),
BigInteger.class, new BigInteger(value));
inbook.getContent().add(number);
} else if (StandardField.MONTH.equals(key)) {
Optional<Month> month = bibEntry.getMonth();
if (month.isPresent()) {
JAXBElement<String> element = new JAXBElement<>(new QName(BIBTEXML_NAMESPACE_URI, key.getName()),
String.class, month.get().getFullName());
inbook.getContent().add(element);
}
} else {
JAXBElement<String> element = new JAXBElement<>(new QName(BIBTEXML_NAMESPACE_URI, key.getName()), String.class,
value);
Expand Down Expand Up @@ -205,6 +214,12 @@ private <T> void parse(T entryType, BibEntry bibEntry, Entry entry) {
LOGGER.warn("The value %s of the 'number' field is not an integer and thus is ignored for the export", value);
}
break;
} else if (StandardField.MONTH.equals(key)) {
Optional<Month> month = bibEntry.getMonth();
if (month.isPresent()) {
method.invoke(entryType, month.get().getFullName());
}
break;
} else {
method.invoke(entryType, value);
break;
Expand Down

0 comments on commit dff8170

Please sign in to comment.