Describe the bug
When an author is wrapped in curly braces I noticed that the NameParser is correct now but the BibTexConvert does not respect this or rather kills it and thus the NameParser fails to recognize it.
|
for (Map.Entry<Key, Value> field : e.getFields().entrySet()) { |
|
String us = field.getValue().toUserString().replaceAll("\\r", ""); |
|
|
|
// convert LaTeX string to normal text |
|
try { |
|
List<LaTeXObject> objs = latexParser.parse(new StringReader(us)); |
|
us = latexPrinter.print(objs).replaceAll("\\n", " ").replaceAll("\\r", "").trim(); |
|
} catch (ParseException | TokenMgrException ex) { |
|
// ignore |
|
} |
|
|
|
entries.put(field.getKey().getValue().toLowerCase(), us); |
|
} |
Which version of citeproc-java are you using?
3.3.0
Expected behavior
It works
Actual behavior
Names are kept
CSL input
in test
Used style and locale
doesnt matter at this point
Rendered output/Screenshots
If applicable, add the output that citeproc-java produced and/or screenshots to help explain your problem.
Example code/unit test
@Test
public void curlyBracesAreKept() throws ParseException {
String entry = "@online{testcitationkey,\n" +
" author = {{The PGF/TikZ Team} and others},\n" +
" journal = {TUGBoat},\n" +
" title = {pgf – Create PostScript and PDF graphics in TeX},\n" +
" year = {2013},\n" +
" _jabref_shared = {sharedId: -1, version: 1}\n" +
"}";
BibTeXDatabase db = new BibTeXParser().parse(new StringReader(entry));
BibTeXConverter converter = new BibTeXConverter();
Map<String, CSLItemData> items = converter.toItemData(db);
CSLItemData item = items.get("testcitationkey");
var jsonBuilder = new StringJsonBuilderFactory().createJsonBuilder();
CSLName name = new CSLNameBuilder()
.literal("{The PGF/TikZ Team}")
.build();
assertEquals(Optional.of(name.toJson(jsonBuilder)), Arrays.stream(item.getAuthor()).findFirst().map(n->n.toJson(jsonBuilder)));
}
Describe the bug
When an author is wrapped in curly braces I noticed that the NameParser is correct now but the BibTexConvert does not respect this or rather kills it and thus the NameParser fails to recognize it.
citeproc-java/citeproc-java/src/main/java/de/undercouch/citeproc/bibtex/BibTeXConverter.java
Lines 163 to 175 in 560eac3
Which version of citeproc-java are you using?
3.3.0
Expected behavior
It works
Actual behavior
Names are kept
CSL input
in test
Used style and locale
doesnt matter at this point
Rendered output/Screenshots
If applicable, add the output that citeproc-java produced and/or screenshots to help explain your problem.
Example code/unit test