diff options
Diffstat (limited to 'src/HaddockHH2.hs')
-rw-r--r-- | src/HaddockHH2.hs | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/src/HaddockHH2.hs b/src/HaddockHH2.hs index d28e8181..3cee48e3 100644 --- a/src/HaddockHH2.hs +++ b/src/HaddockHH2.hs @@ -23,12 +23,12 @@ ppHH2Contents odir doctitle maybe_package tree = do contentsHH2File = package++".HxT" doc = - text "<?xml version=\"1.0\"?>" $$
+ text "<?xml version=\"1.0\"?>" $$ text "<!DOCTYPE HelpTOC SYSTEM \"ms-help://hx/resources/HelpTOC.DTD\">" $$ text "<HelpTOC DTDVersion=\"1.0\">" $$ - nest 4 (text "<HelpTOCNode Title=\""<>text doctitle<>text"\" Url=\"index.html\">" $$
- nest 4 (ppModuleTree [] tree) $+$
- text "</HelpTOCNode>") $$
+ nest 4 (text "<HelpTOCNode Title=\""<>text doctitle<>text"\" Url=\"index.html\">" $$ + nest 4 (ppModuleTree [] tree) $+$ + text "</HelpTOCNode>") $$ text "</HelpTOC>" writeFile (pathJoin [odir, contentsHH2File]) (render doc) where @@ -69,18 +69,18 @@ ppHH2Index odir maybe_package ifaces = do indexKHH2File = package++"K.HxK" indexNHH2File = package++"N.HxK" docK = - text "<?xml version=\"1.0\"?>" $$
- text "<!DOCTYPE HelpIndex SYSTEM \"ms-help://hx/resources/HelpIndex.DTD\">" $$
+ text "<?xml version=\"1.0\"?>" $$ + text "<!DOCTYPE HelpIndex SYSTEM \"ms-help://hx/resources/HelpIndex.DTD\">" $$ text "<HelpIndex DTDVersion=\"1.0\" Name=\"K\">" $$ nest 4 (ppList index) $+$ text "</HelpIndex>" docN = - text "<?xml version=\"1.0\"?>" $$
- text "<!DOCTYPE HelpIndex SYSTEM \"ms-help://hx/resources/HelpIndex.DTD\">" $$
+ text "<?xml version=\"1.0\"?>" $$ + text "<!DOCTYPE HelpIndex SYSTEM \"ms-help://hx/resources/HelpIndex.DTD\">" $$ text "<HelpIndex DTDVersion=\"1.0\" Name=\"NamedURLIndex\">" $$ - text "<Keyword Term=\"HomePage\">" $$
- nest 4 (text "<Jump Url=\""<>text contentsHtmlFile<>text "\"/>") $$
- text "</Keyword>" $$
+ text "<Keyword Term=\"HomePage\">" $$ + nest 4 (text "<Jump Url=\""<>text contentsHtmlFile<>text "\"/>") $$ + text "</Keyword>" $$ text "</HelpIndex>" writeFile (pathJoin [odir, indexKHH2File]) (render docK) writeFile (pathJoin [odir, indexNHH2File]) (render docN) @@ -95,9 +95,9 @@ ppHH2Index odir maybe_package ifaces = do ppList [] = empty ppList ((name,mdls):vs) = - text "<Keyword Term=\"" <> text (escapeStr (show name)) <> text "\">" $$
- nest 4 (vcat (map (ppJump name) mdls)) $$
- text "</Keyword>" $$
+ text "<Keyword Term=\"" <> text (escapeStr (show name)) <> text "\">" $$ + nest 4 (vcat (map (ppJump name) mdls)) $$ + text "</Keyword>" $$ ppList vs ppJump name (Module mdl) = text "<Jump Url=\"" <> text (nameHtmlRef mdl name) <> text "\"/>" @@ -109,41 +109,41 @@ ppHH2Files :: FilePath -> Maybe String -> [(Module,Interface)] -> [FilePath] -> ppHH2Files odir maybe_package ifaces pkg_paths = do let filesHH2File = package++".HxF" doc = - text "<?xml version=\"1.0\"?>" $$
- text "<!DOCTYPE HelpFileList SYSTEM \"ms-help://hx/resources/HelpFileList.DTD\">" $$
- text "<HelpFileList DTDVersion=\"1.0\">" $$
- nest 4 (ppMods ifaces $$
- text "<File Url=\""<>text contentsHtmlFile<>text "\"/>" $$
- text "<File Url=\""<>text indexHtmlFile<>text "\"/>" $$
- ppIndexFiles chars $$
- ppLibFiles ("":pkg_paths)) $$
- text "</HelpFileList>"
+ text "<?xml version=\"1.0\"?>" $$ + text "<!DOCTYPE HelpFileList SYSTEM \"ms-help://hx/resources/HelpFileList.DTD\">" $$ + text "<HelpFileList DTDVersion=\"1.0\">" $$ + nest 4 (ppMods ifaces $$ + text "<File Url=\""<>text contentsHtmlFile<>text "\"/>" $$ + text "<File Url=\""<>text indexHtmlFile<>text "\"/>" $$ + ppIndexFiles chars $$ + ppLibFiles ("":pkg_paths)) $$ + text "</HelpFileList>" writeFile (pathJoin [odir, filesHH2File]) (render doc) where package = fromMaybe "pkg" maybe_package ppMods [] = empty ppMods ((Module mdl,_):ifaces) = - text "<File Url=\"" <> text (moduleHtmlFile mdl) <> text "\"/>" $$
+ text "<File Url=\"" <> text (moduleHtmlFile mdl) <> text "\"/>" $$ ppMods ifaces ppIndexFiles [] = empty ppIndexFiles (c:cs) = - text "<File Url=\""<>text (subIndexHtmlFile c)<>text "\"/>" $$
+ text "<File Url=\""<>text (subIndexHtmlFile c)<>text "\"/>" $$ ppIndexFiles cs -
- ppLibFiles [] = empty
- ppLibFiles (path:paths) =
- ppLibFile cssFile $$
- ppLibFile iconFile $$
- ppLibFile jsFile $$
- ppLibFile plusFile $$
- ppLibFile minusFile $$
- ppLibFiles paths
- where
- toPath fname | null path = fname
+ + ppLibFiles [] = empty + ppLibFiles (path:paths) = + ppLibFile cssFile $$ + ppLibFile iconFile $$ + ppLibFile jsFile $$ + ppLibFile plusFile $$ + ppLibFile minusFile $$ + ppLibFiles paths + where + toPath fname | null path = fname | otherwise = pathJoin [path, fname] - ppLibFile fname = text "<File Url=\""<>text (toPath fname)<>text "\"/>"
+ ppLibFile fname = text "<File Url=\""<>text (toPath fname)<>text "\"/>" chars :: [Char] chars = keysFM (foldr getIfaceIndex emptyFM ifaces) @@ -160,20 +160,20 @@ ppHH2Collection odir doctitle maybe_package = do collectionHH2File = package++".HxC" doc = - text "<?xml version=\"1.0\"?>" $$
- text "<!DOCTYPE HelpCollection SYSTEM \"ms-help://hx/resources/HelpCollection.DTD\">" $$
- text "<HelpCollection DTDVersion=\"1.0\" LangId=\"1033\" Title=\"" <> text doctitle <> text "\">" $$
- nest 4 (text "<CompilerOptions CreateFullTextIndex=\"Yes\">" $$
- nest 4 (text "<IncludeFile File=\"" <> text package <> text ".HxF\"/>") $$
- text "</CompilerOptions>" $$
- text "<TOCDef File=\"" <> text package <> text ".HxT\"/>" $$
- text "<KeywordIndexDef File=\"" <> text package <> text "K.HxK\"/>" $$
- text "<KeywordIndexDef File=\"" <> text package <> text "N.HxK\"/>" $$
- text "<ItemMoniker Name=\"!DefaultToc\" ProgId=\"HxDs.HxHierarchy\" InitData=\"\"/>" $$
- text "<ItemMoniker Name=\"!DefaultFullTextSearch\" ProgId=\"HxDs.HxFullTextSearch\" InitData=\"\"/>" $$
- text "<ItemMoniker Name=\"!DefaultAssociativeIndex\" ProgId=\"HxDs.HxIndex\" InitData=\"A\"/>" $$
- text "<ItemMoniker Name=\"!DefaultKeywordIndex\" ProgId=\"HxDs.HxIndex\" InitData=\"K\"/>" $$
- text "<ItemMoniker Name=\"!DefaultNamedUrlIndex\" ProgId=\"HxDs.HxIndex\" InitData=\"NamedURLIndex\"/>" $$
- text "<ItemMoniker Name=\"!SampleInfo\" ProgId=\"HxDs.HxSampleCollection\" InitData=\"\"/>") $$
- text "</HelpCollection>"
+ text "<?xml version=\"1.0\"?>" $$ + text "<!DOCTYPE HelpCollection SYSTEM \"ms-help://hx/resources/HelpCollection.DTD\">" $$ + text "<HelpCollection DTDVersion=\"1.0\" LangId=\"1033\" Title=\"" <> text doctitle <> text "\">" $$ + nest 4 (text "<CompilerOptions CreateFullTextIndex=\"Yes\">" $$ + nest 4 (text "<IncludeFile File=\"" <> text package <> text ".HxF\"/>") $$ + text "</CompilerOptions>" $$ + text "<TOCDef File=\"" <> text package <> text ".HxT\"/>" $$ + text "<KeywordIndexDef File=\"" <> text package <> text "K.HxK\"/>" $$ + text "<KeywordIndexDef File=\"" <> text package <> text "N.HxK\"/>" $$ + text "<ItemMoniker Name=\"!DefaultToc\" ProgId=\"HxDs.HxHierarchy\" InitData=\"\"/>" $$ + text "<ItemMoniker Name=\"!DefaultFullTextSearch\" ProgId=\"HxDs.HxFullTextSearch\" InitData=\"\"/>" $$ + text "<ItemMoniker Name=\"!DefaultAssociativeIndex\" ProgId=\"HxDs.HxIndex\" InitData=\"A\"/>" $$ + text "<ItemMoniker Name=\"!DefaultKeywordIndex\" ProgId=\"HxDs.HxIndex\" InitData=\"K\"/>" $$ + text "<ItemMoniker Name=\"!DefaultNamedUrlIndex\" ProgId=\"HxDs.HxIndex\" InitData=\"NamedURLIndex\"/>" $$ + text "<ItemMoniker Name=\"!SampleInfo\" ProgId=\"HxDs.HxSampleCollection\" InitData=\"\"/>") $$ + text "</HelpCollection>" writeFile (pathJoin [odir, collectionHH2File]) (render doc) |