git.iko.soy/typeable/pandoc
on master help sign in
Fixed spacing problems in textile nested lists.
cae3f8eJohn MacFarlane
src/Text/Pandoc/Writers/Textile.hs+4−2
@@ -176,9 +176,10 @@ blockToTextile opts x@(BulletList items) = do
176 return $ " <ul>\n" ++ vcat contents ++ " </ul>\n"
176 return $ " <ul>\n" ++ vcat contents ++ " </ul>\n"
177 else do
177 else do
178 modify $ \s -> s { stListLevel = stListLevel s ++ "*" }
178 modify $ \s -> s { stListLevel = stListLevel s ++ "*" }
179+ level <- get >>= return . length . stListLevel
179 contents <- mapM (listItemToTextile opts) items
180 contents <- mapM (listItemToTextile opts) items
180 modify $ \s -> s { stListLevel = init (stListLevel s) }
181 modify $ \s -> s { stListLevel = init (stListLevel s) }
181− return $ vcat contents ++ "\n"
182+ return $ vcat contents ++ (if level > 1 then "" else "\n")
182
183
183blockToTextile opts x@(OrderedList attribs items) = do
184blockToTextile opts x@(OrderedList attribs items) = do
184 oldUseTags <- liftM stUseTags get
185 oldUseTags <- liftM stUseTags get
@@ -190,9 +191,10 @@ blockToTextile opts x@(OrderedList attribs items) = do
190 " </ol>\n"
191 " </ol>\n"
191 else do
192 else do
192 modify $ \s -> s { stListLevel = stListLevel s ++ "#" }
193 modify $ \s -> s { stListLevel = stListLevel s ++ "#" }
194+ level <- get >>= return . length . stListLevel
193 contents <- mapM (listItemToTextile opts) items
195 contents <- mapM (listItemToTextile opts) items
194 modify $ \s -> s { stListLevel = init (stListLevel s) }
196 modify $ \s -> s { stListLevel = init (stListLevel s) }
195− return $ vcat contents ++ "\n"
197+ return $ vcat contents ++ (if level > 1 then "" else "\n")
196
198
197blockToTextile opts (DefinitionList items) = do
199blockToTextile opts (DefinitionList items) = do
198 contents <- withUseTags $ mapM (definitionListItemToTextile opts) items
200 contents <- withUseTags $ mapM (definitionListItemToTextile opts) items
tests/writer.textile−6
@@ -172,8 +172,6 @@ h2. Nested
172** Tab
172** Tab
173*** Tab
173*** Tab
174
174
175−
176−
177Here's another:
175Here's another:
178
176
179# First
177# First
@@ -181,7 +179,6 @@ Here's another:
181#* Fee
179#* Fee
182#* Fie
180#* Fie
183#* Foe
181#* Foe
184−
185# Third
182# Third
186
183
187Same thing but with paragraphs:
184Same thing but with paragraphs:
@@ -191,7 +188,6 @@ Same thing but with paragraphs:
191#* Fee
188#* Fee
192#* Fie
189#* Fie
193#* Foe
190#* Foe
194−
195# Third
191# Third
196
192
197h2. Tabs and spaces
193h2. Tabs and spaces
@@ -201,7 +197,6 @@ h2. Tabs and spaces
201** this is an example list item indented with tabs
197** this is an example list item indented with tabs
202** this is an example list item indented with spaces
198** this is an example list item indented with spaces
203
199
204−
205h2. Fancy list markers
200h2. Fancy list markers
206
201
207 <ol start="2" style="list-style-type: decimal;">
202 <ol start="2" style="list-style-type: decimal;">
@@ -237,7 +232,6 @@ Autonumbering:
237# More.
232# More.
238## Nested.
233## Nested.
239
234
240−
241Should not be a list item:
235Should not be a list item:
242
236
243M.A. 2007
237M.A. 2007