@@ -31,6 +31,7 @@ import Data.Aeson.Encode.Pretty (Config (..), defConfig, encodePretty',
3131import qualified Data.ByteString.Lazy as BL
3232import Data.Data (Data, toConstr)
3333import qualified Data.Text as Text
34+import Data.Text (Text)
3435import Data.Typeable (Typeable)
3536import GHC.Generics (Generic)
3637import Text.Pandoc.Definition
@@ -59,45 +60,46 @@ instance FromYAML Verbosity where
5960 _ -> mzero
6061
6162data LogMessage =
62− SkippedContent Text.Text SourcePos
63− | IgnoredElement Text.Text
64− | DuplicateLinkReference Text.Text SourcePos
65− | DuplicateNoteReference Text.Text SourcePos
66− | NoteDefinedButNotUsed Text.Text SourcePos
67− | DuplicateIdentifier Text.Text SourcePos
68− | ReferenceNotFound Text.Text SourcePos
69− | CircularReference Text.Text SourcePos
70− | UndefinedToggle Text.Text SourcePos
71− | ParsingUnescaped Text.Text SourcePos
72− | CouldNotLoadIncludeFile Text.Text SourcePos
73− | MacroAlreadyDefined Text.Text SourcePos
63+ SkippedContent Text SourcePos
64+ | IgnoredElement Text
65+ | DuplicateLinkReference Text SourcePos
66+ | DuplicateNoteReference Text SourcePos
67+ | NoteDefinedButNotUsed Text SourcePos
68+ | DuplicateIdentifier Text SourcePos
69+ | ReferenceNotFound Text SourcePos
70+ | CircularReference Text SourcePos
71+ | UndefinedToggle Text SourcePos
72+ | ParsingUnescaped Text SourcePos
73+ | CouldNotLoadIncludeFile Text SourcePos
74+ | MacroAlreadyDefined Text SourcePos
7475 | InlineNotRendered Inline
7576 | BlockNotRendered Block
76− | DocxParserWarning Text.Text
77− | IgnoredIOError Text.Text
78− | CouldNotFetchResource Text.Text Text.Text
79− | CouldNotDetermineImageSize Text.Text Text.Text
80− | CouldNotConvertImage Text.Text Text.Text
81− | CouldNotDetermineMimeType Text.Text
82− | CouldNotConvertTeXMath Text.Text Text.Text
83− | CouldNotParseCSS Text.Text
84− | Fetching Text.Text
85− | Extracting Text.Text
86− | NoTitleElement Text.Text
77+ | DocxParserWarning Text
78+ | IgnoredIOError Text
79+ | CouldNotFetchResource Text Text
80+ | CouldNotDetermineImageSize Text Text
81+ | CouldNotConvertImage Text Text
82+ | CouldNotDetermineMimeType Text
83+ | CouldNotConvertTeXMath Text Text
84+ | CouldNotParseCSS Text
85+ | Fetching Text
86+ | Extracting Text
87+ | NoTitleElement Text
8788 | NoLangSpecified
88− | InvalidLang Text.Text
89− | CouldNotHighlight Text.Text
90− | MissingCharacter Text.Text
91− | Deprecated Text.Text Text.Text
92− | NoTranslation Text.Text
93− | CouldNotLoadTranslations Text.Text Text.Text
94− | UnusualConversion Text.Text
95− | UnexpectedXmlElement Text.Text Text.Text
96− | UnknownOrgExportOption Text.Text
97− | CouldNotDeduceFormat [Text.Text] Text.Text
89+ | InvalidLang Text
90+ | CouldNotHighlight Text
91+ | MissingCharacter Text
92+ | Deprecated Text Text
93+ | NoTranslation Text
94+ | CouldNotLoadTranslations Text Text
95+ | UnusualConversion Text
96+ | UnexpectedXmlElement Text Text
97+ | UnknownOrgExportOption Text
98+ | CouldNotDeduceFormat [Text] Text
9899 | RunningFilter FilePath
99100 | FilterCompleted FilePath Integer
100− | CiteprocWarning Text.Text
101+ | CiteprocWarning Text
102+ | ATXHeadingInLHS Int Text
101103 deriving (Show, Eq, Data, Ord, Typeable, Generic)
102104
103105instance ToJSON LogMessage where
@@ -224,8 +226,11 @@ instance ToJSON LogMessage where
224226 ,"milliseconds" .= Text.pack (show ms) ]
225227 CiteprocWarning msg ->
226228 ["message" .= msg]
229+ ATXHeadingInLHS lvl contents ->
230+ ["level" .= lvl
231+ ,"contents" .= contents]
227232
228−showPos :: SourcePos -> Text.Text
233+showPos :: SourcePos -> Text
229234showPos pos = Text.pack $ sn ++ "line " ++
230235 show (sourceLine pos) ++ " column " ++ show (sourceColumn pos)
231236 where sn = if sourceName pos == "source" || sourceName pos == ""
@@ -238,7 +243,7 @@ encodeLogMessages ms =
238243 keyOrder [ "type", "verbosity", "contents", "message", "path",
239244 "source", "line", "column" ] } ms
240245
241−showLogMessage :: LogMessage -> Text.Text
246+showLogMessage :: LogMessage -> Text
242247showLogMessage msg =
243248 case msg of
244249 SkippedContent s pos ->
@@ -333,6 +338,13 @@ showLogMessage msg =
333338 FilterCompleted fp ms -> "Completed filter " <> Text.pack fp <>
334339 " in " <> Text.pack (show ms) <> " ms"
335340 CiteprocWarning ms -> "Citeproc: " <> ms
341+ ATXHeadingInLHS lvl contents ->
342+ "Rendering heading '" <> contents <> "' as a paragraph.\n" <>
343+ "ATX headings cannot be used in literate Haskell, because " <>
344+ "'#' is not\nallowed in column 1." <>
345+ if lvl < 3
346+ then " Consider using --markdown-headings=setext."
347+ else ""
336348
337349messageVerbosity :: LogMessage -> Verbosity
338350messageVerbosity msg =
@@ -378,3 +390,4 @@ messageVerbosity msg =
378390 RunningFilter{} -> INFO
379391 FilterCompleted{} -> INFO
380392 CiteprocWarning{} -> WARNING
393+ ATXHeadingInLHS{} -> WARNING