git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: report when not rendering raw inline/block.
31f5c02John MacFarlane
src/Text/Pandoc/Writers/HTML.hs+8−3
@@ -82,7 +82,8 @@ import System.FilePath (takeExtension)
82import Data.Aeson (Value)
82import Data.Aeson (Value)
83import Control.Monad.Except (throwError)
83import Control.Monad.Except (throwError)
84import Text.Pandoc.Error
84import Text.Pandoc.Error
85−import Text.Pandoc.Class (PandocMonad)
85+import Text.Pandoc.Class (PandocMonad, report)
86+import Text.Pandoc.Logging
86
87
87data WriterState = WriterState
88data WriterState = WriterState
88 { stNotes :: [Html] -- ^ List of notes
89 { stNotes :: [Html] -- ^ List of notes
@@ -591,7 +592,9 @@ blockToHtml opts (RawBlock f str)
591 | (f == Format "latex" || f == Format "tex") &&
592 | (f == Format "latex" || f == Format "tex") &&
592 allowsMathEnvironments (writerHTMLMathMethod opts) &&
593 allowsMathEnvironments (writerHTMLMathMethod opts) &&
593 isMathEnvironment str = blockToHtml opts $ Plain [Math DisplayMath str]
594 isMathEnvironment str = blockToHtml opts $ Plain [Math DisplayMath str]
595+ | otherwise = do
596+ report $ BlockNotRendered (RawBlock f str)
594− | otherwise = return mempty
597+ return mempty
595blockToHtml _ (HorizontalRule) = do
598blockToHtml _ (HorizontalRule) = do
596 html5 <- gets stHtml5
599 html5 <- gets stHtml5
597 return $ if html5 then H5.hr else H.hr
600 return $ if html5 then H5.hr else H.hr
@@ -925,7 +928,9 @@ inlineToHtml opts inline = do
925 DisplayMath -> brtag >> m >> brtag
928 DisplayMath -> brtag >> m >> brtag
926 (RawInline f str)
929 (RawInline f str)
927 | f == Format "html" -> return $ preEscapedString str
930 | f == Format "html" -> return $ preEscapedString str
931+ | otherwise -> do
932+ report $ InlineNotRendered inline
928− | otherwise -> return mempty
933+ return mempty
929 (Link attr txt (s,_)) | "mailto:" `isPrefixOf` s -> do
934 (Link attr txt (s,_)) | "mailto:" `isPrefixOf` s -> do
930 linkText <- inlineListToHtml opts txt
935 linkText <- inlineListToHtml opts txt
931 lift $ obfuscateLink opts attr linkText s
936 lift $ obfuscateLink opts attr linkText s