Module CurryDoc.Html

Operations to generate documentation in HTML format.

Author: Michael Hanus, Jan Tikovsky

Version: February 2023

Summary of exported operations:

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

Exported datatypes:


FuncAttachment

Constructors:

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

Exported operations:

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

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

docComment2HTML :: DocOptions -> String -> [BaseHtml]  Deterministic 

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] -> BaseHtml  Deterministic 

tName :: CTypeDecl -> String  Deterministic 

fName :: CFuncDecl -> String  Deterministic 

cName :: CConsDecl -> String  Deterministic 

fldName :: CFieldDecl -> String  Deterministic 

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

isExportedType :: CTypeDecl -> Bool  Deterministic 

isExportedCons :: CConsDecl -> Bool  Deterministic 

isExportedFun :: CFuncDecl -> Bool  Deterministic 

isExportedField :: CFieldDecl -> Bool  Deterministic 

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

getExportedCons :: [CTypeDecl] -> [String]  Deterministic 

getExportedFields :: [CTypeDecl] -> [String]  Deterministic 

isProperty :: CFuncDecl -> Bool  Deterministic 

isSpecFunc :: CFuncDecl -> Bool  Deterministic 

genHtmlModule :: DocOptions -> String -> [BaseHtml]  Deterministic 

generate HTML documentation for a module:

ulistOrEmpty :: [[BaseHtml]] -> [BaseHtml]  Deterministic 

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

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

generate HTML documentation for a datatype if it is exported:

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

generate HTML documentation for a constructor if it is exported:

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

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

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

removeDash :: String -> String  Deterministic 

removeTopPar :: [BaseHtml] -> [BaseHtml]  Deterministic 

genFuncPropIcons :: AnaInfo -> (String,String) -> [BaseHtml]  Deterministic 

Generates icons for particular properties of functions.

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

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] -> [BaseHtml]  Deterministic 

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

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

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

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

Pretty-print a single class constraint.

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

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

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

urlOfEntity :: DocOptions -> String -> (String,String) -> String  Deterministic 

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

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

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

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

allConsFuncsMenu :: [[BaseHtml]]  Deterministic 

indexPage :: [String] -> [BaseHtml]  Deterministic 

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

htmlFuncIndex :: DocOptions -> [(String,String)] -> [BaseHtml]  Deterministic 

showModNameRef :: DocOptions -> (String,String) -> (String,[BaseHtml])  Deterministic 

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

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

htmlConsIndex :: DocOptions -> [(String,String)] -> [BaseHtml]  Deterministic 

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

infoTxt :: BaseHtml  Deterministic 

genHtmlLibCats :: [[(Category,String,String)]] -> [BaseHtml]  Deterministic 

genHtmlLibCat :: [(Category,String,String)] -> [BaseHtml]  Deterministic 

mainPage :: (String,[BaseHtml]) -> String -> [BaseHtml] -> [[BaseHtml]] -> [[BaseHtml]] -> [BaseHtml] -> [BaseHtml] -> IO String  Deterministic 

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

favIcon :: String  Deterministic 

cssIncludes :: [String]  Deterministic 

jsIncludes :: [String]  Deterministic 

showPageWithDocStyle :: String -> [BaseHtml] -> String  Deterministic 

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 :: [[BaseHtml]]  Deterministic 

The standard right top menu.

detIcon :: BaseHtml  Deterministic 

nondetIcon :: BaseHtml  Deterministic 

addTitle :: BaseHtml -> String -> BaseHtml  Deterministic 

Further infos:
  • defined as left-associative infix operator with precedence 0

curryHomeItem :: [BaseHtml]  Deterministic 

simplePage :: (String,[BaseHtml]) -> String -> Maybe [BaseHtml] -> [[BaseHtml]] -> [BaseHtml] -> IO String  Deterministic 

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 -> [BaseHtml] -> BaseHtml  Deterministic 

An anchored section in the document:

anchored :: String -> [BaseHtml] -> BaseHtml  Deterministic 

An anchored element in the document:

anchoredDiv :: String -> [BaseHtml] -> BaseHtml  Deterministic 

An anchored element in the document:

borderedTable :: [[[BaseHtml]]] -> BaseHtml  Deterministic 

A bordered table:

ehref :: String -> [BaseHtml] -> BaseHtml  Deterministic 

An external reference

leqList :: Eq a => (a -> a -> Bool) -> [a] -> [a] -> Bool  Deterministic 

Less-or-equal on lists.

leqCharIgnoreCase :: Char -> Char -> Bool  Deterministic 

Less-or-equal on characters ignoring case considerations.

leqStringIgnoreCase :: String -> String -> Bool  Deterministic 

Less-or-equal on strings ignoring case considerations.

stripSpaces :: String -> String  Deterministic 

explainCat :: String -> BaseHtml  Deterministic 

opnameDoc :: [BaseHtml] -> BaseHtml  Deterministic 

sortStrings :: [String] -> [String]  Deterministic 

firstSentence :: String -> String  Deterministic 

firstPassage :: String -> String  Deterministic