summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-03-26 10:39:20 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-26 10:39:20 +0200
commite8d8d8721a7abfcf6660ab1981130129bdb9950f (patch)
tree40e14f563261aa41954a45347ca99110d5533c5e /src/Text/Pandoc/Writers
parenta5ec298989df1f04e06000db6074b4a7c4db74f4 (diff)
Ms writer: more spacing fixes for internal links.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/Ms.hs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Ms.hs b/src/Text/Pandoc/Writers/Ms.hs
index 9b1119ed4..4c6cc5a34 100644
--- a/src/Text/Pandoc/Writers/Ms.hs
+++ b/src/Text/Pandoc/Writers/Ms.hs
@@ -376,7 +376,7 @@ definitionListItemToMs :: PandocMonad m
-> ([Inline],[[Block]])
-> MS m Doc
definitionListItemToMs opts (label, defs) = do
- labelText <- inlineListToMs' opts label
+ labelText <- inlineListToMs' opts $ map breakToSpace label
contents <- if null defs
then return empty
else liftM vcat $ forM defs $ \blocks -> do
@@ -478,11 +478,11 @@ inlineToMs opts SoftBreak = handleNotes opts cr
inlineToMs opts Space = handleNotes opts space
inlineToMs opts (Link _ txt ('#':ident, _)) = do
-- internal link
- contents <- inlineListToMs' opts{ writerWrapText = WrapNone } txt
+ contents <- inlineListToMs' opts $ map breakToSpace txt
return $ text "\\c" <> cr <> nowrap (text ".pdfhref L -D " <>
doubleQuotes (text ident) <> text " -A " <>
- doubleQuotes (text "\\c") <> text " -- " <> contents) <>
- cr <> text "\\&"
+ doubleQuotes (text "\\c") <> space <> text "\\") <> cr <>
+ text " -- " <> doubleQuotes (nowrap contents) <> cr <> text "\\&"
inlineToMs opts (Link _ txt (src, _)) = do
let srcSuffix = fromMaybe src (stripPrefix "mailto:" src)
inNote <- gets stInNote
@@ -548,3 +548,8 @@ setFirstPara = modify $ \st -> st{ stFirstPara = True }
resetFirstPara :: PandocMonad m => MS m ()
resetFirstPara = modify $ \st -> st{ stFirstPara = False }
+
+breakToSpace :: Inline -> Inline
+breakToSpace SoftBreak = Space
+breakToSpace LineBreak = Space
+breakToSpace x = x