-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix IEEE preview does not display month #3983
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
Changes from 1 commit
6738711
4d7525e
99c6dd5
cb5a8a3
0255d0f
2f022b2
82b05d1
f548163
eb2ad39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment states the same as it is done in the code. So please "Remove Superfluous Comments" Java by Comparison. You can also describe, why a clone is generated! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a good comment?
Clone was generated because bibEntry is shared with many objects. So, to be sure that non of this objects may have issue after changing month field. I create a copy to change on it. |
||
bibEntry = (BibEntry) bibEntry.clone(); | ||
// change month field from "#mon#" to "mon" | ||
if((bibEntry.getFieldMap().get(FieldName.MONTH) != null) && !bibEntry.getFieldMap().get(FieldName.MONTH).isEmpty()){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would actually move this in the loop below. Has the advantage that you don't need to clone the entry.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you test if this works? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does not work, as LatexFieldFormatter a) needs preferences object b) has only a two argument format method and does not implment the interface There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, but it works "with obvious modifications" 😀 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Siedlerchr I try ur suggestion but it didnt work.
I will keep the instruction that I made.
What do you think? |
||
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)); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please explain the reason for this change. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method were create only for "#%s#" forma I guess. The output should be "{%s}" to have this result for month
not this
check this on #3239
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mhh, I'm pretty sure that
month = jan
is the correct form and notmonth = {jan}
. Maybe @koppor can clarify this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here what happen if you did not add {}.

as you can see the return of 2005 is in side {} but the return of month isnt it.
the method executed to return year = {2005}
https://github.com/DevSiroukane/jabref/blob/67387113513ce9529e08b62ffc430d13e24f0b4b/src/main/java/org/jabref/logic/bibtex/LatexFieldFormatter.java#L157
the method executed to return month = mon when month field is in this forma "#%s#".
https://github.com/DevSiroukane/jabref/blob/67387113513ce9529e08b62ffc430d13e24f0b4b/src/main/java/org/jabref/logic/bibtex/LatexFieldFormatter.java#L163
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we know that bibTeX forma should be
u can add a debug instruction here LatexFieldFormatter.java#L166
and see the out put after each change in any field. You will find that only month output is wrong if we miss the {} that I add on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DevSiroukane You are confusing it here. If it's
#month#
it should be displayed without braces in the source. So the entry editor part was already correct.Only when it's
month
->{month}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Siedlerchr are you sure that month should not be between {} on source tab?
because I try to use generate entry using DOI (ex: 10.1109/TSG.2014.2346511) and the out put is this on source tab:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the month does not need be in braces. Its a feature of bibtex called "Bibtex Strings", see e.g. http://www.bibtex.org/Format/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Siedlerchr I think I should let source tab month appear as before
I will remove the change as you said @tobiasdiez