~jack/jackkelly-name

016c041803f531e1e87c78867194ddf45ffff666 — Jack Kelly 18 days ago a21221c
Fix slugs with / in them
2 files changed, 7 insertions(+), 3 deletions(-)

M src/Site.hs
M test/SiteSpec.hs
M src/Site.hs => src/Site.hs +1 -1
@@ 20,7 20,7 @@ sectionLabel = intercalate " | " . reverse . ("jackkelly.name":)

slug :: String -> String
slug = filter (not . (`elem` ("',!?()+:\"" :: String)))
  . replace "&. " '_'
  . replace "&./ " '_'
  . map toLower
  where
    replace :: String -> Char -> String -> String

M test/SiteSpec.hs => test/SiteSpec.hs +6 -2
@@ 329,7 329,11 @@ spec = do
                  "hobart_to_melbourne_to_hobart"),

                 ("Fun with Flags",
                  "fun_with_flags")]
                  "fun_with_flags"),

                 ("A Static Haskell/Reflex Frontend App",
                  "a_static_haskell_reflex_frontend_app")
                ]
    for_ cases $ \(input, expected) -> do
      specify ("slug " ++ (show input) ++ " == " ++ (show expected)) $
      specify ("slug " ++ show input ++ " == " ++ show expected) $
        slug input `shouldBe` expected