summaryrefslogtreecommitdiff
path: root/utils/mkUserGuidePart/Main.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2016-01-23 19:10:59 +0100
committerBen Gamari <ben@smart-cactus.org>2016-01-23 21:13:15 +0100
commit1be8491b0c3b07be2ec91feb557502ca06d1e078 (patch)
treef092aa3808187fc69fd3ea57c1d92b98adbc15ad /utils/mkUserGuidePart/Main.hs
parent8e9a87025f954a2704850bc71cb497f768d5d595 (diff)
downloadhaskell-1be8491b0c3b07be2ec91feb557502ca06d1e078.tar.gz
mkUserGuidePart: Better flag cross-referencing
Diffstat (limited to 'utils/mkUserGuidePart/Main.hs')
-rw-r--r--utils/mkUserGuidePart/Main.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/utils/mkUserGuidePart/Main.hs b/utils/mkUserGuidePart/Main.hs
index b30cc8f01d..41e8e40f86 100644
--- a/utils/mkUserGuidePart/Main.hs
+++ b/utils/mkUserGuidePart/Main.hs
@@ -52,13 +52,11 @@ flagsTable theFlags =
["Flag", "Description", "Static/Dynamic", "Reverse"]
(map flagRow theFlags)
where
- code "" = ""
- code str = "``"++str++"``"
flagRow flag =
- [ code (flagName flag)
+ [ role "ghc-flag" (flagName flag)
, flagDescription flag
, type_
- , code (flagReverse flag)
+ , role "ghc-flag" (flagReverse flag)
]
where
type_ = case flagType flag of
@@ -71,6 +69,12 @@ flagsTable theFlags =
inlineCode :: String -> ReST
inlineCode s = "``" ++ s ++ "``"
+-- | @role "hi" "Hello world"@ produces the ReST inline role element
+-- @:hi:`Hello world`@.
+role :: String -> String -> ReST
+role _ "" = ""
+role r c = concat [":",r,":`",c,"`"]
+
heading :: Char -> String -> ReST
heading chr title = unlines
[ title