This commit is contained in:
Yann Esposito (Yogsototh) 2020-06-23 08:44:02 +02:00
parent c1a00e1c09
commit d201cf8b1b
Signed by untrusted user who does not match committer: yogsototh
GPG Key ID: 7B19A4C650D59646
3 changed files with 12 additions and 17 deletions

View File

@ -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"

View File

@ -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>

View File

@ -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">