Skip to content

Commit

Permalink
Fix IEEE preview does not display month (JabRef#3239)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DrSiroukane committed Apr 26, 2018
1 parent 1092571 commit 6738711
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ private void writeText(String text, int startPos, int endPos) {

private void writeStringLabel(String text, int startPos, int endPos,
boolean first, boolean last) {
putIn((first ? "" : " # ") + text.substring(startPos, endPos)
+ (last ? "" : " # "));
putIn((first ? "{" : " # ") + text.substring(startPos, endPos)
+ (last ? "}" : " # "));
}

private void putIn(String s) {
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import de.undercouch.citeproc.bibtex.BibTeXConverter;
import de.undercouch.citeproc.csl.CSLItemData;
import de.undercouch.citeproc.output.Bibliography;
import org.jabref.model.entry.FieldName;
import org.jbibtex.BibTeXEntry;
import org.jbibtex.DigitStringValue;
import org.jbibtex.Key;
Expand Down Expand Up @@ -84,6 +85,14 @@ private static class JabRefItemDataProvider implements ItemDataProvider {
* Converts the {@link BibEntry} into {@link CSLItemData}.
*/
private static CSLItemData bibEntryToCSLItemData(BibEntry bibEntry) {

// create a copy of bibEntry
bibEntry = (BibEntry) bibEntry.clone();
// change month field from "#mon#" to "mon"
if((bibEntry.getFieldMap().get(FieldName.MONTH) != null) && !bibEntry.getFieldMap().get(FieldName.MONTH).isEmpty()){
bibEntry.getFieldMap().put(FieldName.MONTH, bibEntry.getMonth().get().getShortName());
}

String citeKey = bibEntry.getCiteKeyOptional().orElse("");
BibTeXEntry bibTeXEntry = new BibTeXEntry(new Key(bibEntry.getType()), new Key(citeKey));

Expand Down

0 comments on commit 6738711

Please sign in to comment.