Updates, added pdf.
This commit is contained in:
parent
9ddc693b3a
commit
a6a4910acf
33
Shakefile.hs
33
Shakefile.hs
|
@ -148,6 +148,11 @@ buildRules = do
|
|||
if out == siteDir </> "archive.html"
|
||||
then buildArchive getPosts getTemplate out
|
||||
else genHtmlAction getPost getTemplate out
|
||||
".pdf" -> do
|
||||
txtExists <- doesFileExist (srcDir </> asset)
|
||||
if txtExists
|
||||
then copyFileChanged (srcDir </> asset) out
|
||||
else genPdfAction getPost out
|
||||
".txt" -> do
|
||||
txtExists <- doesFileExist (srcDir </> asset)
|
||||
if txtExists
|
||||
|
@ -261,8 +266,11 @@ genHtmlAction
|
|||
:: (FilePath -> Action BlogPost)
|
||||
-> (FilePath -> Action Template) -> [Char] -> Action ()
|
||||
genHtmlAction getPost getTemplate out = do
|
||||
let isPost = takeDirectory1 (dropDirectory1 out) == "posts"
|
||||
template <- getTemplate ("templates" </> if isPost then "post.mustache" else "main.mustache")
|
||||
let tplname = case takeDirectory1 (dropDirectory1 out) of
|
||||
"posts" -> "post.mustache"
|
||||
"drafts" -> "post.mustache"
|
||||
_ -> "main.mustache"
|
||||
template <- getTemplate ("templates" </> tplname)
|
||||
let srcFile = srcDir </> (dropDirectory1 (out -<.> "org"))
|
||||
liftIO $ putText $ "need: " <> (toS srcFile) <> " -> " <> (toS out)
|
||||
need [srcFile]
|
||||
|
@ -278,6 +286,7 @@ genHtmlAction getPost getTemplate out = do
|
|||
, "body" .= innerHtml
|
||||
, "orgsource" .= T.pack (postUrl bp -<.> "org")
|
||||
, "txtsource" .= T.pack (postUrl bp -<.> "txt")
|
||||
, "pdf" .= T.pack (postUrl bp -<.> "pdf")
|
||||
, "permalink" .= T.pack (toS origin <> postUrl bp)
|
||||
]
|
||||
writeFile' out (toS htmlContent)
|
||||
|
@ -305,12 +314,31 @@ genAsciiAction getPost out = do
|
|||
<> toS origin <> toS (postUrl bp) <> "\n\n"
|
||||
writeFile' out (toS (preamble <> toS innerAscii))
|
||||
|
||||
genPdfAction getPost out = do
|
||||
let srcFile = srcDir </> (dropDirectory1 (out -<.> "org"))
|
||||
need [srcFile]
|
||||
command_ [] "pandoc"
|
||||
["--pdf-engine=xelatex"
|
||||
, "--resource-path=" <> takeDirectory srcFile
|
||||
, srcFile
|
||||
, "-H", "engine" </> "deeplist.tex"
|
||||
, "-V", "mainfont:Hoefler Text"
|
||||
, "-V", "monofont:Menlo"
|
||||
, "-V", "monofontoptions:Scale=0.7"
|
||||
, "-o", out ]
|
||||
|
||||
allHtmlAction :: Action ()
|
||||
allHtmlAction = do
|
||||
allOrgFiles <- getDirectoryFiles srcDir ["//*.org"]
|
||||
let allHtmlFiles = map (-<.> "html") allOrgFiles
|
||||
need (map build allHtmlFiles)
|
||||
|
||||
allPdfAction :: Action ()
|
||||
allPdfAction = do
|
||||
allOrgFiles <- getDirectoryFiles srcDir ["//*.org"]
|
||||
let allHtmlFiles = map (-<.> "pdf") allOrgFiles
|
||||
need (map build allHtmlFiles)
|
||||
|
||||
allAsciiAction :: Action ()
|
||||
allAsciiAction = do
|
||||
allOrgFiles <- getDirectoryFiles srcDir ["//*.org"]
|
||||
|
@ -341,6 +369,7 @@ needAll = do
|
|||
need (map build $ allAssets <> ["archive.html"])
|
||||
allHtmlAction
|
||||
allAsciiAction
|
||||
allPdfAction
|
||||
|
||||
allRule :: Rules ()
|
||||
allRule = phony "all" needAll
|
||||
|
|
2
_full/.gitignore
vendored
2
_full/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*
|
||||
!.gitignore
|
24
engine/deeplist.tex
Normal file
24
engine/deeplist.tex
Normal file
|
@ -0,0 +1,24 @@
|
|||
\usepackage{enumitem}
|
||||
\setlistdepth{9}
|
||||
|
||||
\setlist[itemize,1]{label=$\bullet$}
|
||||
\setlist[itemize,2]{label=$\bullet$}
|
||||
\setlist[itemize,3]{label=$\bullet$}
|
||||
\setlist[itemize,4]{label=$\bullet$}
|
||||
\setlist[itemize,5]{label=$\bullet$}
|
||||
\setlist[itemize,6]{label=$\bullet$}
|
||||
\setlist[itemize,7]{label=$\bullet$}
|
||||
\setlist[itemize,8]{label=$\bullet$}
|
||||
\setlist[itemize,9]{label=$\bullet$}
|
||||
\renewlist{itemize}{itemize}{9}
|
||||
|
||||
\setlist[enumerate,1]{label=$\arabic*.$}
|
||||
\setlist[enumerate,2]{label=$\alph*.$}
|
||||
\setlist[enumerate,3]{label=$\roman*.$}
|
||||
\setlist[enumerate,4]{label=$\arabic*.$}
|
||||
\setlist[enumerate,5]{label=$\alpha*$}
|
||||
\setlist[enumerate,6]{label=$\roman*.$}
|
||||
\setlist[enumerate,7]{label=$\arabic*.$}
|
||||
\setlist[enumerate,8]{label=$\alph*.$}
|
||||
\setlist[enumerate,9]{label=$\roman*.$}
|
||||
\renewlist{enumerate}{enumerate}{9}
|
|
@ -36,7 +36,7 @@ Since I wrote my article the Haskell ecosystem has evolved:
|
|||
While the learning curve is as steep as before, the highest point of
|
||||
learning just climbed higher and higher with each successive new GHC release.
|
||||
3. Still no real consencus about how to work, learn, and use Haskell.
|
||||
In my opinion there are three different perspective on Haskell that
|
||||
In my opinion there are three different perspectives on Haskell that
|
||||
could definitively change how you make decisions about different aspect
|
||||
of Haskell programming.
|
||||
I believe the main groups of ideolgies are application developers, library
|
||||
|
@ -67,21 +67,20 @@ I am kind of confident that my Haskell understanding is a lot better than
|
|||
before.
|
||||
But I still think, the ability to learn new Haskell subject is infinite.
|
||||
|
||||
One article I would like to write someday is about my current team
|
||||
philosophy about programming.
|
||||
Someday I would like to write a post about my current team philosophy about
|
||||
programming.
|
||||
Our main rule is to use as few features of a programming language as
|
||||
possible to achieve your goal.
|
||||
possible to achieve our goal.
|
||||
This is a kind of merge between minimalism and pragmatism that in the end
|
||||
provide a tremendous amount of benefits.
|
||||
This is why, even if I like to play with the latest Haskell trendy features,
|
||||
I generally program without those.
|
||||
This is why, even if I like to play with the latest Haskell trendy
|
||||
features, I generally program without those.
|
||||
With just a very few amount of Haskell features you will already be in
|
||||
enviromnent with a *lot* of benefits as compared to many programming
|
||||
languages.
|
||||
|
||||
So enough talk, here is my old article updated with a some changes and
|
||||
cleanups.
|
||||
I also added a section about how to create a new project template with nix.
|
||||
So enough talk, here is my updated article.
|
||||
I added a section about how to create a new project template with nix.
|
||||
|
||||
I will try to write other articles about how to write a real program in
|
||||
Haskell.
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
<a href="https://her.esy.fun">Yann Esposito's blog</a> -
|
||||
<a href="{{orgsource}}">source</a> -
|
||||
<a href="{{txtsource}}">txt</a> -
|
||||
<a href="{{pdf}}">pdf</a> -
|
||||
<a class="permalink" href="{{permalink}}">§permalink</a>
|
||||
</div>
|
||||
<div class="abstract">
|
||||
|
|
Loading…
Reference in a new issue