From 1be8491b0c3b07be2ec91feb557502ca06d1e078 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sat, 23 Jan 2016 19:10:59 +0100 Subject: mkUserGuidePart: Better flag cross-referencing --- utils/mkUserGuidePart/Main.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'utils/mkUserGuidePart/Main.hs') 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 -- cgit v1.2.1