Skip to content
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

Add latex2unicode formatter for displaying previews #5785

Merged
merged 3 commits into from
Dec 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#

- We fixed an issue where the Medline fetcher was only working when JabRef was running from source [#5645](https://github.com/JabRef/jabref/issues/5645)
- We fixed some visual issues in the dark theme [#5764](https://github.com/JabRef/jabref/pull/5764) [#5753](https://github.com/JabRef/jabref/issues/5753)
- We fixed an issue where non-default previews didn't handle unicode characters. [#5779](https://github.com/JabRef/jabref/issues/5779)


### Removed

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import de.undercouch.citeproc.bibtex.BibTeXConverter;
import de.undercouch.citeproc.csl.CSLItemData;
import de.undercouch.citeproc.output.Bibliography;
import org.jabref.model.strings.LatexToUnicodeAdapter;
import org.jbibtex.BibTeXEntry;
import org.jbibtex.DigitStringValue;
import org.jbibtex.Key;
Expand Down Expand Up @@ -97,6 +98,7 @@ private static CSLItemData bibEntryToCSLItemData(BibEntry bibEntry) {
for (Field key : bibEntry.getFieldMap().keySet()) {
bibEntry.getField(key)
.map(removeNewlinesFormatter::format)
.map(LatexToUnicodeAdapter::format)
.map(latexToHtmlConverter::format)
.ifPresent(value -> {
if (StandardField.MONTH.equals(key)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,17 @@ void testXslFoFormat() {
String actualCitation = CitationStyleGenerator.generateCitation(entry, style, format);
assertEquals(expectedCitation, actualCitation);
}

@Test
void testHandleDiacritics() {
BibEntry entry = new BibEntry();
entry.setField(StandardField.AUTHOR, "L{\"a}st, First and Doe, Jane");
// if the default citation style changes this has to be modified.
// in this case ä was added to check if it is formatted appropriately
String expected = " <div class=\"csl-entry\">\n" +
" <div class=\"csl-left-margin\">[1]</div><div class=\"csl-right-inline\">F. Läst and J. Doe, .</div>\n" +
" </div>\n";
String citation = CitationStyleGenerator.generateCitation(entry, CitationStyle.getDefault());
assertEquals(expected, citation);
}
}