mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 11:16:33 +00:00
Docx reader: Combine codeBlocks
This prevents a multiline codeblock in word from being read as different paragraphs. This takes place in the Combine module to occur during the normal combining of divs during conversion. Note that this specifies that the attributes of the `CodeBlock`s must be the same. The docx reader creates codeBlocks without attrs, so this is trivially satisified.
This commit is contained in:
@@ -135,6 +135,10 @@ combineBlocks bs cs
|
||||
| bs' :> BlockQuote bs'' <- viewr (unMany bs)
|
||||
, BlockQuote cs'' :< cs' <- viewl (unMany cs) =
|
||||
Many $ (bs' |> BlockQuote (bs'' <> cs'')) >< cs'
|
||||
| bs' :> CodeBlock attr codeStr <- viewr (unMany bs)
|
||||
, CodeBlock attr' codeStr' :< cs' <- viewl (unMany cs)
|
||||
, attr == attr' =
|
||||
Many $ (bs' |> CodeBlock attr (codeStr <> "\n" <> codeStr')) >< cs'
|
||||
combineBlocks bs cs = bs <> cs
|
||||
|
||||
instance (Monoid a, Eq a) => Eq (Modifier a) where
|
||||
|
||||
Reference in New Issue
Block a user