From 25b141de8410ac57835a8392b223d680ea0c6134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berk=20=C3=96zk=C3=BCt=C3=BCk?= Date: Thu, 12 Dec 2024 18:03:12 +0100 Subject: [PATCH] haddock: make CSS path absolute, use it for index generation --- Cabal/src/Distribution/Simple/Haddock.hs | 1 + cabal-install/src/Distribution/Client/CmdHaddock.hs | 3 ++- changelog.d/pr-10637 | 11 +++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 changelog.d/pr-10637 diff --git a/Cabal/src/Distribution/Simple/Haddock.hs b/Cabal/src/Distribution/Simple/Haddock.hs index f264f2342ea..a8bdc9acc67 100644 --- a/Cabal/src/Distribution/Simple/Haddock.hs +++ b/Cabal/src/Distribution/Simple/Haddock.hs @@ -618,6 +618,7 @@ fromHaddockProjectFlags flags = , argInterfaces = fromFlagOrDefault [] (haddockProjectInterfaces flags) , argLinkedSource = Flag True , argResourcesDir = haddockProjectResourcesDir flags + , argCssFile = haddockProjectCss flags } fromPackageDescription :: HaddockTarget -> PackageDescription -> HaddockArgs diff --git a/cabal-install/src/Distribution/Client/CmdHaddock.hs b/cabal-install/src/Distribution/Client/CmdHaddock.hs index 8ecc5487798..677589e3e35 100644 --- a/cabal-install/src/Distribution/Client/CmdHaddock.hs +++ b/cabal-install/src/Distribution/Client/CmdHaddock.hs @@ -136,7 +136,8 @@ mkFlagsAbsolute :: NixStyleFlags ClientHaddockFlags -> IO (NixStyleFlags ClientH mkFlagsAbsolute relFlags = do let relHaddockFlags = haddockFlags relFlags absHaddockOutputDir <- traverse makeAbsolute (haddockOutputDir relHaddockFlags) - return (relFlags{haddockFlags = relHaddockFlags{haddockOutputDir = absHaddockOutputDir}}) + absHaddockCss <- traverse makeAbsolute (haddockCss relHaddockFlags) + return (relFlags{haddockFlags = relHaddockFlags{haddockOutputDir = absHaddockOutputDir, haddockCss = absHaddockCss}}) -- | The @haddock@ command is TODO. -- diff --git a/changelog.d/pr-10637 b/changelog.d/pr-10637 new file mode 100644 index 00000000000..0cff281a4d0 --- /dev/null +++ b/changelog.d/pr-10637 @@ -0,0 +1,11 @@ +--- +synopsis: Fix Haddock CSS handling in multi-package projects +packages: [cabal-install, Cabal] +prs: 10637 +issues: [10636] +--- + +When `--css=` flag is provided to `cabal haddock-project`: + +- the Haddock index is now properly styled by the provided CSS file +- each package in the project now has their docs properly styled by the provided CSS file