on master help sign in
Add test for new relativizeUrls
commitc015be003ead11000b84f70ae5bcc2708b04c3f8 authorJasper Van der Jeugt <m@jaspervdj.be> dateMon 3 Oct 2011, 09:44 (15 years ago) parentc8a970d
3 files changed+12−5
src/Hakyll/Web/Urls/Relativize.hs+2−1 tests/Hakyll/Web/Urls/Relativize/Tests.hs+5 web/about.markdown+5−4
src/Hakyll/Web/Urls/Relativize.hs+2−1
@@ -44,4 +44,5 @@ relativizeUrls :: String -- ^ Path to the site root
4444 -> String -- ^ Resulting HTML
4545relativizeUrls root = withUrls rel
4646 where
47− rel x = if "/" `isPrefixOf` x && not ("//" `isPrefixOf` x) then root ++ x else x
47+ isRel x = "/" `isPrefixOf` x && not ("//" `isPrefixOf` x)
48+ rel x = if isRel x then root ++ x else x
tests/Hakyll/Web/Urls/Relativize/Tests.hs+5
@@ -17,4 +17,9 @@ tests = fromAssertions "relativizeUrls"
1717 relativizeUrls "../.." "<img src=\"/images/lolcat.png\" />"
1818 , "<a href=\"http://haskell.org\">Haskell</a>" @=?
1919 relativizeUrls "../.." "<a href=\"http://haskell.org\">Haskell</a>"
20+ , "<a href=\"http://haskell.org\">Haskell</a>" @=?
21+ relativizeUrls "../.." "<a href=\"http://haskell.org\">Haskell</a>"
22+ , "<script src=\"//ajax.googleapis.com/jquery.min.js\"></script>" @=?
23+ relativizeUrls "../.."
24+ "<script src=\"//ajax.googleapis.com/jquery.min.js\"></script>"
2025 ]
web/about.markdown+5−4
@@ -28,9 +28,10 @@ you will have to license your code under a GPL-compatible license.
2828Hakyll was originally written by [Jasper Van der Jeugt](http://jaspervdj.be),
2929who still maintains the package. Contributors:
3030
31−- [seschwar](http://github.com/seschwar)
32−- [JD Marble](http://github.com/jdmarble)
33−- [sargon](http://github.com/sargon)
34−- [Paolo Veronelli](http://github.com/paolino)
31+- [Andy Irving](https://github.com/irv)
3532- [Benedict Eastaugh](http://extralogical.net/)
33+- [JD Marble](http://github.com/jdmarble)
3634- [Nicolas Wu](http://zenzike.com/)
35+- [Paolo Veronelli](http://github.com/paolino)
36+- [sargon](http://github.com/sargon)
37+- [seschwar](http://github.com/seschwar)