Move some attributes around
This commit is contained in:
parent
ec31242981
commit
56e90e4567
|
@ -5,7 +5,9 @@
|
|||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
$if(desc)$
|
||||
<meta name="description" content="$desc$">
|
||||
$endif$
|
||||
|
||||
$if(author)$
|
||||
<meta name="author" content="$author$">
|
||||
|
@ -18,7 +20,9 @@
|
|||
<meta property="og:site_name" content="$siteName$">
|
||||
<meta property="og:title" content="$title$">
|
||||
<meta property="og:url" content="$root$$url$">
|
||||
$if(desc)$
|
||||
<meta property="og:description" content="$desc$">
|
||||
$endif$
|
||||
|
||||
$if(image)$
|
||||
<meta property="og:image" content="$root$$image$">
|
||||
|
@ -33,7 +37,9 @@
|
|||
<meta property="twitter:card" content="summary_large_image">
|
||||
<meta property="twitter:site" content="$siteName$">
|
||||
<meta property="twitter:title" content="$title$">
|
||||
$if(desc)$
|
||||
<meta property="twitter:description" content="$desc$">
|
||||
$endif$
|
||||
|
||||
$if(image)$
|
||||
<meta property="twitter:image" content="$root$$image$">
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
<small>(updated: $updated$)</small>
|
||||
$endif$
|
||||
</div>
|
||||
$if(alternative_writings)$
|
||||
$if(alternatives)$
|
||||
<div>
|
||||
$alternative_writings$
|
||||
$alternatives$
|
||||
</div>
|
||||
$endif$
|
||||
</header>
|
||||
|
|
|
@ -35,13 +35,35 @@ replaceFuriganaWithKanji :: FuriganaTemplate -> String
|
|||
replaceFuriganaWithKanji = gsub [re|\[(.*?)\]\((.*?)\)|] (\(kanji:kana:_) -> kanji :: String)
|
||||
|
||||
replaceFuriganaWithHtml :: FuriganaTemplate -> String
|
||||
replaceFuriganaWithHtml = between "<ruby>" "</ruby>" . gsub [re|\[(.*?)\]\((.*?)\)|] (\(kanji:kana:_) -> "<rb>" ++ kanji ++"</rb> <rp>(</rp><rt> " ++ kana ++ "</rt><rp>)</rp>" :: String)
|
||||
replaceFuriganaWithHtml = between "<ruby>" "</ruby>" . gsub regex matchToHtml
|
||||
where
|
||||
regex = [re|\[(.*?)\]\((.*?)\)|]
|
||||
|
||||
between :: String -> String -> String -> String
|
||||
between x y s = x ++ s ++ y
|
||||
|
||||
matchToHtml :: [String] -> String
|
||||
matchToHtml (kanji:kana:_) =
|
||||
let defaultKanji = if kanji == "" then "〇" else kanji
|
||||
in foldr1 (++) ["<rb>", defaultKanji, "</rb> <rp>(</rp><rt>", kana, "</rt><rp>)</rp>"]
|
||||
|
||||
|
||||
|
||||
{- |
|
||||
title: String
|
||||
titleHtml: String
|
||||
finished: Boolean
|
||||
updated: String
|
||||
lang: String
|
||||
antonyms: Maybe [String]
|
||||
synonyms: Maybe [String]
|
||||
leads_here: Maybe [String]
|
||||
alternatives: Maybe [String]
|
||||
see_also: Maybe [String]
|
||||
-}
|
||||
gogenCtx :: Context String
|
||||
gogenCtx =
|
||||
dateField "date" "%Y-%m-%d"
|
||||
<> field "titleHtml" convertFuriganaTitleHtml
|
||||
<> defaultContext
|
||||
|
||||
<> constField "lang" "en"
|
|
@ -85,7 +85,9 @@ main = hakyllWith config $ do
|
|||
constField "type" "article"
|
||||
<> field "title" convertFuriganaTitle
|
||||
<> field "titleHtml" convertFuriganaTitleHtml
|
||||
<> postCtx
|
||||
<> constField "root" root
|
||||
<> constField "siteName" siteName
|
||||
<> gogenCtx
|
||||
|
||||
route $ setExtension ".html"
|
||||
compile $ do
|
||||
|
|
Loading…
Reference in New Issue