[Git][ghc/ghc][wip/docs-fixes] hadrian: Fail on Sphinx syntax errors

Ben Gamari gitlab at gitlab.haskell.org
Thu Sep 17 23:55:15 UTC 2020



Ben Gamari pushed to branch wip/docs-fixes at Glasgow Haskell Compiler / GHC


Commits:
28d058ad by Ben Gamari at 2020-09-17T19:55:05-04:00
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.

- - - - -


1 changed file:

- hadrian/src/Rules/Documentation.hs


Changes:

=====================================
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."
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/28d058ad707c686e21609579e0be8a012748161c

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/28d058ad707c686e21609579e0be8a012748161c
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200917/b946f700/attachment.html>


More information about the ghc-commits mailing list