Module CurryDoc.Html

Operations to generate documentation in HTML format.

Author: Michael Hanus, Jan Tikovsky

Version: October 2020

Summary of exported operations:

generateHtmlDocs :: DocOptions -> AnaInfo -> String -> String -> [(SourceLine,String)] -> IO String   
attachProperties2Funcs :: [CFuncDecl] -> [(SourceLine,String)] -> [(String,[(FuncAttachment,String,[HtmlExp])])]   
docComment2HTML :: DocOptions -> String -> [HtmlExp]   
Translate a documentation comment to HTML and use markdown translation if necessary
replaceIdLinks :: DocOptions -> String -> String   
genHtmlExportIndex :: [String] -> [String] -> [String] -> [String] -> HtmlExp   
tName :: CTypeDecl -> String   
fName :: CFuncDecl -> String   
cName :: CConsDecl -> String   
fldName :: CFieldDecl -> String   
isExportedType :: CTypeDecl -> Bool   
isExportedCons :: CConsDecl -> Bool   
isExportedFun :: CFuncDecl -> Bool   
isExportedField :: CFieldDecl -> Bool   
getExportedCons :: [CTypeDecl] -> [String]   
getExportedFields :: [CTypeDecl] -> [String]   
isProperty :: CFuncDecl -> Bool   
isSpecFunc :: CFuncDecl -> Bool   
genHtmlModule :: DocOptions -> String -> [HtmlExp]   
generate HTML documentation for a module:
ulistOrEmpty :: [[HtmlExp]] -> [HtmlExp]   
ifNotNull :: [a] -> ([a] -> [b]) -> [b]   
genHtmlType :: DocOptions -> [(SourceLine,String)] -> CTypeDecl -> [HtmlExp]   
generate HTML documentation for a datatype if it is exported:
genHtmlCons :: DocOptions -> [(String,String)] -> String -> [(Int,String)] -> [(String,String)] -> CConsDecl -> [HtmlExp]   
generate HTML documentation for a constructor if it is exported:
genHtmlField :: DocOptions -> [String] -> String -> [(String,String)] -> CFieldDecl -> [HtmlExp]   
genHtmlFuncShort :: DocOptions -> [(SourceLine,String)] -> AnaInfo -> CFuncDecl -> [[HtmlExp]]   
genHtmlFunc :: DocOptions -> String -> [(SourceLine,String)] -> [(String,[(FuncAttachment,String,[HtmlExp])])] -> AnaInfo -> [COpDecl] -> CFuncDecl -> HtmlExp   
removeDash :: String -> String   
removeTopPar :: [HtmlExp] -> [HtmlExp]   
genFuncPropIcons :: AnaInfo -> (String,String) -> [HtmlExp]   
Generates icons for particular properties of functions.
genFuncPropComments :: AnaInfo -> (String,String) -> [CRule] -> [COpDecl] -> [[HtmlExp]]   
Generates further textual infos about particular properties of a function.
genFixityInfo :: (String,String) -> [COpDecl] -> [HtmlExp]   
Generates a comment about the associativity and precedence if the name is defined as an infix operator.
showQualType :: DocOptions -> String -> CQualTypeExpr -> String   
showContext :: DocOptions -> String -> CContext -> String   
showConstraint :: DocOptions -> String -> ((String,String),CTypeExpr) -> String   
Pretty-print a single class constraint.
showType :: DocOptions -> String -> Bool -> CTypeExpr -> String   
showTConsType :: DocOptions -> String -> Bool -> (String,String) -> [CTypeExpr] -> String   
showTypeCons :: DocOptions -> String -> (String,String) -> String   
translateSource2ColoredHtml :: String -> String -> IO ()   
translateSource2AnchoredHtml :: String -> String -> IO ()   
addFuncAnchors :: [String] -> [String] -> String   
genMainIndexPage :: DocOptions -> String -> [String] -> IO ()   
allConsFuncsMenu :: [[HtmlExp]]   
indexPage :: [String] -> [HtmlExp]   
explainIcons :: HtmlExp   
genFunctionIndexPage :: DocOptions -> String -> [FuncDecl] -> IO ()   
htmlFuncIndex :: DocOptions -> [(String,String)] -> [HtmlExp]   
showModNameRef :: DocOptions -> (String,String) -> (String,[HtmlExp])   
sortNames :: [(a,String)] -> [(a,String)]   
genConsIndexPage :: DocOptions -> String -> [TypeDecl] -> IO ()   
htmlConsIndex :: DocOptions -> [(String,String)] -> [HtmlExp]   
genSystemLibsPage :: String -> [Category] -> [[(Category,String,String)]] -> IO ()   
syslibsLeftTopMenu :: [[HtmlExp]]   
syslibsRightTopMenu :: [[HtmlExp]]   
syslibsSideMenu :: [Category] -> [HtmlExp]   
infoTxt :: HtmlExp   
genCatLink :: Category -> String   
genHtmlLibCats :: [[(Category,String,String)]] -> [HtmlExp]   
genHtmlLibCat :: [(Category,String,String)] -> [HtmlExp]   
mainPage :: String -> [HtmlExp] -> [[HtmlExp]] -> [[HtmlExp]] -> [HtmlExp] -> [HtmlExp] -> IO String   
Generate the main page with the default documentation style.
cssIncludes :: [String]   
homeBrand :: (String,[HtmlExp])   
showPageWithDocStyle :: String -> [HtmlExp] -> String   
Generate a page with the default documentation style.
rightTopMenu :: [[HtmlExp]]   
The standard right top menu.
extLinkIcon :: HtmlExp   
detIcon :: HtmlExp   
nondetIcon :: HtmlExp   
withTitle :: HtmlExp -> String -> HtmlExp   
curryDocFooter :: CalendarTime -> [HtmlExp]   
curryHomeItem :: [HtmlExp]   
simplePage :: String -> Maybe [HtmlExp] -> [[HtmlExp]] -> [HtmlExp] -> IO String   
Generate a simple page with the default documentation style.
anchoredSection :: String -> [HtmlExp] -> HtmlExp   
An anchored section in the document:
anchored :: String -> [HtmlExp] -> HtmlExp   
An anchored element in the document:
anchoredDiv :: String -> [HtmlExp] -> HtmlExp   
An anchored element in the document:
borderedTable :: [[[HtmlExp]]] -> HtmlExp   
A bordered table:
ehref :: String -> [HtmlExp] -> HtmlExp   
An external reference
stripSpaces :: String -> String   
explainCat :: String -> HtmlExp   
opnameDoc :: [HtmlExp] -> HtmlExp   
sortStrings :: [String] -> [String]   
firstSentence :: String -> String   
firstPassage :: String -> String   

Exported datatypes:


FuncAttachment

Constructors:

  • Property :: FuncAttachment
  • PreCond :: FuncAttachment
  • PostCond :: FuncAttachment
  • SpecFun :: FuncAttachment

Exported operations:

generateHtmlDocs :: DocOptions -> AnaInfo -> String -> String -> [(SourceLine,String)] -> IO String   

attachProperties2Funcs :: [CFuncDecl] -> [(SourceLine,String)] -> [(String,[(FuncAttachment,String,[HtmlExp])])]   

docComment2HTML :: DocOptions -> String -> [HtmlExp]   

Translate a documentation comment to HTML and use markdown translation if necessary

Returns:
: either a paragraph (<p>) element or an empty list.

genHtmlExportIndex :: [String] -> [String] -> [String] -> [String] -> HtmlExp   

tName :: CTypeDecl -> String   

fName :: CFuncDecl -> String   

cName :: CConsDecl -> String   

fldName :: CFieldDecl -> String   

Further infos:
  • solution complete, i.e., able to compute all solutions

isExportedType :: CTypeDecl -> Bool   

isExportedCons :: CConsDecl -> Bool   

isExportedFun :: CFuncDecl -> Bool   

isExportedField :: CFieldDecl -> Bool   

Further infos:
  • solution complete, i.e., able to compute all solutions

getExportedCons :: [CTypeDecl] -> [String]   

getExportedFields :: [CTypeDecl] -> [String]   

isProperty :: CFuncDecl -> Bool   

isSpecFunc :: CFuncDecl -> Bool   

genHtmlModule :: DocOptions -> String -> [HtmlExp]   

generate HTML documentation for a module:

ulistOrEmpty :: [[HtmlExp]] -> [HtmlExp]   

ifNotNull :: [a] -> ([a] -> [b]) -> [b]   

genHtmlType :: DocOptions -> [(SourceLine,String)] -> CTypeDecl -> [HtmlExp]   

generate HTML documentation for a datatype if it is exported:

genHtmlCons :: DocOptions -> [(String,String)] -> String -> [(Int,String)] -> [(String,String)] -> CConsDecl -> [HtmlExp]   

generate HTML documentation for a constructor if it is exported:

genHtmlField :: DocOptions -> [String] -> String -> [(String,String)] -> CFieldDecl -> [HtmlExp]   

genHtmlFuncShort :: DocOptions -> [(SourceLine,String)] -> AnaInfo -> CFuncDecl -> [[HtmlExp]]   

genHtmlFunc :: DocOptions -> String -> [(SourceLine,String)] -> [(String,[(FuncAttachment,String,[HtmlExp])])] -> AnaInfo -> [COpDecl] -> CFuncDecl -> HtmlExp   

removeDash :: String -> String   

removeTopPar :: [HtmlExp] -> [HtmlExp]   

genFuncPropIcons :: AnaInfo -> (String,String) -> [HtmlExp]   

Generates icons for particular properties of functions.

genFuncPropComments :: AnaInfo -> (String,String) -> [CRule] -> [COpDecl] -> [[HtmlExp]]   

Generates further textual infos about particular properties of a function. The result is a list of HTML expressions to be formatted (if not empty) as some HTML list.

genFixityInfo :: (String,String) -> [COpDecl] -> [HtmlExp]   

Generates a comment about the associativity and precedence if the name is defined as an infix operator.

showQualType :: DocOptions -> String -> CQualTypeExpr -> String   

showContext :: DocOptions -> String -> CContext -> String   

showConstraint :: DocOptions -> String -> ((String,String),CTypeExpr) -> String   

Pretty-print a single class constraint.

showType :: DocOptions -> String -> Bool -> CTypeExpr -> String   

showTConsType :: DocOptions -> String -> Bool -> (String,String) -> [CTypeExpr] -> String   

showTypeCons :: DocOptions -> String -> (String,String) -> String   

translateSource2ColoredHtml :: String -> String -> IO ()   

translateSource2AnchoredHtml :: String -> String -> IO ()   

addFuncAnchors :: [String] -> [String] -> String   

genMainIndexPage :: DocOptions -> String -> [String] -> IO ()   

allConsFuncsMenu :: [[HtmlExp]]   

indexPage :: [String] -> [HtmlExp]   

genFunctionIndexPage :: DocOptions -> String -> [FuncDecl] -> IO ()   

htmlFuncIndex :: DocOptions -> [(String,String)] -> [HtmlExp]   

showModNameRef :: DocOptions -> (String,String) -> (String,[HtmlExp])   

sortNames :: [(a,String)] -> [(a,String)]   

genConsIndexPage :: DocOptions -> String -> [TypeDecl] -> IO ()   

htmlConsIndex :: DocOptions -> [(String,String)] -> [HtmlExp]   

genSystemLibsPage :: String -> [Category] -> [[(Category,String,String)]] -> IO ()   

syslibsSideMenu :: [Category] -> [HtmlExp]   

infoTxt :: HtmlExp   

genHtmlLibCats :: [[(Category,String,String)]] -> [HtmlExp]   

genHtmlLibCat :: [(Category,String,String)] -> [HtmlExp]   

mainPage :: String -> [HtmlExp] -> [[HtmlExp]] -> [[HtmlExp]] -> [HtmlExp] -> [HtmlExp] -> IO String   

Generate the main page with the default documentation style.

Example call:
(mainPage title htmltitle lefttopmenu righttopmenu sidemenu maindoc)
Parameters:
  • title : the title of the page
  • htmltitle : the title in HTML format (shown as h1)
  • lefttopmenu : the menu shown at left of the top
  • righttopmenu : the menu shown at right of the top
  • sidemenu : the menu shown at the left-hand side
  • maindoc : the main contents of the page

cssIncludes :: [String]   

Further infos:
  • solution complete, i.e., able to compute all solutions

homeBrand :: (String,[HtmlExp])   

showPageWithDocStyle :: String -> [HtmlExp] -> String   

Generate a page with the default documentation style.

Example call:
(showPageWithDocStyle title body)
Parameters:
  • title : the title of the page
  • body : the main contents of the page

rightTopMenu :: [[HtmlExp]]   

The standard right top menu.

extLinkIcon :: HtmlExp   

detIcon :: HtmlExp   

nondetIcon :: HtmlExp   

withTitle :: HtmlExp -> String -> HtmlExp   

Further infos:
  • defined as left-associative infix operator with precedence 0
  • solution complete, i.e., able to compute all solutions

curryHomeItem :: [HtmlExp]   

simplePage :: String -> Maybe [HtmlExp] -> [[HtmlExp]] -> [HtmlExp] -> IO String   

Generate a simple page with the default documentation style.

Example call:
(simplePage title htmltitle lefttopmenu doc)
Parameters:
  • title : the title of the page
  • htmltitle : maybe a specific title for h1 header
  • lefttopmenu : the menu shown at left of the top
  • doc : the main contents of the page

anchoredSection :: String -> [HtmlExp] -> HtmlExp   

An anchored section in the document:

Further infos:
  • solution complete, i.e., able to compute all solutions

anchored :: String -> [HtmlExp] -> HtmlExp   

An anchored element in the document:

Further infos:
  • solution complete, i.e., able to compute all solutions

anchoredDiv :: String -> [HtmlExp] -> HtmlExp   

An anchored element in the document:

Further infos:
  • solution complete, i.e., able to compute all solutions

borderedTable :: [[[HtmlExp]]] -> HtmlExp   

A bordered table:

ehref :: String -> [HtmlExp] -> HtmlExp   

An external reference

Further infos:
  • solution complete, i.e., able to compute all solutions

stripSpaces :: String -> String   

explainCat :: String -> HtmlExp   

opnameDoc :: [HtmlExp] -> HtmlExp   

Further infos:
  • solution complete, i.e., able to compute all solutions

sortStrings :: [String] -> [String]   

firstSentence :: String -> String   

firstPassage :: String -> String