wip
This commit is contained in:
parent
c1a00e1c09
commit
d201cf8b1b
11
Shakefile.hs
11
Shakefile.hs
|
@ -22,6 +22,7 @@ import Text.Pandoc.Definition ( Pandoc(..)
|
|||
, Inline
|
||||
, nullMeta
|
||||
, docTitle
|
||||
, lookupMeta
|
||||
, docDate
|
||||
, docAuthors
|
||||
)
|
||||
|
@ -59,6 +60,7 @@ data BlogPost =
|
|||
, postAuthors :: [T.Text]
|
||||
, postUrl :: FilePath
|
||||
, postBody :: Pandoc
|
||||
-- , postToc :: Boolean
|
||||
}
|
||||
|
||||
inlineToText :: PandocMonad m => [Inline] -> m T.Text
|
||||
|
@ -72,7 +74,6 @@ getBlogpostFromMetas path pandoc@(Pandoc meta _) = do
|
|||
title <- inlineToText $ docTitle meta
|
||||
date <- inlineToText $ docDate meta
|
||||
authors <- mapM inlineToText $ docAuthors meta
|
||||
-- let url = dropExtension path
|
||||
return $ BlogPost title date authors path pandoc
|
||||
case eitherBlogpost of
|
||||
Left _ -> fail "BAD"
|
||||
|
@ -146,9 +147,17 @@ mkGetTemplate = newCache $ \path -> do
|
|||
Left _ -> fail "BAD"
|
||||
Right template -> return template
|
||||
|
||||
parseOptions :: Text -> [Text] -> Maybe Text
|
||||
parseOptions fc =
|
||||
fc & T.lines
|
||||
& map T.toLower
|
||||
& filter (T.isPrefixOf (T.pack "#options: "))
|
||||
& head
|
||||
|
||||
mkGetPost :: Rules (FilePath -> Action BlogPost)
|
||||
mkGetPost = newCache $ \path -> do
|
||||
fileContent <- readFile' path
|
||||
let options = parseOptions (toS fileContent)
|
||||
eitherResult <- liftIO $ Pandoc.runIO $ Readers.readOrg def (toS fileContent)
|
||||
case eitherResult of
|
||||
Left _ -> fail "BAD"
|
||||
|
|
|
@ -33,22 +33,10 @@
|
|||
<div class="content"><h1>{{title}}</h1></div>
|
||||
</div>
|
||||
<div id="content">
|
||||
<p>
|
||||
<nav>
|
||||
<a href="/index.html">Home</a> |
|
||||
<a href="/archive.html">Posts</a> |
|
||||
<a href="/slides.html">Slides</a> |
|
||||
<a href="/about-me.html">About</a>
|
||||
<span class="details">
|
||||
(<a href="https://gitea.esy.fun/yogsototh">code</a>
|
||||
<a href="https://espial.esy.fun/u:yogsototh">bookmarks</a>
|
||||
<a href="https://espial.esy.fun/u:yogsototh/notes">notes</a>)
|
||||
</span>
|
||||
</nav>
|
||||
</p>
|
||||
|
||||
{{{ body }}}
|
||||
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<div class="content">
|
||||
<footer><i>Any comment? Click on my email below and I'll add it.</i>
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
<input name="t" type="radio" id="d">
|
||||
<div id="labels">
|
||||
<div class="content">
|
||||
<label for="l">light</label>
|
||||
|
|
||||
<label for="d">dark</label>
|
||||
<label for="l">light</label> | <label for="d">dark</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main">
|
||||
|
|
Loading…
Reference in New Issue