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"
|
if out == siteDir </> "archive.html"
|
||||||
then buildArchive getPosts getTemplate out
|
then buildArchive getPosts getTemplate out
|
||||||
else genHtmlAction getPost 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
|
".txt" -> do
|
||||||
txtExists <- doesFileExist (srcDir </> asset)
|
txtExists <- doesFileExist (srcDir </> asset)
|
||||||
if txtExists
|
if txtExists
|
||||||
|
@ -261,8 +266,11 @@ genHtmlAction
|
||||||
:: (FilePath -> Action BlogPost)
|
:: (FilePath -> Action BlogPost)
|
||||||
-> (FilePath -> Action Template) -> [Char] -> Action ()
|
-> (FilePath -> Action Template) -> [Char] -> Action ()
|
||||||
genHtmlAction getPost getTemplate out = do
|
genHtmlAction getPost getTemplate out = do
|
||||||
let isPost = takeDirectory1 (dropDirectory1 out) == "posts"
|
let tplname = case takeDirectory1 (dropDirectory1 out) of
|
||||||
template <- getTemplate ("templates" </> if isPost then "post.mustache" else "main.mustache")
|
"posts" -> "post.mustache"
|
||||||
|
"drafts" -> "post.mustache"
|
||||||
|
_ -> "main.mustache"
|
||||||
|
template <- getTemplate ("templates" </> tplname)
|
||||||
let srcFile = srcDir </> (dropDirectory1 (out -<.> "org"))
|
let srcFile = srcDir </> (dropDirectory1 (out -<.> "org"))
|
||||||
liftIO $ putText $ "need: " <> (toS srcFile) <> " -> " <> (toS out)
|
liftIO $ putText $ "need: " <> (toS srcFile) <> " -> " <> (toS out)
|
||||||
need [srcFile]
|
need [srcFile]
|
||||||
|
@ -278,6 +286,7 @@ genHtmlAction getPost getTemplate out = do
|
||||||
, "body" .= innerHtml
|
, "body" .= innerHtml
|
||||||
, "orgsource" .= T.pack (postUrl bp -<.> "org")
|
, "orgsource" .= T.pack (postUrl bp -<.> "org")
|
||||||
, "txtsource" .= T.pack (postUrl bp -<.> "txt")
|
, "txtsource" .= T.pack (postUrl bp -<.> "txt")
|
||||||
|
, "pdf" .= T.pack (postUrl bp -<.> "pdf")
|
||||||
, "permalink" .= T.pack (toS origin <> postUrl bp)
|
, "permalink" .= T.pack (toS origin <> postUrl bp)
|
||||||
]
|
]
|
||||||
writeFile' out (toS htmlContent)
|
writeFile' out (toS htmlContent)
|
||||||
|
@ -305,12 +314,31 @@ genAsciiAction getPost out = do
|
||||||
<> toS origin <> toS (postUrl bp) <> "\n\n"
|
<> toS origin <> toS (postUrl bp) <> "\n\n"
|
||||||
writeFile' out (toS (preamble <> toS innerAscii))
|
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 :: Action ()
|
||||||
allHtmlAction = do
|
allHtmlAction = do
|
||||||
allOrgFiles <- getDirectoryFiles srcDir ["//*.org"]
|
allOrgFiles <- getDirectoryFiles srcDir ["//*.org"]
|
||||||
let allHtmlFiles = map (-<.> "html") allOrgFiles
|
let allHtmlFiles = map (-<.> "html") allOrgFiles
|
||||||
need (map build allHtmlFiles)
|
need (map build allHtmlFiles)
|
||||||
|
|
||||||
|
allPdfAction :: Action ()
|
||||||
|
allPdfAction = do
|
||||||
|
allOrgFiles <- getDirectoryFiles srcDir ["//*.org"]
|
||||||
|
let allHtmlFiles = map (-<.> "pdf") allOrgFiles
|
||||||
|
need (map build allHtmlFiles)
|
||||||
|
|
||||||
allAsciiAction :: Action ()
|
allAsciiAction :: Action ()
|
||||||
allAsciiAction = do
|
allAsciiAction = do
|
||||||
allOrgFiles <- getDirectoryFiles srcDir ["//*.org"]
|
allOrgFiles <- getDirectoryFiles srcDir ["//*.org"]
|
||||||
|
@ -341,6 +369,7 @@ needAll = do
|
||||||
need (map build $ allAssets <> ["archive.html"])
|
need (map build $ allAssets <> ["archive.html"])
|
||||||
allHtmlAction
|
allHtmlAction
|
||||||
allAsciiAction
|
allAsciiAction
|
||||||
|
allPdfAction
|
||||||
|
|
||||||
allRule :: Rules ()
|
allRule :: Rules ()
|
||||||
allRule = phony "all" needAll
|
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
|
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.
|
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.
|
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
|
could definitively change how you make decisions about different aspect
|
||||||
of Haskell programming.
|
of Haskell programming.
|
||||||
I believe the main groups of ideolgies are application developers, library
|
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.
|
before.
|
||||||
But I still think, the ability to learn new Haskell subject is infinite.
|
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
|
Someday I would like to write a post about my current team philosophy about
|
||||||
philosophy about programming.
|
programming.
|
||||||
Our main rule is to use as few features of a programming language as
|
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
|
This is a kind of merge between minimalism and pragmatism that in the end
|
||||||
provide a tremendous amount of benefits.
|
provide a tremendous amount of benefits.
|
||||||
This is why, even if I like to play with the latest Haskell trendy features,
|
This is why, even if I like to play with the latest Haskell trendy
|
||||||
I generally program without those.
|
features, I generally program without those.
|
||||||
With just a very few amount of Haskell features you will already be in
|
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
|
enviromnent with a *lot* of benefits as compared to many programming
|
||||||
languages.
|
languages.
|
||||||
|
|
||||||
So enough talk, here is my old article updated with a some changes and
|
So enough talk, here is my updated article.
|
||||||
cleanups.
|
I added a section about how to create a new project template with nix.
|
||||||
I also 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
|
I will try to write other articles about how to write a real program in
|
||||||
Haskell.
|
Haskell.
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
<a href="https://her.esy.fun">Yann Esposito's blog</a> -
|
<a href="https://her.esy.fun">Yann Esposito's blog</a> -
|
||||||
<a href="{{orgsource}}">source</a> -
|
<a href="{{orgsource}}">source</a> -
|
||||||
<a href="{{txtsource}}">txt</a> -
|
<a href="{{txtsource}}">txt</a> -
|
||||||
|
<a href="{{pdf}}">pdf</a> -
|
||||||
<a class="permalink" href="{{permalink}}">§permalink</a>
|
<a class="permalink" href="{{permalink}}">§permalink</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="abstract">
|
<div class="abstract">
|
||||||
|
|
Loading…
Reference in a new issue