diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-06-21 08:49:00 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-06-21 08:49:00 -0700 |
commit | 82ad855f38b8fa8dc1cbfc14fa294dfd5f9f02ab (patch) | |
tree | e679640ecba8bb9cc4aa827883104d207811e31c | |
parent | 0c4ed0045a2adb611f83054ad29d68f46b0611c5 (diff) | |
download | pandoc-82ad855f38b8fa8dc1cbfc14fa294dfd5f9f02ab.tar.gz |
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.
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 6 | ||||
-rw-r--r-- | test/command/7397.md | 14 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 425ea07ca..b13ab57ee 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -256,10 +256,10 @@ noteToMarkdown opts num blocks = do then hang (writerTabStop opts) (marker <> spacer) contents else marker <> spacer <> contents --- | (Code) blocks with a single class can just use it standalone, --- no need to bother with curly braces. +-- | (Code) blocks with a single class and no attributes can just use it +-- standalone, no need to bother with curly braces. classOrAttrsToMarkdown :: Attr -> Doc Text -classOrAttrsToMarkdown ("",[cls],_) = literal cls +classOrAttrsToMarkdown ("",[cls],[]) = literal cls classOrAttrsToMarkdown attrs = attrsToMarkdown attrs -- | Ordered list start parser for use in Para below. diff --git a/test/command/7397.md b/test/command/7397.md new file mode 100644 index 000000000..ca8b6a482 --- /dev/null +++ b/test/command/7397.md @@ -0,0 +1,14 @@ +``` +% pandoc -t markdown +~~~~ { .haskell startFrom="100"} +qsort [] = [] +qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ + qsort (filter (>= x) xs) +~~~~ +^D +``` {.haskell startFrom="100"} +qsort [] = [] +qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ + qsort (filter (>= x) xs) +``` +``` |