Skip to content

Commit 147ffca

Browse files
DevSiroukanetobiasdiez
authored andcommitted
Fix IEEE preview does not display month (#3983)
* 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)
1 parent 9437ed8 commit 147ffca

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import org.jabref.logic.formatter.bibtexfields.RemoveNewlinesFormatter;
1010
import org.jabref.logic.layout.format.HTMLChars;
1111
import org.jabref.model.entry.BibEntry;
12+
import org.jabref.model.entry.FieldName;
13+
import org.jabref.model.entry.Month;
1214

1315
import de.undercouch.citeproc.CSL;
1416
import de.undercouch.citeproc.ItemDataProvider;
@@ -82,6 +84,9 @@ private static class JabRefItemDataProvider implements ItemDataProvider {
8284

8385
/**
8486
* Converts the {@link BibEntry} into {@link CSLItemData}.
87+
*
88+
* Change month field from JabRefFormat <code>#mon#</> to ShortName <code>mon</code>
89+
* because CSL does not support JabRefFormat.
8590
*/
8691
private static CSLItemData bibEntryToCSLItemData(BibEntry bibEntry) {
8792
String citeKey = bibEntry.getCiteKeyOptional().orElse("");
@@ -94,7 +99,12 @@ private static CSLItemData bibEntryToCSLItemData(BibEntry bibEntry) {
9499
bibEntry.getField(key)
95100
.map(removeNewlinesFormatter::format)
96101
.map(latexToHtmlConverter::format)
97-
.ifPresent(value -> bibTeXEntry.addField(new Key(key), new DigitStringValue(value)));
102+
.ifPresent(value -> {
103+
if (FieldName.MONTH.equals(key)) {
104+
value = bibEntry.getMonth().map(Month::getShortName).orElse(value);
105+
}
106+
bibTeXEntry.addField(new Key(key), new DigitStringValue(value));
107+
});
98108
}
99109
return BIBTEX_CONVERTER.toItemData(bibTeXEntry);
100110
}

0 commit comments

Comments
 (0)