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

6658 Swapped extra quotes for double brackets in bibtex citation, title #6674

Merged
merged 1 commit into from Feb 26, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/DataCitation.java
Expand Up @@ -265,12 +265,12 @@ public void writeAsBibtexCitation(OutputStream os) throws IOException {
out.write(title);
out.write("},\r\n");
} else {
out.write("title = \"{");
out.write("title = {{");
String doubleQ = "\"";
String doubleTick = "``";
String doubleAp = "''";
out.write(title.replaceFirst(doubleQ, doubleTick).replaceFirst(doubleQ, doubleAp));
out.write("}\",\r\n");
out.write("}},\r\n");
}
if(UNF != null){
out.write("UNF = {");
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/edu/harvard/iq/dataverse/DataCitationTest.java
Expand Up @@ -72,7 +72,7 @@ public void testWriteAsBibtexCitation() throws ParseException, IOException {
"@data{LK0D1H_1955,\r\n"
+ "author = {First Last},\r\n"
+ "publisher = {LibraScholar},\r\n"
+ "title = \"{Dataset Title}\",\r\n"
+ "title = {{Dataset Title}},\r\n"
+ "year = {1955},\r\n"
+ "version = {V1},\r\n"
+ "doi = {10.5072/FK2/LK0D1H},\r\n"
Expand All @@ -95,7 +95,7 @@ public void testToBibtexString() throws ParseException {
"@data{LK0D1H_1955,\r\n"
+ "author = {First Last},\r\n"
+ "publisher = {LibraScholar},\r\n"
+ "title = \"{Dataset Title}\",\r\n"
+ "title = {{Dataset Title}},\r\n"
+ "year = {1955},\r\n"
+ "version = {V1},\r\n"
+ "doi = {10.5072/FK2/LK0D1H},\r\n"
Expand All @@ -119,7 +119,7 @@ public void testToBibtexString_withoutAuthor() throws ParseException {
"@data{LK0D1H_1955,\r\n"
+ "author = {},\r\n"
+ "publisher = {LibraScholar},\r\n"
+ "title = \"{Dataset Title}\",\r\n"
+ "title = {{Dataset Title}},\r\n"
+ "year = {1955},\r\n"
+ "version = {V1},\r\n"
+ "doi = {10.5072/FK2/LK0D1H},\r\n"
Expand All @@ -144,7 +144,7 @@ public void testToBibtexString_withoutTitle() throws ParseException {
"@data{LK0D1H_1955,\r\n"
+ "author = {First Last},\r\n"
+ "publisher = {LibraScholar},\r\n"
+ "title = \"{}\",\r\n"
+ "title = {{}},\r\n"
+ "year = {1955},\r\n"
+ "version = {V1},\r\n"
+ "doi = {10.5072/FK2/LK0D1H},\r\n"
Expand All @@ -169,7 +169,7 @@ public void testToBibtexString_withoutTitleAndAuthor() throws ParseException {
"@data{LK0D1H_1955,\r\n"
+ "author = {},\r\n"
+ "publisher = {LibraScholar},\r\n"
+ "title = \"{}\",\r\n"
+ "title = {{}},\r\n"
+ "year = {1955},\r\n"
+ "version = {V1},\r\n"
+ "doi = {10.5072/FK2/LK0D1H},\r\n"
Expand Down Expand Up @@ -335,7 +335,7 @@ public void testTitleWithQuotes() throws ParseException {
"@data{LK0D1H_1955,\r\n"
+ "author = {First Last},\r\n"
+ "publisher = {LibraScholar},\r\n"
+ "title = \"{This Title ``Has Quotes'' In It}\",\r\n"
+ "title = {{This Title ``Has Quotes'' In It}},\r\n"
+ "year = {1955},\r\n"
+ "version = {V1},\r\n"
+ "doi = {10.5072/FK2/LK0D1H},\r\n"
Expand Down