diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-12-05 11:30:55 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-01-25 17:07:41 +0100 |
commit | e1d2da4c227a15427b82697d573d44bbd08ef906 (patch) | |
tree | d4336629f4bfc719594a1fd23be85936c97d0f8a /src/Text/Pandoc/Readers | |
parent | f1cec1dd0257c10fb291a7fb50e216a5218ebf77 (diff) | |
download | pandoc-e1d2da4c227a15427b82697d573d44bbd08ef906.tar.gz |
Have warningWithPos take a SourcePos rather than Maybe SourcePos.
After all, we have warning if you don't want the source pos info.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 10 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/RST.hs | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 49d2d702f..1c8536924 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -238,7 +238,7 @@ inline = (mempty <$ comment) <|> (str . (:[]) <$> tildeEscape) <|> (do res <- oneOf "#&~^'`\"[]" pos <- getPosition - warningWithPos (Just pos) ("Parsing unescaped '" ++ [res] ++ "'") + warningWithPos pos ("Parsing unescaped '" ++ [res] ++ "'") return $ str [res]) inlines :: PandocMonad m => LP m Inlines diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 012edfe3b..1923bca01 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -280,7 +280,7 @@ yamlMetaBlock = try $ do ) nullMeta hashmap Right Yaml.Null -> return nullMeta Right _ -> do - P.warningWithPos (Just pos) "YAML header is not an object" + P.warningWithPos pos "YAML header is not an object" return nullMeta Left err' -> do case err' of @@ -291,13 +291,13 @@ yamlMetaBlock = try $ do yamlLine = yline , yamlColumn = ycol }}) -> - P.warningWithPos (Just $ setSourceLine + P.warningWithPos (setSourceLine (setSourceColumn pos (sourceColumn pos + ycol)) (sourceLine pos + 1 + yline)) $ "Could not parse YAML header: " ++ problem - _ -> P.warningWithPos (Just pos) + _ -> P.warningWithPos pos $ "Could not parse YAML header: " ++ show err' return nullMeta @@ -420,7 +420,7 @@ referenceKey = try $ do let oldkeys = stateKeys st let key = toKey raw case M.lookup key oldkeys of - Just _ -> P.warningWithPos (Just pos) $ "Duplicate link reference `" ++ raw ++ "'" + Just _ -> P.warningWithPos pos $ "Duplicate link reference `" ++ raw ++ "'" Nothing -> return () updateState $ \s -> s { stateKeys = M.insert key (target, attr') oldkeys } return $ return mempty @@ -486,7 +486,7 @@ noteBlock = try $ do let newnote = (ref, parsed) oldnotes <- stateNotes' <$> getState case lookup ref oldnotes of - Just _ -> P.warningWithPos (Just pos) $ "Duplicate note reference `" ++ ref ++ "'" + Just _ -> P.warningWithPos pos $ "Duplicate note reference `" ++ ref ++ "'" Nothing -> return () updateState $ \s -> s { stateNotes' = newnote : oldnotes } return mempty diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index 92d0e8670..82e50ce6e 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -696,7 +696,7 @@ directive' = do return $ B.divWith attrs children other -> do pos <- getPosition - P.warningWithPos (Just pos) $ "ignoring unknown directive: " ++ other + P.warningWithPos pos $ "ignoring unknown directive: " ++ other return mempty -- TODO: @@ -1135,7 +1135,7 @@ renderRole contents fmt role attr = case role of renderRole contents newFmt newRole newAttr Nothing -> do pos <- getPosition - P.warningWithPos (Just pos) $ "ignoring unknown role :" ++ custom ++ ": in" + P.warningWithPos pos $ "ignoring unknown role :" ++ custom ++ ": in" return $ B.str contents -- Undefined role where titleRef ref = return $ B.str ref -- FIXME: Not a sensible behaviour |