From 885ecd18e084e4e2b15fbc5de0aa5222f2573387 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Thu, 17 Sep 2020 10:55:00 -0400 Subject: hadrian: Fail on Sphinx syntax errors Specifically the "Inline literal start-string without end-string" warning, which typically means that the user neglected to separate an inline code block from suffix text with a backslash. --- hadrian/src/Rules/Documentation.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'hadrian/src') diff --git a/hadrian/src/Rules/Documentation.hs b/hadrian/src/Rules/Documentation.hs index f39d52c512..6898fd12e5 100644 --- a/hadrian/src/Rules/Documentation.hs +++ b/hadrian/src/Rules/Documentation.hs @@ -127,6 +127,21 @@ checkSphinxWarnings :: FilePath -- ^ output directory -> Action () checkSphinxWarnings out = do log <- liftIO $ readFile (out -/- ".log") + when ("Inline literal start-string without end-string." `isInfixOf` log) + $ fail $ unlines + [ "Syntax error found in Sphinx log. " + , "" + , "This likely means that you have forgotten a \\ after inline code block. For instance," + , "you might have written:" + , "" + , " are not allowed to contain nested ``forall``s." + , "" + , "Whereas you need to write:" + , "" + , " are not allowed to contain nested ``forall``\\s." + , "" + ] + when ("reference target not found" `isInfixOf` log) $ fail "Undefined reference targets found in Sphinx log." -- cgit v1.2.1