git.iko.soy/typeable/pandoc
on master help sign in
RST writer: Omit blank lines after list items.
25e2c42John MacFarlane
src/Text/Pandoc/Writers/RST.hs+3−3
@@ -274,7 +274,7 @@ blockToRST (DefinitionList items) = do
274bulletListItemToRST :: [Block] -> State WriterState Doc
274bulletListItemToRST :: [Block] -> State WriterState Doc
275bulletListItemToRST items = do
275bulletListItemToRST items = do
276 contents <- blockListToRST items
276 contents <- blockListToRST items
277− return $ hang 3 "- " $ contents <> cr
277+ return $ hang 3 "- " contents
278
278
279-- | Convert ordered list item (a list of blocks) to RST.
279-- | Convert ordered list item (a list of blocks) to RST.
280orderedListItemToRST :: String -- ^ marker for list item
280orderedListItemToRST :: String -- ^ marker for list item
@@ -283,7 +283,7 @@ orderedListItemToRST :: String -- ^ marker for list item
283orderedListItemToRST marker items = do
283orderedListItemToRST marker items = do
284 contents <- blockListToRST items
284 contents <- blockListToRST items
285 let marker' = marker ++ " "
285 let marker' = marker ++ " "
286− return $ hang (length marker') (text marker') $ contents <> cr
286+ return $ hang (length marker') (text marker') contents
287
287
288-- | Convert defintion list item (label, list of blocks) to RST.
288-- | Convert defintion list item (label, list of blocks) to RST.
289definitionListItemToRST :: ([Inline], [[Block]]) -> State WriterState Doc
289definitionListItemToRST :: ([Inline], [[Block]]) -> State WriterState Doc
@@ -291,7 +291,7 @@ definitionListItemToRST (label, defs) = do
291 label' <- inlineListToRST label
291 label' <- inlineListToRST label
292 contents <- liftM vcat $ mapM blockListToRST defs
292 contents <- liftM vcat $ mapM blockListToRST defs
293 tabstop <- get >>= (return . writerTabStop . stOptions)
293 tabstop <- get >>= (return . writerTabStop . stOptions)
294− return $ label' $$ nest tabstop (nestle contents <> cr)
294+ return $ label' $$ nest tabstop (nestle contents)
295
295
296-- | Convert list of Pandoc block elements to RST.
296-- | Convert list of Pandoc block elements to RST.
297blockListToRST :: [Block] -- ^ List of block elements
297blockListToRST :: [Block] -- ^ List of block elements
tests/writer.rst+1−23
@@ -136,9 +136,7 @@ Asterisks tight:
136Asterisks loose:
136Asterisks loose:
137
137
138- asterisk 1
138- asterisk 1
139−
140- asterisk 2
139- asterisk 2
141−
142- asterisk 3
140- asterisk 3
143
141
144Pluses tight:
142Pluses tight:
@@ -150,9 +148,7 @@ Pluses tight:
150Pluses loose:
148Pluses loose:
151
149
152- Plus 1
150- Plus 1
153−
154- Plus 2
151- Plus 2
155−
156- Plus 3
152- Plus 3
157
153
158Minuses tight:
154Minuses tight:
@@ -164,9 +160,7 @@ Minuses tight:
164Minuses loose:
160Minuses loose:
165
161
166- Minus 1
162- Minus 1
167−
168- Minus 2
163- Minus 2
169−
170- Minus 3
164- Minus 3
171
165
172Ordered
166Ordered
@@ -187,17 +181,13 @@ and:
187Loose using tabs:
181Loose using tabs:
188
182
1891. First
1831. First
190−
1912. Second
1842. Second
192−
1933. Third
1853. Third
194
186
195and using spaces:
187and using spaces:
196
188
1971. One
1891. One
198−
1992. Two
1902. Two
200−
2013. Three
1913. Three
202
192
203Multiple paragraphs:
193Multiple paragraphs:
@@ -205,9 +195,7 @@ Multiple paragraphs:
2051. Item 1, graf one.
1951. Item 1, graf one.
206
196
207 Item 1. graf two. The quick brown fox jumped over the lazy dog’s back.
197 Item 1. graf two. The quick brown fox jumped over the lazy dog’s back.
208−
2092. Item 2.
1982. Item 2.
210−
2113. Item 3.
1993. Item 3.
212
200
213Nested
201Nested
@@ -227,30 +215,25 @@ Here’s another:
227 - Fee
215 - Fee
228 - Fie
216 - Fie
229 - Foe
217 - Foe
230−
2313. Third
2183. Third
232
219
233Same thing but with paragraphs:
220Same thing but with paragraphs:
234
221
2351. First
2221. First
236−
2372. Second:
2232. Second:
238
224
239 - Fee
225 - Fee
240 - Fie
226 - Fie
241 - Foe
227 - Foe
242−
2433. Third
2283. Third
244
229
245Tabs and spaces
230Tabs and spaces
246---------------
231---------------
247
232
248- this is a list item indented with tabs
233- this is a list item indented with tabs
249−
250- this is a list item indented with spaces
234- this is a list item indented with spaces
251
235
252 - this is an example list item indented with tabs
236 - this is an example list item indented with tabs
253−
254 - this is an example list item indented with spaces
237 - this is an example list item indented with spaces
255
238
256Fancy list markers
239Fancy list markers
@@ -317,10 +300,8 @@ Loose:
317
300
318apple
301apple
319 red fruit
302 red fruit
320−
321orange
303orange
322 orange fruit
304 orange fruit
323−
324banana
305banana
325 yellow fruit
306 yellow fruit
326
307
@@ -330,7 +311,6 @@ Multiple blocks with italics:
330 red fruit
311 red fruit
331
312
332 contains seeds, crisp, pleasant to taste
313 contains seeds, crisp, pleasant to taste
333−
334*orange*
314*orange*
335 orange fruit
315 orange fruit
336
316
@@ -355,7 +335,6 @@ apple
355 red fruit
335 red fruit
356
336
357 computer
337 computer
358−
359orange
338orange
360 orange fruit
339 orange fruit
361
340
@@ -367,7 +346,6 @@ apple
367 red fruit
346 red fruit
368
347
369 computer
348 computer
370−
371orange
349orange
372 orange fruit
350 orange fruit
373
351
@@ -666,7 +644,6 @@ LaTeX
666- Here’s some display math:
644- Here’s some display math:
667
645
668 .. math:: \frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}
646 .. math:: \frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}
669−
670- Here’s one that has a line break in it: :math:`\alpha + \omega \times x^2`.
647- Here’s one that has a line break in it: :math:`\alpha + \omega \times x^2`.
671
648
672These shouldn’t be math:
649These shouldn’t be math:
@@ -839,6 +816,7 @@ From “Voyage dans la Lune” by Georges Melies (1902):
839 :alt: Voyage dans la Lune
816 :alt: Voyage dans la Lune
840
817
841 lalune
818 lalune
819+
842Here is a movie |movie| icon.
820Here is a movie |movie| icon.
843
821
844--------------
822--------------