git.iko.soy/typeable/pandoc
on master help sign in
Muse writer: use length instead of realLength to calculate definition indentation
ec2d86eAlexander Krotov
src/Text/Pandoc/Writers/Muse.hs+2−1
@@ -230,8 +230,9 @@ blockToMuse (DefinitionList items) = do
230 definitionListItemToMuse (label, defs) = do
230 definitionListItemToMuse (label, defs) = do
231 modify $ \st -> st { stUseTags = False }
231 modify $ \st -> st { stUseTags = False }
232 label' <- local (\env -> env { envOneLine = True, envAfterSpace = True }) $ inlineListToMuse' label
232 label' <- local (\env -> env { envOneLine = True, envAfterSpace = True }) $ inlineListToMuse' label
233− let ind = offset label'
233+ let ind = offset' label' -- using Text.Pandoc.Pretty.offset results in round trip failures
234 hang ind (nowrap label') . vcat <$> mapM descriptionToMuse defs
234 hang ind (nowrap label') . vcat <$> mapM descriptionToMuse defs
235+ where offset' d = maximum (0: map length (lines $ render Nothing d))
235 descriptionToMuse :: PandocMonad m
236 descriptionToMuse :: PandocMonad m
236 => [Block]
237 => [Block]
237 -> Muse m Doc
238 -> Muse m Doc