Use slugger 0.1.0.1 for post titles
This commit is contained in:
parent
b96baa843e
commit
a816227da7
5 changed files with 21 additions and 37 deletions
|
@ -2,9 +2,9 @@
|
|||
|
||||
import Control.Monad (forM_)
|
||||
import Data.Maybe (fromMaybe)
|
||||
import qualified Data.Text as T
|
||||
import Hakyll
|
||||
import Slug (toSlug)
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text.Slugger as Slugger
|
||||
import Text.Pandoc
|
||||
( Extension (Ext_fenced_code_attributes, Ext_footnotes, Ext_gfm_auto_identifiers, Ext_implicit_header_references, Ext_smart),
|
||||
Extensions,
|
||||
|
@ -229,7 +229,7 @@ getTitleFromMeta =
|
|||
|
||||
fileNameFromTitle :: Metadata -> FilePath
|
||||
fileNameFromTitle =
|
||||
T.unpack . (`T.append` ".html") . toSlug . T.pack . getTitleFromMeta
|
||||
T.unpack . (`T.append` ".html") . Slugger.toSlug . T.pack . getTitleFromMeta
|
||||
|
||||
titleRoute :: Metadata -> Routes
|
||||
titleRoute =
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Slug
|
||||
( toSlug,
|
||||
)
|
||||
where
|
||||
|
||||
import Data.Char (isAlphaNum)
|
||||
import qualified Data.Text as T
|
||||
|
||||
keepAlphaNum :: Char -> Char
|
||||
keepAlphaNum x
|
||||
| isAlphaNum x = x
|
||||
| otherwise = ' '
|
||||
|
||||
clean :: T.Text -> T.Text
|
||||
clean =
|
||||
T.map keepAlphaNum . T.replace "'" "" . T.replace "&" "and"
|
||||
|
||||
toSlug :: T.Text -> T.Text
|
||||
toSlug =
|
||||
T.intercalate (T.singleton '-') . T.words . T.toLower . clean
|
|
@ -9,11 +9,10 @@ license-file: LICENSE
|
|||
executable hakyll-site
|
||||
main-is: Main.hs
|
||||
hs-source-dirs: src
|
||||
build-depends: base == 4.*
|
||||
, hakyll ^>= 4.14
|
||||
, pandoc
|
||||
, text
|
||||
, time
|
||||
other-modules: Slug
|
||||
build-depends: base >= 4.8
|
||||
, hakyll >= 4.14
|
||||
, pandoc == 2.11.*
|
||||
, slugger >= 0.1.0.1
|
||||
, text >= 1.2
|
||||
ghc-options: -Wall -threaded
|
||||
default-language: Haskell2010
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue