aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Hyperlinker.hs
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-27 18:03:56 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-30 22:37:49 +0200
commitab070206d67748232995a262b533957a5a7b9315 (patch)
treeaaaaab9e14250a2c8d290f4fadf0204608504b53 /haddock-api/src/Haddock/Backends/Hyperlinker.hs
parentd58bcf24dfa4333e7893935eb86c036be28125b1 (diff)
Rewrite source generation to fixed links and directory structure.
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Hyperlinker.hs')
-rw-r--r--haddock-api/src/Haddock/Backends/Hyperlinker.hs29
1 files changed, 12 insertions, 17 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker.hs b/haddock-api/src/Haddock/Backends/Hyperlinker.hs
index 6c66e0c6..f197eaa3 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker.hs
@@ -1,8 +1,9 @@
-module Haddock.Backends.Hyperlinker (ppHyperlinkedSource) where
+module Haddock.Backends.Hyperlinker
+ ( ppHyperlinkedSource
+ , module Haddock.Backends.Hyperlinker.Utils
+ ) where
import Haddock.Types
-import Haddock.Backends.Xhtml.Types
-import Haddock.Backends.Xhtml.Utils
import Haddock.Backends.Hyperlinker.Renderer
import Haddock.Backends.Hyperlinker.Utils
@@ -14,36 +15,30 @@ import System.FilePath
ppHyperlinkedSource :: FilePath -> FilePath
-> Maybe FilePath
- -> SourceURLs
-> [Interface]
-> IO ()
-ppHyperlinkedSource outdir libdir mstyle urls ifaces = do
+ppHyperlinkedSource outdir libdir mstyle ifaces = do
createDirectoryIfMissing True srcdir
let cssFile = fromMaybe (defaultCssFile libdir) mstyle
copyFile cssFile $ srcdir </> srcCssFile
copyFile (libdir </> "html" </> highlightScript) $
srcdir </> highlightScript
- mapM_ (ppHyperlinkedModuleSource outdir urls) ifaces
+ mapM_ (ppHyperlinkedModuleSource srcdir) ifaces
where
- srcdir = srcPath outdir urls
+ srcdir = outdir </> hypSrcDir
-ppHyperlinkedModuleSource :: FilePath -> SourceURLs -> Interface -> IO ()
-ppHyperlinkedModuleSource outdir urls iface = case ifaceTokenizedSrc iface of
+ppHyperlinkedModuleSource :: FilePath -> Interface -> IO ()
+ppHyperlinkedModuleSource srcdir iface = case ifaceTokenizedSrc iface of
Just tokens ->
- writeFile path $ showHtml . render mCssFile mJsFile urls $ tokens
+ writeFile path $ showHtml . render mCssFile mJsFile $ tokens
Nothing -> return ()
where
mCssFile = Just $ srcCssFile
mJsFile = Just $ highlightScript
- srcFile = spliceURL Nothing (Just $ ifaceMod iface) Nothing Nothing $
- srcModUrl urls
- path = outdir </> srcFile
-
-srcPath :: FilePath -> SourceURLs -> FilePath
-srcPath outdir urls = outdir </> takeDirectory (srcModUrl urls)
+ path = srcdir </> hypSrcModuleFile (ifaceMod iface)
srcCssFile :: FilePath
-srcCssFile = "srcstyle.css"
+srcCssFile = "style.css"
highlightScript :: FilePath
highlightScript = "highlight.js"