about summary refs log tree commit diff
path: root/web/tazblog/src/Blog.hs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-02-09T00·43+0000
committerVincent Ambo <tazjin@google.com>2020-02-09T00·43+0000
commit05ab6825b3451687fbaf6f8c987e94e616b6d4ff (patch)
treed1e8ad284bc89f6f6eb6156121151465fa3e3672 /web/tazblog/src/Blog.hs
parent9fc9b58301b3e0c538ffb8b7e4e7a7dab9fbc243 (diff)
chore(web): Delete //web/tazblog r/499
Deleting this code feels strange. This project has been around for a
decade, and despite occasionally needing a bunch of tweaks it had aged
well and worked fine for a very long time.

I've reached a strange point where I don't really feel like using
Haskell anymore, and every interaction with this project in recent
years has been fighting dependency management tooling for Haskell, or
dealing with strange build problems.

The simple fact is that the service never really did anything other
than render Markdown dynamically, and at this point I can do that much
better with //tools/cheddar instead.

So, tazblog-hs, it's time to say goodbye. Rest in peace!
Diffstat (limited to 'web/tazblog/src/Blog.hs')
-rw-r--r--web/tazblog/src/Blog.hs141
1 files changed, 0 insertions, 141 deletions
diff --git a/web/tazblog/src/Blog.hs b/web/tazblog/src/Blog.hs
deleted file mode 100644
index 0a53b5f2fb..0000000000
--- a/web/tazblog/src/Blog.hs
+++ /dev/null
@@ -1,141 +0,0 @@
-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE QuasiQuotes #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE TypeFamilies #-}
-
-module Blog where
-
-import BlogStore
-import Data.Text (Text, pack)
-import qualified Data.Text as T
-import Data.Text.Lazy (fromStrict)
-import Data.Time
-import Text.Blaze.Html (preEscapedToHtml)
-import Text.Hamlet
-import Text.Markdown
-
-blogTitle :: Text = "tazjin's blog"
-
-repoURL :: Text = "https://bitbucket.org/tazjin/tazblog-haskell"
-
-mailTo :: Text = "mailto:mail@tazj.in"
-
-twitter :: Text = "https://twitter.com/tazjin"
-
-replace :: Eq a => a -> a -> [a] -> [a]
-replace x y = map (\z -> if z == x then y else z)
-
--- |After this date all entries are Markdown
-markdownCutoff :: Day
-markdownCutoff = fromGregorian 2013 04 28
-
-blogTemplate :: Text -> Html -> Html
-blogTemplate t_append body =
-  [shamlet|
-$doctype 5
-  <head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <meta name="description" content=#{blogTitle}#{t_append}>
-    <link rel="stylesheet" type="text/css" href="/static/blog.css" media="all">
-    <link rel="alternate" type="application/rss+xml" title="RSS-Feed" href="/rss.xml">
-    <title>#{blogTitle}#{t_append}
-  <body>
-    <header>
-      <h1>
-        <a href="/" .unstyled-link>#{blogTitle}
-      <hr>
-    ^{body}
-    ^{showFooter}
-|]
-
-showFooter :: Html
-showFooter =
-  [shamlet|
-<footer>
-  <p .footer>Served without any dynamic languages.
-  <p .footer>
-    <a href=#{repoURL} .uncoloured-link>
-    |
-    <a href=#{twitter} .uncoloured-link>Twitter
-    |
-    <a href=#{mailTo} .uncoloured-link>Mail
-  <p .lod>
-    ಠ_ಠ
-|]
-
-isEntryMarkdown :: Entry -> Bool
-isEntryMarkdown e = edate e > markdownCutoff
-
-renderEntryMarkdown :: Text -> Html
-renderEntryMarkdown = markdown def {msXssProtect = False} . fromStrict
-
-renderEntries :: [Entry] -> Maybe Html -> Html
-renderEntries entries pageLinks =
-  [shamlet|
-$forall entry <- entries
-  <article>
-    <h2 .inline>
-      <a href=#{linkElems entry} .unstyled-link>
-        #{title entry}
-    <aside .date>
-      #{pack $ formatTime defaultTimeLocale "%Y-%m-%d" $ edate entry}
-    $if (isEntryMarkdown entry)
-      ^{renderEntryMarkdown $ text entry}
-    $else
-      ^{preEscapedToHtml $ text entry}
-  <hr>
-$maybe links <- pageLinks
-  ^{links}
-|]
-  where
-    linkElems Entry {..} = "/" ++ show entryId
-
-showLinks :: Maybe Int -> Html
-showLinks (Just i) =
-  [shamlet|
-  $if ((>) i 1)
-    <div .navigation>
-      <a href=#{nLink $ succ i} .uncoloured-link>Earlier
-      |
-      <a href=#{nLink $ pred i} .uncoloured-link>Later
-  $elseif ((<=) i 1)
-    ^{showLinks Nothing}
-|]
-  where
-    nLink page = T.concat ["/?page=", show' page]
-showLinks Nothing =
-  [shamlet|
-<div .navigation>
-  <a href="/?page=2" .uncoloured-link>Earlier
-|]
-
-renderEntry :: Entry -> Html
-renderEntry e@Entry {..} =
-  [shamlet|
-<article>
-  <h2 .inline>
-    #{title}
-  <aside .date>
-    #{pack $ formatTime defaultTimeLocale "%Y-%m-%d" edate}
-  $if (isEntryMarkdown e)
-    ^{renderEntryMarkdown text}
-  $else
-    ^{preEscapedToHtml $ text}
-<hr>
-|]
-
-showError :: Text -> Text -> Html
-showError title err =
-  blogTemplate (": " <> title)
-    [shamlet|
-<p>:(
-<p>#{err}
-<hr>
-|]