@@ -12,7 +12,7 @@ import Data.Data (Data)
12
12
import Data.Default (def )
13
13
import Data.List.NonEmpty (NonEmpty ((:|) ), groupBy , toList )
14
14
import Data.Maybe (fromMaybe )
15
- import Data.Monoid ( (<>) )
15
+ import qualified Data.Text as T
16
16
import qualified Data.Tree as Tree
17
17
import Data.Typeable (Typeable )
18
18
import Hakyll
@@ -189,7 +189,7 @@ isDraftPost ident = do
189
189
isDraft <- fromMaybe " false" <$> getMetadataField ident " draft"
190
190
return $ isDraft == " true"
191
191
192
- postItemIdentifiers :: MonadMetadata m => m [Identifier ]
192
+ postItemIdentifiers :: ( MonadFail m , MonadMetadata m ) => m [Identifier ]
193
193
postItemIdentifiers = do
194
194
idents <- getMatches " posts/**"
195
195
idents' <- filterM (fmap not . isDraftPost) idents
@@ -254,15 +254,15 @@ addSpaceAroundAsciiInlines = concatMap addSpaceInline
254
254
-- 'textLangToInline'. Blocks of Latin text will be placed in @\<span\>@ tags
255
255
-- with an @\"ascii\"@ class.
256
256
addSpaceInline :: Inline -> [Inline ]
257
- addSpaceInline (Str string) = textLangToInline <$> splitOnLanguage string
257
+ addSpaceInline (Str string) = textLangToInline <$> splitOnLanguage ( T. unpack string)
258
258
addSpaceInline inline = [inline]
259
259
260
260
-- | This is a tag around a 'String' representing whether the 'String' is Latin
261
261
-- ('English') or 'Japanese'. 'String's that are neither Latin or 'Japanese'
262
262
-- are treated as 'Japanese'. See 'charLangToTextLang'.
263
263
data TextLang
264
- = Japanese String
265
- | English String
264
+ = Japanese T. Text
265
+ | English T. Text
266
266
deriving (Data , Eq , Read , Show , Typeable )
267
267
268
268
-- | This is a tag around a 'Char' representing whether the 'Char' is Latin or
@@ -384,11 +384,11 @@ groupByCharLang = groupBy f
384
384
-- Japanese "\20132\30058"
385
385
charLangToTextLang :: NonEmpty CharLang -> TextLang
386
386
charLangToTextLang cs@ (JapaneseChar {} :| _) =
387
- Japanese . toList $ charLangToChar <$> cs
387
+ Japanese . T. pack . toList $ charLangToChar <$> cs
388
388
charLangToTextLang cs@ (EnglishChar {} :| _) =
389
- English . toList $ charLangToChar <$> cs
389
+ English . T. pack . toList $ charLangToChar <$> cs
390
390
391
- getFeedConfig :: MonadMetadata m => Identifier -> m FeedConfiguration
391
+ getFeedConfig :: ( MonadFail m , MonadMetadata m ) => Identifier -> m FeedConfiguration
392
392
getFeedConfig ident = do
393
393
feedTitle <- getMetadataField' ident " title"
394
394
feedDescription <- getMetadataField' ident " description"
@@ -407,15 +407,15 @@ data PostSection = PostSection
407
407
} deriving Show
408
408
409
409
-- | Extract element ID from `Attr`.
410
- attrId :: Attr -> String
410
+ attrId :: Attr -> T. Text
411
411
attrId (x, _, _) = x
412
412
413
413
-- | Construct `Attr` with ID.
414
- idAttr :: String -> Attr
414
+ idAttr :: T. Text -> Attr
415
415
idAttr s = (s, [] , [] )
416
416
417
417
-- | Construct `Attr` with one class.
418
- classAttr :: String -> Attr
418
+ classAttr :: T. Text -> Attr
419
419
classAttr s = (" " , [s], [] )
420
420
421
421
-- | Eliminate all links from `Block`s or `Inline`s.
@@ -469,7 +469,7 @@ makeTOCList xs0@(x0 : _) = PB.bulletList $ Tree.foldTree fld <$> unfoldTree_DF u
469
469
470
470
listItem :: PostSection -> PB. Blocks
471
471
listItem PostSection {.. } =
472
- PB. plain $ PB. link (" #" ++ attrId psHeaderAttr)
472
+ PB. plain $ PB. link (" #" <> attrId psHeaderAttr)
473
473
(attrId psHeaderAttr)
474
474
(PB. fromList $ elimLink psHeaderInline)
475
475
@@ -482,7 +482,7 @@ makeSectionBlock PostSection{..} = hd <> PB.fromList psContent
482
482
<> PB. fromList psHeaderInline
483
483
484
484
anchor = PB. spanWith (classAttr " link-to-here-outer" ) $
485
- PB. link (" #" ++ attrId psHeaderAttr)
485
+ PB. link (" #" <> attrId psHeaderAttr)
486
486
(attrId psHeaderAttr) $
487
487
PB. spanWith (classAttr " link-to-here" ) $
488
488
PB. str " Link to" <> PB. linebreak <> PB. str " here"
0 commit comments