From 053c2e06318a10faf82a6fea3cfb3daa20bd084e Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Fri, 19 Feb 2016 20:38:15 +0900 Subject: [PATCH] add renderNoPackages to handle plural, and append colon --- Handler/Package.hs | 5 +++++ templates/package.hamlet | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Handler/Package.hs b/Handler/Package.hs index 098f0ea..5f5f392 100644 --- a/Handler/Package.hs +++ b/Handler/Package.hs @@ -7,6 +7,7 @@ module Handler.Package , getPackageSnapshotsR , packagePage , getPackageBadgeR + , renderNoPackages ) where import Data.Char @@ -226,3 +227,7 @@ getPackageSnapshotsR pn = $(combineStylesheets 'StaticR [css_font_awesome_min_css]) $(widgetFile "package-snapshots")) + +renderNoPackages :: Int -> Text +renderNoPackages n = + T.pack $ show n ++ " package" ++ (if n == 1 then "" else "s") diff --git a/templates/package.hamlet b/templates/package.hamlet index e31c85c..9118d7b 100644 --- a/templates/package.hamlet +++ b/templates/package.hamlet @@ -122,7 +122,7 @@ $if not (LT.null (LT.renderHtml (packageChangelog package)))
- Depends on + Depends on:
$forall (i,(name, range)) <- deps $if i /= 0 @@ -131,7 +131,7 @@ $if not (LT.null (LT.renderHtml (packageChangelog package))) #{name} $if not $ null revdeps
- Used by #{length revdeps} packages: + Used by #{renderNoPackages $ length revdeps}:
$forall (i,(name, range)) <- revdeps $if i /= 0