git.iko.soy/typeable/pandoc
on master help sign in
Markdown writer: Fix regression in code blocks with attributes.

Code blocks with a single class but nonempty attributes were having attributes drop as a result of #7242. Closes #7397.

commit82ad855f38b8fa8dc1cbfc14fa294dfd5f9f02ab authorJohn MacFarlane <jgm@berkeley.edu> dateMon 21 Jun 2021, 08:49 (5 years ago) parent0c4ed00
2 files changed+17−3
src/Text/Pandoc/Writers/Markdown.hs+3−3 test/command/7397.md+14
src/Text/Pandoc/Writers/Markdown.hs+3−3
@@ -256,10 +256,10 @@ noteToMarkdown opts num blocks = do
256256 then hang (writerTabStop opts) (marker <> spacer) contents
257257 else marker <> spacer <> contents
258258
259−-- | (Code) blocks with a single class can just use it standalone,
260−-- no need to bother with curly braces.
259+-- | (Code) blocks with a single class and no attributes can just use it
260+-- standalone, no need to bother with curly braces.
261261classOrAttrsToMarkdown :: Attr -> Doc Text
262−classOrAttrsToMarkdown ("",[cls],_) = literal cls
262+classOrAttrsToMarkdown ("",[cls],[]) = literal cls
263263classOrAttrsToMarkdown attrs = attrsToMarkdown attrs
264264
265265-- | Ordered list start parser for use in Para below.
test/command/7397.mdnew file+14
@@ -0,0 +1,14 @@
1+```
2+% pandoc -t markdown
3+~~~~ { .haskell startFrom="100"}
4+qsort [] = []
5+qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
6+ qsort (filter (>= x) xs)
7+~~~~
8+^D
9+``` {.haskell startFrom="100"}
10+qsort [] = []
11+qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
12+ qsort (filter (>= x) xs)
13+```
14+```