summaryrefslogtreecommitdiff
path: root/src/Hakyll/Alias.hs
diff options
context:
space:
mode:
authorChris Wells <chris@mathematicaster.org>2025-03-25 17:31:18 -0500
committerChris Wells <chris@mathematicaster.org>2025-03-25 17:31:18 -0500
commitf902be4f4641262787c623deac267c02d89fec7c (patch)
tree0252b58eb2600c28c53187633f0b80348daf9614 /src/Hakyll/Alias.hs
parente2a0c8d336f2644218573bdec0f83cd675944c5f (diff)
downloadmain-f902be4f4641262787c623deac267c02d89fec7c.tar
main-f902be4f4641262787c623deac267c02d89fec7c.tar.gz
main-f902be4f4641262787c623deac267c02d89fec7c.tar.bz2
main-f902be4f4641262787c623deac267c02d89fec7c.tar.lz
main-f902be4f4641262787c623deac267c02d89fec7c.tar.xz
main-f902be4f4641262787c623deac267c02d89fec7c.tar.zst
main-f902be4f4641262787c623deac267c02d89fec7c.zip
Working more on my publication list
Diffstat (limited to 'src/Hakyll/Alias.hs')
-rw-r--r--src/Hakyll/Alias.hs23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/Hakyll/Alias.hs b/src/Hakyll/Alias.hs
index 063ea2b..33ed5c1 100644
--- a/src/Hakyll/Alias.hs
+++ b/src/Hakyll/Alias.hs
@@ -20,12 +20,23 @@ import Hakyll.Web.Template.Util (functionField1)
aliasCtxt :: (Ord a, FromAlias a x) => String -> (String -> Compiler a) -> (x -> Compiler String) -> AliasMap a x -> Context c
aliasCtxt name toa fromx amap = functionField1 name $ toa >=> flip resolveAlias amap >=> fromx
+aliasCtxtFrom :: (Ord a, FromAlias a x) => String -> (String -> Compiler a) -> (x -> Compiler String) -> Identifier -> Context c
+aliasCtxtFrom name toa fromx ident = functionField1 name $ \s -> do
+ amap <- loadBody ident
+ toa s >>= flip resolveAlias amap >>= fromx
-personCtxt :: (StringConv StrictText s, Ord (Name s), ToMarkup s) => AliasMap (Name s) (Person s) -> Context a
-personCtxt = aliasCtxt "personA" (ffmap toSL . parseName . toSL) (pure . toSL . personHtml)
-licenseCtxt :: (StringConv String s, Ord s, ToMarkup s) => AliasMap s (License s) -> Context a
-licenseCtxt = aliasCtxt "licenseA" (pure . toSL) (pure . toSL . licenseHtml)
+-- personCtxt :: (StringConv StrictText s, Ord (Name s), ToMarkup s) => AliasMap (Name s) (Person s) -> Context a
+personCtxt :: Identifier -> Context a
+personCtxt = aliasCtxtFrom @StrictText "personA" (ffmap toSL . parseName . toSL) (pure . toSL . personHtml)
-journalCtxt :: (StringConv String s, Ord s, ToMarkup s) => AliasMap s (Journal s) -> Context a
-journalCtxt = aliasCtxt "journalA" (pure . toSL) (pure . toSL . journalHtml)
+-- personCtxtFrom :: Identifier -> Context a
+-- personCtxtFrom = functionField1
+
+-- licenseCtxt :: (StringConv String s, Ord s, ToMarkup s) => AliasMap s (License s) -> Context a
+licenseCtxt :: Identifier -> Context a
+licenseCtxt = aliasCtxtFrom @StrictText "licenseA" (pure . toSL) (pure . toSL . licenseHtml)
+
+-- journalCtxt :: (StringConv String s, Ord s, ToMarkup s) => AliasMap s (Journal s) -> Context a
+journalCtxt :: Identifier -> Context a
+journalCtxt = aliasCtxtFrom @StrictText "journalA" (pure . toSL) (pure . toSL . journalHtml)