aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-03-24 08:52:35 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-24 08:52:35 +0100
commitc964898899688f495197f300f05d5ee15beff411 (patch)
tree4b10cc2b87aa2552c9ee08a00b052f7b6c85ec63
parentf0abbe7533db3e2c14066bddbb5d52ade1ef0685 (diff)
downloadpandoc-c964898899688f495197f300f05d5ee15beff411.tar.gz
Ms writer: warning for non-rendered raw content.
-rw-r--r--src/Text/Pandoc/Writers/Ms.hs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/Ms.hs b/src/Text/Pandoc/Writers/Ms.hs
index 4e6ae0951..ceec05ae7 100644
--- a/src/Text/Pandoc/Writers/Ms.hs
+++ b/src/Text/Pandoc/Writers/Ms.hs
@@ -29,7 +29,6 @@ Conversion of 'Pandoc' documents to groff man page format.
TODO:
-[ ] warning for non-rendered raw content
[ ] is there a better way to do strikeout?
[ ] options for hyperlink rendering (currently footnote)
[ ] can we get prettier output using .B, etc. instead of
@@ -57,7 +56,8 @@ import Data.List ( stripPrefix, intersperse, intercalate, sort )
import Data.Maybe (fromMaybe)
import Text.Pandoc.Pretty
import Text.Pandoc.Builder (deleteMeta)
-import Text.Pandoc.Class (PandocMonad)
+import Text.Pandoc.Class (PandocMonad, report)
+import Text.Pandoc.Logging
import Control.Monad.State
import Data.Char ( isDigit, isLower, isUpper, toUpper )
import Text.TeXMath (writeEqn)
@@ -223,9 +223,11 @@ blockToMs opts (Para inlines) = do
contents <- liftM vcat $ mapM (inlineListToMs' opts) $
splitSentences inlines
return $ text ".LP" $$ contents
-blockToMs _ (RawBlock f str)
+blockToMs _ b@(RawBlock f str)
| f == Format "man" = return $ text str
- | otherwise = return empty
+ | otherwise = do
+ report $ BlockNotRendered b
+ return empty
blockToMs _ HorizontalRule = return $ text ".PP" $$ text " * * * * *"
blockToMs opts (Header level _ inlines) = do
contents <- inlineListToMs' opts inlines
@@ -419,9 +421,11 @@ inlineToMs opts (Math DisplayMath str) = do
return $ cr <> text ".RS" $$ contents $$ text ".RE"
Right r -> return $
cr <> text ".EQ" $$ text (escapeBar r) $$ text ".EN"
-inlineToMs _ (RawInline f str)
+inlineToMs _ il@(RawInline f str)
| f == Format "man" = return $ text str
- | otherwise = return empty
+ | otherwise = do
+ report $ InlineNotRendered il
+ return empty
inlineToMs _ (LineBreak) = return $ cr <> text ".br" <> cr
inlineToMs opts SoftBreak = handleNotes opts cr
inlineToMs opts Space = handleNotes opts space