@@ -12,7 +12,7 @@ import Data.Data (Data)
1212import Data.Default (def )
1313import Data.List.NonEmpty (NonEmpty ((:|) ), groupBy , toList )
1414import Data.Maybe (fromMaybe )
15- import Data.Monoid ( (<>) )
15+ import qualified Data.Text as T
1616import qualified Data.Tree as Tree
1717import Data.Typeable (Typeable )
1818import Hakyll
@@ -189,7 +189,7 @@ isDraftPost ident = do
189189 isDraft <- fromMaybe " false" <$> getMetadataField ident " draft"
190190 return $ isDraft == " true"
191191
192- postItemIdentifiers :: MonadMetadata m => m [Identifier ]
192+ postItemIdentifiers :: ( MonadFail m , MonadMetadata m ) => m [Identifier ]
193193postItemIdentifiers = do
194194 idents <- getMatches " posts/**"
195195 idents' <- filterM (fmap not . isDraftPost) idents
@@ -254,15 +254,15 @@ addSpaceAroundAsciiInlines = concatMap addSpaceInline
254254-- 'textLangToInline'. Blocks of Latin text will be placed in @\<span\>@ tags
255255-- with an @\"ascii\"@ class.
256256addSpaceInline :: Inline -> [Inline ]
257- addSpaceInline (Str string) = textLangToInline <$> splitOnLanguage string
257+ addSpaceInline (Str string) = textLangToInline <$> splitOnLanguage ( T. unpack string)
258258addSpaceInline inline = [inline]
259259
260260-- | This is a tag around a 'String' representing whether the 'String' is Latin
261261-- ('English') or 'Japanese'. 'String's that are neither Latin or 'Japanese'
262262-- are treated as 'Japanese'. See 'charLangToTextLang'.
263263data TextLang
264- = Japanese String
265- | English String
264+ = Japanese T. Text
265+ | English T. Text
266266 deriving (Data , Eq , Read , Show , Typeable )
267267
268268-- | This is a tag around a 'Char' representing whether the 'Char' is Latin or
@@ -384,11 +384,11 @@ groupByCharLang = groupBy f
384384-- Japanese "\20132\30058"
385385charLangToTextLang :: NonEmpty CharLang -> TextLang
386386charLangToTextLang cs@ (JapaneseChar {} :| _) =
387- Japanese . toList $ charLangToChar <$> cs
387+ Japanese . T. pack . toList $ charLangToChar <$> cs
388388charLangToTextLang cs@ (EnglishChar {} :| _) =
389- English . toList $ charLangToChar <$> cs
389+ English . T. pack . toList $ charLangToChar <$> cs
390390
391- getFeedConfig :: MonadMetadata m => Identifier -> m FeedConfiguration
391+ getFeedConfig :: ( MonadFail m , MonadMetadata m ) => Identifier -> m FeedConfiguration
392392getFeedConfig ident = do
393393 feedTitle <- getMetadataField' ident " title"
394394 feedDescription <- getMetadataField' ident " description"
@@ -407,15 +407,15 @@ data PostSection = PostSection
407407 } deriving Show
408408
409409-- | Extract element ID from `Attr`.
410- attrId :: Attr -> String
410+ attrId :: Attr -> T. Text
411411attrId (x, _, _) = x
412412
413413-- | Construct `Attr` with ID.
414- idAttr :: String -> Attr
414+ idAttr :: T. Text -> Attr
415415idAttr s = (s, [] , [] )
416416
417417-- | Construct `Attr` with one class.
418- classAttr :: String -> Attr
418+ classAttr :: T. Text -> Attr
419419classAttr s = (" " , [s], [] )
420420
421421-- | Eliminate all links from `Block`s or `Inline`s.
@@ -469,7 +469,7 @@ makeTOCList xs0@(x0 : _) = PB.bulletList $ Tree.foldTree fld <$> unfoldTree_DF u
469469
470470 listItem :: PostSection -> PB. Blocks
471471 listItem PostSection {.. } =
472- PB. plain $ PB. link (" #" ++ attrId psHeaderAttr)
472+ PB. plain $ PB. link (" #" <> attrId psHeaderAttr)
473473 (attrId psHeaderAttr)
474474 (PB. fromList $ elimLink psHeaderInline)
475475
@@ -482,7 +482,7 @@ makeSectionBlock PostSection{..} = hd <> PB.fromList psContent
482482 <> PB. fromList psHeaderInline
483483
484484 anchor = PB. spanWith (classAttr " link-to-here-outer" ) $
485- PB. link (" #" ++ attrId psHeaderAttr)
485+ PB. link (" #" <> attrId psHeaderAttr)
486486 (attrId psHeaderAttr) $
487487 PB. spanWith (classAttr " link-to-here" ) $
488488 PB. str " Link to" <> PB. linebreak <> PB. str " here"
0 commit comments