Skip to content

Commit

Permalink
[ GenerateNews ] Some debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikNordvallForsberg committed Oct 24, 2023
1 parent 8ec40ab commit 512ebdf
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions GenerateNews.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import Data.Text (Text)
import qualified Data.Text as T

import Control.Applicative
import Control.Monad
import Data.Foldable

import Network.HTTP.Client
import Network.HTTP.Client.TLS
Expand Down Expand Up @@ -133,12 +135,23 @@ itemToHTML i = do
desc <- T.unpack <$> getItemDescription i
pure desc

printRSStitle :: Item -> IO ()
printRSStitle i = do
case (getItemTitle i, getItemDate i) of
(Just t, Just d) -> putStrLn (T.unpack d ++ ": " ++ T.unpack t)
_ -> pure ()


main :: IO ()
main = do

rss <- getPureRSS 5
let header = "### default.html(section.news=current,headtags=<link rel='stylesheet' href='{{rootPath}}css/pure.css' type='text/css'/>)\n<!-- DO NOT EDIT THIS FILE DIRECTLY — EDIT _news.yaml AND RUN GenerateNews.hs INSTEAD -->"
let items = catMaybes $ map itemToHTML rss
when (not $ null items) $ do
putStrLn "\n===================\nRecent publications\n==================="
traverse_ printRSStitle rss
putStrLn ""
let pubs = if (null items) then "" else
div "recent-pubs" $
(h2 "Recent MSP publications") ++
Expand Down

0 comments on commit 512ebdf

Please sign in to comment.