Skip to content

Commit

Permalink
Fix links to non-purescript dependencies (purescript#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Hrcek authored and hdgarrood committed Jan 31, 2019
1 parent d683362 commit b00917f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Handler/Packages.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Text.Julius (rawJS)
import Text.Blaze (ToMarkup, toMarkup)
import qualified Data.Char as Char
import Data.Version
import qualified Data.Text as T
import qualified Data.Text.Lazy as TL
import qualified Language.PureScript.Docs as D
import Web.Bower.PackageMeta (PackageName, runPackageName, bowerDependencies, bowerLicense)
Expand Down Expand Up @@ -88,6 +89,10 @@ getPackageVersionR (PathPackageName pkgName) (PathVersion version) =
$(widgetFile "packageVersion")
return (cacheStatus, content)

isPurescriptPackage :: PackageName -> Bool
isPurescriptPackage pkgName =
"purescript-" `T.isPrefixOf` runPackageName pkgName

getPackageIndexR :: Handler TypedContent
getPackageIndexR =
selectRep $ do
Expand Down
5 changes: 4 additions & 1 deletion templates/packageVersion.hamlet
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
$forall (depPkg, versionRange) <- dependencies
<dd .grouped-list__item>
<div .deplink>
<a .deplink__link href=@{packageNameRoute depPkg}>#{runPackageName depPkg}
$if isPurescriptPackage depPkg
<a .deplink__link href=@{packageNameRoute depPkg}>#{runPackageName depPkg}
$else
<a .deplink__link href="https://libraries.io/bower/#{runPackageName depPkg}">#{runPackageName depPkg}
<span .deplink__version>#{renderVersionRange versionRange}

0 comments on commit b00917f

Please sign in to comment.