diff --git a/blog-meta/lib/Misc.hs b/blog-meta/lib/Misc.hs index acf970d..b060ee3 100644 --- a/blog-meta/lib/Misc.hs +++ b/blog-meta/lib/Misc.hs @@ -25,10 +25,14 @@ getOptionsWith hdr mkDef descrs = do exitFailure makeSlug :: Text -> Text -makeSlug name = Text.map toSlugChar name where - toSlugChar c - | isAlphaNum c && isAscii c || c == '-' = toLower c - | otherwise = '_' +makeSlug = Text.intercalate "-" . filter (not . Text.null) . chunks where + chunks txt = + if Text.null txt then [] else + let (this', that') = Text.span isOK txt + this = Text.map toLower this' + that = Text.dropWhile (not . isOK) that' in + this : chunks that + isOK c = (isAlphaNum c && isAscii c) || c == '-' toTextList :: MetaValue -> Maybe [Text] diff --git a/templates/taglist.html b/templates/taglist.html index 4882947..c42f9f9 100644 --- a/templates/taglist.html +++ b/templates/taglist.html @@ -2,7 +2,7 @@