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
|
, Inline
|
||||||
, nullMeta
|
, nullMeta
|
||||||
, docTitle
|
, docTitle
|
||||||
|
, lookupMeta
|
||||||
, docDate
|
, docDate
|
||||||
, docAuthors
|
, docAuthors
|
||||||
)
|
)
|
||||||
|
@ -59,6 +60,7 @@ data BlogPost =
|
||||||
, postAuthors :: [T.Text]
|
, postAuthors :: [T.Text]
|
||||||
, postUrl :: FilePath
|
, postUrl :: FilePath
|
||||||
, postBody :: Pandoc
|
, postBody :: Pandoc
|
||||||
|
-- , postToc :: Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
inlineToText :: PandocMonad m => [Inline] -> m T.Text
|
inlineToText :: PandocMonad m => [Inline] -> m T.Text
|
||||||
|
@ -72,7 +74,6 @@ getBlogpostFromMetas path pandoc@(Pandoc meta _) = do
|
||||||
title <- inlineToText $ docTitle meta
|
title <- inlineToText $ docTitle meta
|
||||||
date <- inlineToText $ docDate meta
|
date <- inlineToText $ docDate meta
|
||||||
authors <- mapM inlineToText $ docAuthors meta
|
authors <- mapM inlineToText $ docAuthors meta
|
||||||
-- let url = dropExtension path
|
|
||||||
return $ BlogPost title date authors path pandoc
|
return $ BlogPost title date authors path pandoc
|
||||||
case eitherBlogpost of
|
case eitherBlogpost of
|
||||||
Left _ -> fail "BAD"
|
Left _ -> fail "BAD"
|
||||||
|
@ -146,9 +147,17 @@ mkGetTemplate = newCache $ \path -> do
|
||||||
Left _ -> fail "BAD"
|
Left _ -> fail "BAD"
|
||||||
Right template -> return template
|
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 :: Rules (FilePath -> Action BlogPost)
|
||||||
mkGetPost = newCache $ \path -> do
|
mkGetPost = newCache $ \path -> do
|
||||||
fileContent <- readFile' path
|
fileContent <- readFile' path
|
||||||
|
let options = parseOptions (toS fileContent)
|
||||||
eitherResult <- liftIO $ Pandoc.runIO $ Readers.readOrg def (toS fileContent)
|
eitherResult <- liftIO $ Pandoc.runIO $ Readers.readOrg def (toS fileContent)
|
||||||
case eitherResult of
|
case eitherResult of
|
||||||
Left _ -> fail "BAD"
|
Left _ -> fail "BAD"
|
||||||
|
|
|
@ -33,22 +33,10 @@
|
||||||
<div class="content"><h1>{{title}}</h1></div>
|
<div class="content"><h1>{{title}}</h1></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<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 }}}
|
{{{ body }}}
|
||||||
|
|
||||||
|
</div>
|
||||||
<div id="postamble" class="status">
|
<div id="postamble" class="status">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<footer><i>Any comment? Click on my email below and I'll add it.</i>
|
<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">
|
<input name="t" type="radio" id="d">
|
||||||
<div id="labels">
|
<div id="labels">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<label for="l">light</label>
|
<label for="l">light</label> | <label for="d">dark</label>
|
||||||
|
|
|
||||||
<label for="d">dark</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
|
|
Loading…
Reference in a new issue