From 7c8b019ee1bac046209ef37c795147141cb726e0 Mon Sep 17 00:00:00 2001 From: Janus Troelsen Date: Sun, 7 Apr 2024 16:58:20 -0600 Subject: [PATCH] Add Tested-With to package page --- datafiles/templates/Html/package-page.html.st | 9 +++++++++ src/Distribution/Server/Pages/PackageFromTemplate.hs | 12 +++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/datafiles/templates/Html/package-page.html.st b/datafiles/templates/Html/package-page.html.st index cfa131b8d..bf9359971 100644 --- a/datafiles/templates/Html/package-page.html.st +++ b/datafiles/templates/Html/package-page.html.st @@ -140,6 +140,15 @@ $package.buildDepends$ + $if(package.optional.hasTestedWith)$ + + Tested with + + $package.optional.testedWith$ + + + $endif$ + License $package.license$ diff --git a/src/Distribution/Server/Pages/PackageFromTemplate.hs b/src/Distribution/Server/Pages/PackageFromTemplate.hs index 6cf3e2624..82ac34744 100644 --- a/src/Distribution/Server/Pages/PackageFromTemplate.hs +++ b/src/Distribution/Server/Pages/PackageFromTemplate.hs @@ -33,7 +33,7 @@ import Text.XHtml.Strict hiding (p, name, title, content) import qualified Text.XHtml.Strict as XHtml import Data.Maybe (maybeToList, fromMaybe, isJust) -import Data.List (intersperse) +import Data.List (intercalate, intersperse) import System.FilePath.Posix ((), takeFileName, dropTrailingPathSeparator) import Data.Time.Format (defaultTimeLocale, formatTime) @@ -228,6 +228,12 @@ packagePageTemplate render (vList $ map sourceRepositoryToHtml (sourceRepos desc)) ] ++ + [ templateVal "hasTestedWith" + (not $ null pkgTestedWith) + , templateVal "testedWith" + (intercalate ", " pkgTestedWith) + ] ++ + [ templateVal "hasSynopsis" (not . Short.null $ synopsis (rendOther render)) , templateVal "synopsis" @@ -238,6 +244,10 @@ packagePageTemplate render pkgid = rendPkgId render pkgVer = display $ pkgVersion pkgid pkgName = display $ packageName pkgid + pkgTestedWith = + [ display compilerFlavor ++ " " ++ display versionRange + | (compilerFlavor, versionRange) <- testedWith desc + ] desc = rendOther render