Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ema:note:date value to the template #550

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion emanote/src/Emanote/View/Template.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Emanote.View.Template (emanoteSiteOutput, render) where

import Control.Monad.Logger (MonadLoggerIO)
import Data.Aeson.Optics (key, _String)
import Data.Aeson.Types qualified as Aeson
import Data.List (partition)
import Data.Map.Syntax ((##))
Expand Down Expand Up @@ -34,7 +35,8 @@ import Heist.Extra.Splices.Tree qualified as Splices
import Heist.Interpreted qualified as HI
import Heist.Splices qualified as Heist
import Optics.Core (Prism', review)
import Optics.Operators ((.~), (^.))
import Optics.Operators ((.~), (^.), (^?))
import Optics.Optic ((%))
import Relude
import Text.Blaze.Renderer.XmlHtml qualified as RX
import Text.Pandoc.Builder qualified as B
Expand Down Expand Up @@ -174,6 +176,8 @@ renderLmlHtml model note = do
-- Note stuff
"ema:note:title" ##
C.titleSplice ctx (note ^. MN.noteTitle)
forM_ (MN._noteMeta note ^? key "date" % _String) $ \date ->
"ema:note:date" ## HI.textSplice date
"ema:note:source-path" ##
HI.textSplice
$ toText sourcePath
Expand Down