git.iko.soy/typeable/pandoc
on master help sign in
RST writer: Omit blank lines after list items.

They are optional in RST (except after the last list item, of course). Fixes #1777.

commit25e2c42347b9bf71b765984d3d897fae8b1a2edb authorJohn MacFarlane <jgm@berkeley.edu> dateTue 25 Nov 2014, 12:24 (12 years ago) parentdc92a62
2 files changed+4−26
src/Text/Pandoc/Writers/RST.hs+3−3 tests/writer.rst+1−23
src/Text/Pandoc/Writers/RST.hs+3−3
@@ -274,7 +274,7 @@ blockToRST (DefinitionList items) = do
274274bulletListItemToRST :: [Block] -> State WriterState Doc
275275bulletListItemToRST items = do
276276 contents <- blockListToRST items
277− return $ hang 3 "- " $ contents <> cr
277+ return $ hang 3 "- " contents
278278
279279-- | Convert ordered list item (a list of blocks) to RST.
280280orderedListItemToRST :: String -- ^ marker for list item
@@ -283,7 +283,7 @@ orderedListItemToRST :: String -- ^ marker for list item
283283orderedListItemToRST marker items = do
284284 contents <- blockListToRST items
285285 let marker' = marker ++ " "
286− return $ hang (length marker') (text marker') $ contents <> cr
286+ return $ hang (length marker') (text marker') contents
287287
288288-- | Convert defintion list item (label, list of blocks) to RST.
289289definitionListItemToRST :: ([Inline], [[Block]]) -> State WriterState Doc
@@ -291,7 +291,7 @@ definitionListItemToRST (label, defs) = do
291291 label' <- inlineListToRST label
292292 contents <- liftM vcat $ mapM blockListToRST defs
293293 tabstop <- get >>= (return . writerTabStop . stOptions)
294− return $ label' $$ nest tabstop (nestle contents <> cr)
294+ return $ label' $$ nest tabstop (nestle contents)
295295
296296-- | Convert list of Pandoc block elements to RST.
297297blockListToRST :: [Block] -- ^ List of block elements
tests/writer.rst+1−23
@@ -136,9 +136,7 @@ Asterisks tight:
136136Asterisks loose:
137137
138138- asterisk 1
139−
140139- asterisk 2
141−
142140- asterisk 3
143141
144142Pluses tight:
@@ -150,9 +148,7 @@ Pluses tight:
150148Pluses loose:
151149
152150- Plus 1
153−
154151- Plus 2
155−
156152- Plus 3
157153
158154Minuses tight:
@@ -164,9 +160,7 @@ Minuses tight:
164160Minuses loose:
165161
166162- Minus 1
167−
168163- Minus 2
169−
170164- Minus 3
171165
172166Ordered
@@ -187,17 +181,13 @@ and:
187181Loose using tabs:
188182
1891831. First
190−
1911842. Second
192−
1931853. Third
194186
195187and using spaces:
196188
1971891. One
198−
1991902. Two
200−
2011913. Three
202192
203193Multiple paragraphs:
@@ -205,9 +195,7 @@ Multiple paragraphs:
2051951. Item 1, graf one.
206196
207197 Item 1. graf two. The quick brown fox jumped over the lazy dog’s back.
208−
2091982. Item 2.
210−
2111993. Item 3.
212200
213201Nested
@@ -227,30 +215,25 @@ Here’s another:
227215 - Fee
228216 - Fie
229217 - Foe
230−
2312183. Third
232219
233220Same thing but with paragraphs:
234221
2352221. First
236−
2372232. Second:
238224
239225 - Fee
240226 - Fie
241227 - Foe
242−
2432283. Third
244229
245230Tabs and spaces
246231---------------
247232
248233- this is a list item indented with tabs
249−
250234- this is a list item indented with spaces
251235
252236 - this is an example list item indented with tabs
253−
254237 - this is an example list item indented with spaces
255238
256239Fancy list markers
@@ -317,10 +300,8 @@ Loose:
317300
318301apple
319302 red fruit
320−
321303orange
322304 orange fruit
323−
324305banana
325306 yellow fruit
326307
@@ -330,7 +311,6 @@ Multiple blocks with italics:
330311 red fruit
331312
332313 contains seeds, crisp, pleasant to taste
333−
334314*orange*
335315 orange fruit
336316
@@ -355,7 +335,6 @@ apple
355335 red fruit
356336
357337 computer
358−
359338orange
360339 orange fruit
361340
@@ -367,7 +346,6 @@ apple
367346 red fruit
368347
369348 computer
370−
371349orange
372350 orange fruit
373351
@@ -666,7 +644,6 @@ LaTeX
666644- Here’s some display math:
667645
668646 .. math:: \frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}
669−
670647- Here’s one that has a line break in it: :math:`\alpha + \omega \times x^2`.
671648
672649These shouldn’t be math:
@@ -839,6 +816,7 @@ From “Voyage dans la Lune” by Georges Melies (1902):
839816 :alt: Voyage dans la Lune
840817
841818 lalune
819+
842820Here is a movie |movie| icon.
843821
844822--------------