@@ -27,6 +27,7 @@ class CitationStyleGeneratorTest {
27
27
private static final String DEFAULT_STYLE = CSLStyleLoader .getDefaultStyle ().getSource ();
28
28
private static final CitationStyleOutputFormat HTML_OUTPUT_FORMAT = CitationStyleOutputFormat .HTML ;
29
29
private static final CitationStyleOutputFormat TEXT_OUTPUT_FORMAT = CitationStyleOutputFormat .TEXT ;
30
+ private static final CitationStyleOutputFormat MARKDOWN_OUTPUT_FORMAT = CitationStyleOutputFormat .MARKDOWN ;
30
31
private static final BibEntryTypesManager ENTRY_TYPES_MANAGER = new BibEntryTypesManager ();
31
32
32
33
private final BibEntry testEntry = TestEntry .getTestEntry ();
@@ -150,9 +151,11 @@ void ignoreCarriageReturnNewLine() {
150
151
entry .setField (StandardField .AUTHOR , "Last, First and\r \n Doe, Jane" );
151
152
152
153
// if the default citation style changes this has to be modified
153
- String expected = " <div class=\" csl-entry\" >\n " +
154
- " <div class=\" csl-left-margin\" >[1]</div><div class=\" csl-right-inline\" >F. Last and J. Doe, </div>\n " +
155
- " </div>\n " ;
154
+ String expected = """
155
+ <div class="csl-entry">
156
+ <div class="csl-left-margin">[1]</div><div class="csl-right-inline">F. Last and J. Doe, </div>
157
+ </div>
158
+ """ ;
156
159
String citation = CitationStyleGenerator .generateBibliography (List .of (entry ), DEFAULT_STYLE , ENTRY_TYPES_MANAGER );
157
160
assertEquals (expected , citation );
158
161
}
@@ -168,9 +171,11 @@ void missingCitationStyle() {
168
171
169
172
@ Test
170
173
void htmlFormat () {
171
- String expectedCitation = " <div class=\" csl-entry\" >\n " +
172
- " <div class=\" csl-left-margin\" >[1]</div><div class=\" csl-right-inline\" >B. Smith, B. Jones, and J. Williams, “Title of the test entry,” <span style=\" font-style: italic\" >BibTeX Journal</span>, vol. 34, no. 3, pp. 45–67, July 2016, doi: 10.1001/bla.blubb.</div>\n " +
173
- " </div>\n " ;
174
+ String expectedCitation = """
175
+ <div class="csl-entry">
176
+ <div class="csl-left-margin">[1]</div><div class="csl-right-inline">B. Smith, B. Jones, and J. Williams, “Title of the test entry,” <span style="font-style: italic">BibTeX Journal</span>, vol. 34, no. 3, pp. 45–67, July 2016, doi: 10.1001/bla.blubb.</div>
177
+ </div>
178
+ """ ;
174
179
175
180
String actualCitation = CitationStyleGenerator .generateBibliography (List .of (testEntry ), DEFAULT_STYLE , HTML_OUTPUT_FORMAT , testEntryContext , ENTRY_TYPES_MANAGER ).getFirst ();
176
181
assertEquals (expectedCitation , actualCitation );
@@ -184,6 +189,14 @@ void textFormat() {
184
189
assertEquals (expectedCitation , actualCitation );
185
190
}
186
191
192
+ @ Test
193
+ void markdownFormat () {
194
+ String expectedCitation = "\\ [1\\ ]B\\ . Smith\\ , B\\ . Jones\\ , and J\\ . Williams\\ , “Title of the test entry\\ ,” *BibTeX Journal*\\ , vol\\ . 34\\ , no\\ . 3\\ , pp\\ . 45–67\\ , Jul\\ . 2016\\ , doi\\ : 10\\ .1001\\ /bla\\ .blubb\\ .<br />\n " ;
195
+
196
+ String actualCitation = CitationStyleGenerator .generateBibliography (List .of (testEntry ), DEFAULT_STYLE , MARKDOWN_OUTPUT_FORMAT , testEntryContext , ENTRY_TYPES_MANAGER ).getFirst ();
197
+ assertEquals (expectedCitation , actualCitation );
198
+ }
199
+
187
200
@ Test
188
201
void handleDiacritics () {
189
202
BibEntry entry = new BibEntry ();
@@ -192,9 +205,11 @@ void handleDiacritics() {
192
205
193
206
// if the default citation style changes this has to be modified.
194
207
// in this case ä was added to check if it is formatted appropriately
195
- String expected = " <div class=\" csl-entry\" >\n " +
196
- " <div class=\" csl-left-margin\" >[1]</div><div class=\" csl-right-inline\" >F. Läst and J. Doe, </div>\n " +
197
- " </div>\n " ;
208
+ String expected = """
209
+ <div class="csl-entry">
210
+ <div class="csl-left-margin">[1]</div><div class="csl-right-inline">F. Läst and J. Doe, </div>
211
+ </div>
212
+ """ ;
198
213
String citation = CitationStyleGenerator .generateBibliography (List .of (entry ), DEFAULT_STYLE , ENTRY_TYPES_MANAGER );
199
214
assertEquals (expected , citation );
200
215
}
0 commit comments