aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock.hs
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-07-18 18:08:00 +1000
committerYuchen Pei <hi@ypei.me>2022-07-21 13:00:36 +1000
commit0fb8735cd2a324f973547d70077ffdacd3d5c9d7 (patch)
tree58bb33ce06369a8f25cc5758fd10bb42f2d31d49 /haddock-api/src/Haddock.hs
parent7bd04379ada2d9ff1c406d258629f8abdf617b30 (diff)
Adding org backend.
Diffstat (limited to 'haddock-api/src/Haddock.hs')
-rw-r--r--haddock-api/src/Haddock.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs
index e1775cc8..4095b88f 100644
--- a/haddock-api/src/Haddock.hs
+++ b/haddock-api/src/Haddock.hs
@@ -35,6 +35,7 @@ import Haddock.Backends.Xhtml.Themes (getThemes)
import Haddock.Backends.LaTeX
import Haddock.Backends.Hoogle
import Haddock.Backends.Hyperlinker
+import Haddock.Backends.Org
import Haddock.Interface
import Haddock.Interface.Json
import Haddock.Parser
@@ -214,7 +215,7 @@ haddockWithGhc ghc args = handleTopExceptions $ do
liftIO $ renderStep logger dflags unit_state flags sinceQual qual packages ifaces
else do
- when (any (`elem` [Flag_Html, Flag_Hoogle, Flag_LaTeX]) flags) $
+ when (any (`elem` [Flag_Html, Flag_Hoogle, Flag_LaTeX, Flag_Org]) flags) $
throwE "No input file(s)."
-- Get packages supplied with --read-interface.
@@ -469,6 +470,10 @@ render log' dflags unit_state flags sinceQual qual ifaces installedIfaces extSrc
ppLaTeX title pkgStr visibleIfaces odir (fmap _doc prologue) opt_latex_style
libDir
return ()
+ when (Flag_Org `elem` flags) $ do
+ withTiming logger dflags' "ppOrg" (const ()) $ do
+ let org = {-# SCC ppOrg #-} ppOrg title (_doc <$> prologue) (fromJust pkgStr) visibleIfaces
+ writeUtf8File (fromMaybe "haddock" (cleanPkgStr <$> pkgStr) <.> "org") org
when (Flag_HyperlinkedSource `elem` flags && not (null ifaces)) $ do
withTiming logger "ppHyperlinkedSource" (const ()) $ do