summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-09-17 10:55:00 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-19 15:51:07 -0400
commit885ecd18e084e4e2b15fbc5de0aa5222f2573387 (patch)
tree89c22f74dd9613975e79f3d05a7989be24ea0cb7
parent4df3aa956260e3d84232f43546e297cf425081dd (diff)
downloadhaskell-885ecd18e084e4e2b15fbc5de0aa5222f2573387.tar.gz
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.
-rw-r--r--hadrian/src/Rules/Documentation.hs15
1 files changed, 15 insertions, 0 deletions
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."