src: format

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2023-08-26 20:45:10 +05:30
parent 7cb266782d
commit ba247f88d4

View File

@@ -6,11 +6,13 @@ import Data.Maybe (isJust)
import Data.Text (Text)
import qualified Data.Text as T
import Hakyll
import System.Environment (getEnv)
import System.FilePath (replaceDirectory, replaceExtension, takeDirectory)
import System.IO.Unsafe (unsafePerformIO)
import qualified System.Process as Process
import Text.Pandoc
( WriterOptions
( writerHighlightStyle,
import Text.Pandoc (
WriterOptions (
writerHighlightStyle,
writerNumberSections,
writerTOCDepth,
writerTableOfContents,
@@ -19,8 +21,6 @@ import Text.Pandoc
)
import qualified Text.Pandoc as Pandoc
import Text.Pandoc.Templates (Template, compileTemplate)
import System.Environment (getEnv)
import System.IO.Unsafe (unsafePerformIO)
--------------------------------------------------------------------------------
@@ -162,13 +162,13 @@ main = hakyllWith config $ do
_ <-
Process.system $
unwords
[ "xelatex",
"-halt-on-error",
"-output-directory",
tmpDir,
texPath,
">/dev/null",
"2>&1"
[ "xelatex"
, "-halt-on-error"
, "-output-directory"
, tmpDir
, texPath
, ">/dev/null"
, "2>&1"
]
return ()
@@ -177,23 +177,23 @@ main = hakyllWith config $ do
rssFeedConfiguration :: FeedConfiguration
rssFeedConfiguration =
FeedConfiguration
{ feedTitle = "nattopages",
feedDescription = "Pages by natto",
feedAuthorName = "Amneesh Singh",
feedAuthorEmail = "natto@weirdnatto.in",
feedRoot = "https://weirdnatto.in"
{ feedTitle = "nattopages"
, feedDescription = "Pages by natto"
, feedAuthorName = "Amneesh Singh"
, feedAuthorEmail = "natto@weirdnatto.in"
, feedRoot = "https://weirdnatto.in"
}
config :: Configuration
config =
defaultConfiguration
{ deployCommand = "rsync --checksum -ave 'ssh -p" ++ sshTargetPort ++"' _site/* " ++ sshTarget,
previewPort = 3333
{ deployCommand = "rsync --checksum -ave 'ssh -p" ++ sshTargetPort ++ "' _site/* " ++ sshTarget
, previewPort = 3333
}
where
{-# NOINLINE sshTarget#-}
{-# NOINLINE sshTarget #-}
sshTarget = unsafePerformIO $ getEnv "SSHTARGET"
{-# NOINLINE sshTargetPort#-}
{-# NOINLINE sshTargetPort #-}
sshTargetPort = unsafePerformIO $ getEnv "SSHTARGETPORT"
postCtx :: Tags -> Context String
@@ -223,23 +223,23 @@ defaultCtx =
subdomains = map mkItem ["git", "radio", "f"]
where
mkItem :: a -> Item a
mkItem a = Item {itemIdentifier = "subdomain", itemBody = a}
mkItem a = Item{itemIdentifier = "subdomain", itemBody = a}
writerOptions :: Bool -> WriterOptions
writerOptions withNumbering =
defaultHakyllWriterOptions
{ writerNumberSections = withNumbering,
writerTableOfContents = True,
writerTOCDepth = 2,
writerTemplate = Just tocTemplate
{ writerNumberSections = withNumbering
, writerTableOfContents = True
, writerTOCDepth = 2
, writerTemplate = Just tocTemplate
}
tocTemplate :: Text.Pandoc.Templates.Template Text
tocTemplate =
either error id . runIdentity . compileTemplate "" $
T.unlines
[ "<div class=\"toc\"><div class=\"toc-header\">Table of Contents</div>",
"$toc$",
"</div>",
"$body$"
[ "<div class=\"toc\"><div class=\"toc-header\">Table of Contents</div>"
, "$toc$"
, "</div>"
, "$body$"
]