some work

This commit is contained in:
Pagwin 2024-11-15 23:55:31 -05:00
parent 3cb14be999
commit e3cbfdb2fb
No known key found for this signature in database
GPG key ID: 81137023740CA260
4 changed files with 14 additions and 4 deletions

6
TODO
View file

@ -1,10 +1,14 @@
Fix compile errors from setting up the groundwork for rss and section css shenanigans so I can do the rss feed now
Clean up the
make the date format ISO (Markdown seems fine, just need typst)? make the date format ISO (Markdown seems fine, just need typst)?
make typst dependant on yaml? make typst dependant on yaml?
add template variable(s) for what "section" we're in add template variable(s) for what "section" we're in
add description attr make it so typst citation section has a header and/or is a div elem instead of a section element
github action for deploy to github pages github action for deploy to github pages

View file

@ -160,6 +160,7 @@ rss =
outputDir </> "index.xml" %> \target -> do outputDir </> "index.xml" %> \target -> do
postPaths <- getPublishedPosts postPaths <- getPublishedPosts
posts <- sortOn (Ord.Down . postDate) <$> forM postPaths readPost posts <- sortOn (Ord.Down . postDate) <$> forM postPaths readPost
-- TODO: change this to actually have it's own type for things like updated
applyTemplateAndWrite "feed.xml" (HM.singleton "posts" posts) target applyTemplateAndWrite "feed.xml" (HM.singleton "posts" posts) target
Shake.putInfo $ "Built " <> target Shake.putInfo $ "Built " <> target

View file

@ -4,7 +4,8 @@ import Data.Text (Text)
import Deriving.Aeson import Deriving.Aeson
import Deriving.Aeson.Stock (PrefixedSnake) import Deriving.Aeson.Stock (PrefixedSnake)
data Page = Page {pageTitle :: Text, pageContent :: Text} -- pageSection is what css class should be specified in a style html element, I would do an enum but I foresee that being a mistake
data Page = Page {pageTitle :: Text, pageContent :: Text, pageNow :: Text, pageSection :: Text}
deriving (Show, Generic) deriving (Show, Generic)
deriving (ToJSON) via PrefixedSnake "page" Page deriving (ToJSON) via PrefixedSnake "page" Page
@ -16,7 +17,9 @@ data RenderedPost = RenderedPost
rPostDate :: Maybe Text, rPostDate :: Maybe Text,
rPostIsoDate :: Maybe Text, rPostIsoDate :: Maybe Text,
rPostContent :: Maybe Text, rPostContent :: Maybe Text,
rPostLink :: Maybe Text rPostLink :: Maybe Text,
rPostSummary :: Maybe Text,
rPostId :: Text
} }
deriving (Show, Generic) deriving (Show, Generic)
deriving (FromJSON, ToJSON) via PrefixedSnake "rPost" RenderedPost deriving (FromJSON, ToJSON) via PrefixedSnake "rPost" RenderedPost
@ -28,6 +31,7 @@ data Post = Post
postDate :: Maybe Text, postDate :: Maybe Text,
postContent :: Maybe Text, postContent :: Maybe Text,
postLink :: Maybe Text, postLink :: Maybe Text,
postSummary :: Maybe Text,
postDraft :: Maybe Bool postDraft :: Maybe Bool
} }
deriving (Show, Generic) deriving (Show, Generic)

View file

@ -161,4 +161,5 @@ getPublishedPosts = do
parseDate :: Text -> Maybe Text parseDate :: Text -> Maybe Text
parseDate str = do parseDate str = do
date <- parseTimeM False defaultTimeLocale "%Y-%-m-%-d" $ T.unpack str date <- parseTimeM False defaultTimeLocale "%Y-%-m-%-d" $ T.unpack str
return $ T.pack $ formatTime @UTCTime defaultTimeLocale "%Y-%m-%d" date -- need to append the time to avoid potential issues
return $ T.pack $ formatTime @UTCTime defaultTimeLocale "%Y-%m-%dT00:00:00Z" date