fixed almos everything
This commit is contained in:
parent
6c3f4f3031
commit
78008d3df4
1 changed files with 13 additions and 9 deletions
22
Shakefile.hs
22
Shakefile.hs
|
@ -75,12 +75,22 @@ inlineToText :: PandocMonad m => [Inline] -> m T.Text
|
||||||
inlineToText inline =
|
inlineToText inline =
|
||||||
Writers.writeAsciiDoc def (Pandoc nullMeta [Plain inline])
|
Writers.writeAsciiDoc def (Pandoc nullMeta [Plain inline])
|
||||||
|
|
||||||
|
reformatDate :: Text -> Text
|
||||||
|
reformatDate = T.takeWhile (/= ' ') . (T.dropAround dateEnvelope)
|
||||||
|
where
|
||||||
|
dateEnvelope ' ' = True
|
||||||
|
dateEnvelope '\n' = True
|
||||||
|
dateEnvelope '\t' = True
|
||||||
|
dateEnvelope '[' = True
|
||||||
|
dateEnvelope ']' = True
|
||||||
|
dateEnvelope _ = False
|
||||||
|
|
||||||
getBlogpostFromMetas
|
getBlogpostFromMetas
|
||||||
:: (MonadIO m, MonadFail m) => [Char] -> Bool -> Pandoc -> m BlogPost
|
:: (MonadIO m, MonadFail m) => [Char] -> Bool -> Pandoc -> m BlogPost
|
||||||
getBlogpostFromMetas path toc pandoc@(Pandoc meta _) = do
|
getBlogpostFromMetas path toc pandoc@(Pandoc meta _) = do
|
||||||
eitherBlogpost <- liftIO $ Pandoc.runIO $ do
|
eitherBlogpost <- liftIO $ Pandoc.runIO $ do
|
||||||
title <- fmap (T.dropEnd 1) $ inlineToText $ docTitle meta
|
title <- fmap (T.dropEnd 1) $ inlineToText $ docTitle meta
|
||||||
date <- fmap (T.takeWhile (/= ' ') . (T.dropAround dateEnvelope)) $ inlineToText $ docDate meta
|
date <- fmap reformatDate $ inlineToText $ docDate meta
|
||||||
author <- case head $ docAuthors meta of
|
author <- case head $ docAuthors meta of
|
||||||
Just m -> inlineToText m
|
Just m -> inlineToText m
|
||||||
Nothing -> return ""
|
Nothing -> return ""
|
||||||
|
@ -92,12 +102,6 @@ getBlogpostFromMetas path toc pandoc@(Pandoc meta _) = do
|
||||||
Left _ -> fail "BAD"
|
Left _ -> fail "BAD"
|
||||||
Right bp -> return bp
|
Right bp -> return bp
|
||||||
where
|
where
|
||||||
dateEnvelope ' ' = True
|
|
||||||
dateEnvelope '\n' = True
|
|
||||||
dateEnvelope '\t' = True
|
|
||||||
dateEnvelope '[' = True
|
|
||||||
dateEnvelope ']' = True
|
|
||||||
dateEnvelope _ = False
|
|
||||||
tagsToList (Just (MetaList ms)) = map toStr ms
|
tagsToList (Just (MetaList ms)) = map toStr ms
|
||||||
tagsToList _ = []
|
tagsToList _ = []
|
||||||
descr (Just (MetaString t)) = t
|
descr (Just (MetaString t)) = t
|
||||||
|
@ -219,8 +223,8 @@ postamble now bp =
|
||||||
, "| tags | " <> T.intercalate " " (map ("#"<>) (postTags bp)) <> " |"
|
, "| tags | " <> T.intercalate " " (map ("#"<>) (postTags bp)) <> " |"
|
||||||
, "| date | " <> postDate bp <> " |"
|
, "| date | " <> postDate bp <> " |"
|
||||||
, "| rss | [[file:/rss.xml][RSS]] ([[https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fher.esy.fun%2Frss.xml][validate]]) |"
|
, "| rss | [[file:/rss.xml][RSS]] ([[https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fher.esy.fun%2Frss.xml][validate]]) |"
|
||||||
, "| size | XXK (html XXK, css XXK, img XXK) |"
|
, "| size | @@html:<div class=\"web-file-size\">XXK (html XXK, css XXK, img XXK)</div>@@ |"
|
||||||
, "| gz | XXK (html XXK, css XXK, img XXK) |"
|
, "| gz | @@html:<div class=\"gzweb-file-size\">XXK (html XXK, css XXK, img XXK)</div>@@ |"
|
||||||
, "| generated | " <> now <> " |"
|
, "| generated | " <> now <> " |"
|
||||||
, ""
|
, ""
|
||||||
, "@@html:</footer>@@"
|
, "@@html:</footer>@@"
|
||||||
|
|
Loading…
Reference in a new issue