aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Xhtml/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Xhtml/Types.hs')
-rw-r--r--haddock-api/src/Haddock/Backends/Xhtml/Types.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Types.hs b/haddock-api/src/Haddock/Backends/Xhtml/Types.hs
index e3fd2d5a..a68cb559 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Types.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Types.hs
@@ -12,6 +12,8 @@
-----------------------------------------------------------------------------
module Haddock.Backends.Xhtml.Types (
SourceURLs, WikiURLs,
+ BaseURL,
+ withBaseURL,
LinksInfo,
Splice,
Unicode,
@@ -20,12 +22,21 @@ module Haddock.Backends.Xhtml.Types (
import Data.Map
import GHC
+import qualified System.FilePath as FilePath
-- the base, module and entity URLs for the source code and wiki links.
type SourceURLs = (Maybe FilePath, Maybe FilePath, Map Unit FilePath, Map Unit FilePath)
type WikiURLs = (Maybe FilePath, Maybe FilePath, Maybe FilePath)
+-- | base url for loading js, json, css resources. The default is "."
+--
+type BaseURL = Maybe String
+
+-- TODO: we shouldn't use 'FilePath.</>'
+withBaseURL :: BaseURL -> String -> String
+withBaseURL Nothing uri = uri
+withBaseURL (Just baseUrl) uri = baseUrl FilePath.</> uri
-- The URL for source and wiki links
type LinksInfo = (SourceURLs, WikiURLs)