git.iko.soy/typeable/pandoc
on master help sign in
Ms writer: more spacing fixes for internal links.
commite8d8d8721a7abfcf6660ab1981130129bdb9950f authorJohn MacFarlane <jgm@berkeley.edu> dateSun 26 Mar 2017, 10:39 (10 years ago) parenta5ec298
1 file changed+9−4
src/Text/Pandoc/Writers/Ms.hs+9−4
src/Text/Pandoc/Writers/Ms.hs+9−4
@@ -376,7 +376,7 @@ definitionListItemToMs :: PandocMonad m
376376 -> ([Inline],[[Block]])
377377 -> MS m Doc
378378definitionListItemToMs opts (label, defs) = do
379− labelText <- inlineListToMs' opts label
379+ labelText <- inlineListToMs' opts $ map breakToSpace label
380380 contents <- if null defs
381381 then return empty
382382 else liftM vcat $ forM defs $ \blocks -> do
@@ -478,11 +478,11 @@ inlineToMs opts SoftBreak = handleNotes opts cr
478478inlineToMs opts Space = handleNotes opts space
479479inlineToMs opts (Link _ txt ('#':ident, _)) = do
480480 -- internal link
481− contents <- inlineListToMs' opts{ writerWrapText = WrapNone } txt
481+ contents <- inlineListToMs' opts $ map breakToSpace txt
482482 return $ text "\\c" <> cr <> nowrap (text ".pdfhref L -D " <>
483483 doubleQuotes (text ident) <> text " -A " <>
484− doubleQuotes (text "\\c") <> text " -- " <> contents) <>
485− cr <> text "\\&"
484+ doubleQuotes (text "\\c") <> space <> text "\\") <> cr <>
485+ text " -- " <> doubleQuotes (nowrap contents) <> cr <> text "\\&"
486486inlineToMs opts (Link _ txt (src, _)) = do
487487 let srcSuffix = fromMaybe src (stripPrefix "mailto:" src)
488488 inNote <- gets stInNote
@@ -548,3 +548,8 @@ setFirstPara = modify $ \st -> st{ stFirstPara = True }
548548
549549resetFirstPara :: PandocMonad m => MS m ()
550550resetFirstPara = modify $ \st -> st{ stFirstPara = False }
551+
552+breakToSpace :: Inline -> Inline
553+breakToSpace SoftBreak = Space
554+breakToSpace LineBreak = Space
555+breakToSpace x = x