Skip to content

Commit

Permalink
Fix IEEE preview does not display month (#3983)
Browse files Browse the repository at this point in the history
* Fix IEEE preview does not display month (#3239)

On month change from comboBox on OptionalFieldsTab:
1. Month was not appear on IEEE style.
2. Month was not written correctly on SourceTab.
both issues get fixed.

* Fix IEEE preview does not display month (#3239)

#3983 (comment)

* Fix IEEE preview does not display month (#3239)

#3983 (comment)

* Fix IEEE preview does not display month (#3239)

Wrong order for 'org.jabref.model.entry.FieldName' import.

* Fix IEEE preview does not display month (#3239)

fix missing check style issue

* Fix IEEE preview does not display month (#3239)

Remove Superfluous Comments
#3983 (comment)

* Fix IEEE preview does not display month (#3239)

Make change direct on bibTeXEntry instead of creating a copy of bibEntry

* Fix IEEE preview does not display month (#3239)

fix check style issue

* Fix IEEE preview does not display month (#3239)

#3983 (comment)
  • Loading branch information
DevSiroukane authored and tobiasdiez committed May 2, 2018
1 parent 9437ed8 commit 147ffca
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import org.jabref.logic.formatter.bibtexfields.RemoveNewlinesFormatter;
import org.jabref.logic.layout.format.HTMLChars;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.FieldName;
import org.jabref.model.entry.Month;

import de.undercouch.citeproc.CSL;
import de.undercouch.citeproc.ItemDataProvider;
Expand Down Expand Up @@ -82,6 +84,9 @@ private static class JabRefItemDataProvider implements ItemDataProvider {

/**
* Converts the {@link BibEntry} into {@link CSLItemData}.
*
* Change month field from JabRefFormat <code>#mon#</> to ShortName <code>mon</code>
* because CSL does not support JabRefFormat.
*/
private static CSLItemData bibEntryToCSLItemData(BibEntry bibEntry) {
String citeKey = bibEntry.getCiteKeyOptional().orElse("");
Expand All @@ -94,7 +99,12 @@ private static CSLItemData bibEntryToCSLItemData(BibEntry bibEntry) {
bibEntry.getField(key)
.map(removeNewlinesFormatter::format)
.map(latexToHtmlConverter::format)
.ifPresent(value -> bibTeXEntry.addField(new Key(key), new DigitStringValue(value)));
.ifPresent(value -> {
if (FieldName.MONTH.equals(key)) {
value = bibEntry.getMonth().map(Month::getShortName).orElse(value);
}
bibTeXEntry.addField(new Key(key), new DigitStringValue(value));
});
}
return BIBTEX_CONVERTER.toItemData(bibTeXEntry);
}
Expand Down

0 comments on commit 147ffca

Please sign in to comment.