diff --git a/src/naritachi/suru.md b/src/gogen/suru.md
similarity index 74%
rename from src/naritachi/suru.md
rename to src/gogen/suru.md
index 72b2eb8..eb2ada2 100644
--- a/src/naritachi/suru.md
+++ b/src/gogen/suru.md
@@ -1,6 +1,6 @@
---
desc: "I announce myself to the world"
-keywords: "japanese, naritachi, grammar"
+keywords: "japanese, gogen, grammar"
lang: "en"
updated: "2020-09-22T12:00:00Z"
title: "[為](す)る"
diff --git a/src/index.html b/src/index.html
index 90feb0e..d0f4aba 100644
--- a/src/index.html
+++ b/src/index.html
@@ -31,9 +31,9 @@ title: "Nani"
語源
- $for(naritachi)$
+ $for(gogen)$
-
-
+
$endfor$
diff --git a/src/templates/naritachi.html b/src/templates/gogen.html
similarity index 100%
rename from src/templates/naritachi.html
rename to src/templates/gogen.html
diff --git a/ssg/src/Formats/Naritachi.hs b/ssg/src/Formats/Gogen.hs
similarity index 72%
rename from ssg/src/Formats/Naritachi.hs
rename to ssg/src/Formats/Gogen.hs
index 0d420e3..40dc2ec 100644
--- a/ssg/src/Formats/Naritachi.hs
+++ b/ssg/src/Formats/Gogen.hs
@@ -1,14 +1,15 @@
{-# LANGUAGE QuasiQuotes, FlexibleContexts #-}
-module Formats.Naritachi (
+module Formats.Gogen (
convertFuriganaTitle,
- convertFuriganaTitleHtml
+ convertFuriganaTitleHtml,
+ gogenCtx,
) where
-import Hakyll (Item, Metadata, Compiler, itemIdentifier, getMetadata, lookupString)
+import Hakyll
import Debug.Trace (traceId)
import Data.Maybe (fromMaybe)
-import Text.Regex.PCRE.Heavy
+import Text.Regex.PCRE.Heavy (gsub, re)
--------------------------------------------------------------------------------
-- FURIGANA CONVERSION
@@ -37,15 +38,10 @@ replaceFuriganaWithHtml :: FuriganaTemplate -> String
replaceFuriganaWithHtml = between "
" "" . gsub [re|\[(.*?)\]\((.*?)\)|] (\(kanji:kana:_) -> "
" ++ kanji ++" " :: String)
where
between x y s = x ++ s ++ y
--- toHtml :: FuriganaTemplate -> String
--- toHtml input =
--- "
"
--- <> subRegex (mkRegex "[(.*?)]\\((.*?)\\)") input "\1 "
--- <> ""
---
---
---
---
---
+gogenCtx :: Context String
+gogenCtx =
+ dateField "date" "%Y-%m-%d"
+ <> field "titleHtml" convertFuriganaTitleHtml
+ <> defaultContext
diff --git a/ssg/src/Main.hs b/ssg/src/Main.hs
index 29fde9d..27b2719 100644
--- a/ssg/src/Main.hs
+++ b/ssg/src/Main.hs
@@ -19,7 +19,7 @@ import Text.Pandoc.Highlighting (Style, breezeDark, styleToCss)
-- ---------
-import Formats.Naritachi
+import Formats.Gogen
import Util.Routes
--------------------------------------------------------------------------------
@@ -73,14 +73,14 @@ main = hakyllWith config $ do
match "posts/*" $ do
let ctx = constField "type" "article" <> postCtx
- route $ metadataRoute titleRoute `composeRoutes` (prefixRoute "posts/")
+ route $ metadataRoute titleRoute `composeRoutes` prefixRoute "posts/"
compile $
pandocCompilerCustom
>>= loadAndApplyTemplate "templates/post.html" ctx
>>= saveSnapshot "content"
>>= loadAndApplyTemplate "templates/default.html" ctx
- match "naritachi/*" $ do
+ match "gogen/*" $ do
let ctx =
constField "type" "article"
<> field "title" convertFuriganaTitle
@@ -91,7 +91,7 @@ main = hakyllWith config $ do
compile $ do
pandocCompilerCustom
- >>= loadAndApplyTemplate "templates/naritachi.html" ctx
+ >>= loadAndApplyTemplate "templates/gogen.html" ctx
>>= saveSnapshot "content"
>>= loadAndApplyTemplate "templates/default.html" ctx
@@ -100,11 +100,11 @@ main = hakyllWith config $ do
compile $ do
-- posts :: Compiler
posts <- recentFirst =<< loadAll "posts/*"
- naritachi <- loadAll "naritachi/*"
+ gogen <- loadAll "gogen/*"
let indexCtx =
listField "posts" postCtx (return posts)
- <> listField "naritachi" postCtx (return naritachi)
+ <> listField "gogen" gogenCtx (return gogen)
<> constField "root" root
<> constField "siteName" siteName
<> defaultContext