Merge branch 'update-lts-19'

This commit is contained in:
Dimitri Lozeve 2022-03-23 19:07:10 +01:00
commit cbf9ee89b0
6 changed files with 28 additions and 70 deletions

View file

@ -85,3 +85,11 @@ pre:not(.sourceCode) code {
word-wrap: break-word;
overflow-wrap: break-word;
}
/* Bibliograpy entries */
.csl-entry {
font-size: 1.2rem;
padding-top: 0.4rem;
padding-bottom: 0.4rem;
width: 87.5%;
}

View file

@ -8,7 +8,6 @@ executable site
build-depends: base
, containers
, pandoc
, pandoc-citeproc
, pandoc-sidenote
, hakyll
ghc-options: -threaded

View file

@ -68,7 +68,7 @@ particular, it is one of the best presentations of dynamic programming
that I have ever read. The explanation of the simplex algorithm is
also excellent.)
[fn:wentzel] {-}
[fn:wentzel] {-}  
#+ATTR_HTML: :width 200px
[[file:/images/or_references/wentzel.jpg]]
@ -102,7 +102,7 @@ great resource to build a "mental map" of the field, avoiding getting
lost in the jungle of linear, stochastic, mixed integer, quadratic,
and other network problems.
[fn:williams] {-}
[fn:williams] {-}  
#+ATTR_HTML: :width 200px
[[file:/images/or_references/williams.jpg]]
@ -153,7 +153,7 @@ the list (because it is very recent) but is also excellent, with
examples in Julia covering nearly every kind of optimization
algorithms.
[fn:kochenderfer] {-}
[fn:kochenderfer] {-}  
#+ATTR_HTML: :width 200px
[[file:/images/or_references/kochenderfer.jpg]]
@ -212,7 +212,7 @@ packages. (Even if you don't know Julia, this is a great and easy way
to start!) If you'd rather use Python, you can use Google's [[https://developers.google.com/optimization/introduction/python][OR-Tools]]
or [[https://github.com/coin-or/pulp][PuLP]] for linear programming.
[fn:jump] {-}
[fn:jump] {-}  
#+ATTR_HTML: :width 250px :style background-color: #cccccc;
[[file:/images/or_references/jump.svg]]

34
site.hs
View file

@ -3,8 +3,6 @@
import qualified Data.Map as Map
import Data.Monoid (mappend)
import qualified Text.CSL as CSL
import Text.CSL.Pandoc (processCites)
import Text.Pandoc
import Text.Pandoc.Options
import Text.Pandoc.Highlighting
@ -136,35 +134,7 @@ postCtxWithTags tags = tagsField "tags" tags <> postCtx
feedCtx :: Context String
feedCtx = postCtx <> bodyField "description"
-- Add links to references ------------------------------------------
-- Source: https://github.com/jaspervdj/hakyll/issues/471#issuecomment-244540329
addLinkCitations (Pandoc meta a) =
let prevMap = unMeta meta
newMap = Map.insert "link-citations" (MetaBool True) prevMap
newMeta = Meta newMap
in Pandoc newMeta a
myReadPandocBiblio :: ReaderOptions
-> Item CSL
-> Item Biblio
-> (Item String)
-> Compiler (Item Pandoc)
myReadPandocBiblio ropt csl biblio item = do
-- Parse CSL file, if given
provider <- compilerProvider <$> compilerAsk
style <- unsafeCompiler $
CSL.readCSLFile Nothing . (resourceFilePath provider) . itemIdentifier $ csl
-- We need to know the citation keys, add then *before* actually parsing the
-- actual page. If we don't do this, pandoc won't even consider them
-- citations!
let Biblio refs = itemBody biblio
pandoc <- itemBody <$> readPandocWith ropt item
let pandoc' = processCites style refs (addLinkCitations pandoc)
return $ fmap (const pandoc') item
-- Pandoc compiler with maths, TOC, sidenots, and bibliography support --------------------
-- Pandoc compiler with maths, TOC, sidenotes, and bibliography support --------------------
customPandocCompiler :: Bool -> Compiler (Item String)
customPandocCompiler withTOC =
let customExtensions = extensionsFromList [Ext_latex_macros]
@ -191,7 +161,7 @@ customPandocCompiler withTOC =
csl <- load $ fromFilePath "csl/chicago-author-date.csl"
bib <- load $ fromFilePath "bib/bibliography.bib"
writePandocWith (if withTOC then writerOptionsWithTOC else writerOptions) <$>
(getResourceBody >>= myReadPandocBiblio readerOptions csl bib >>= traverse (return . usingSideNotes))
(getResourceBody >>= readPandocBiblio readerOptions csl bib >>= traverse (return . usingSideNotes))
type FeedRenderer = FeedConfiguration
-> Context String

View file

@ -17,7 +17,7 @@
#
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
resolver: lts-16.11
resolver: lts-19.0
# User packages to be built.
# Various formats can be used as shown in the example below.
@ -38,11 +38,9 @@ packages:
# using the same syntax as the packages field.
# (e.g., acme-missiles-0.3)
extra-deps:
- github: jez/pandoc-sidenote
commit: 7aacfa4b20a44562de48725dea812c5de2c5aeac
#- pandoc-sidenote-0.19.0.0@sha256:f5a5fdab1900da7b26ca673d14302b0a27b56024ca811babcacab79ba9614e90,1196
- monad-gen-0.3.0.1@sha256:a2569465cfbd468d3350ef25de56b3362580e77537224313aab1210f40804a3b,821
- hakyll-4.13.4.0@sha256:d97cb1b1cf7b901ce049e6e0aa5b1ac702cf52d2e475f5d3fe2de3694bb7dc7b,8867
- git: https://github.com/jez/pandoc-sidenote.git
commit: c9dfcadfcff475e6e26626af379b8b6d3f38d187
# - monad-gen-0.3.0.1@sha256:a2569465cfbd468d3350ef25de56b3362580e77537224313aab1210f40804a3b,821
# Override default flag values for local packages and extra-deps
# flags: {}

View file

@ -5,36 +5,19 @@
packages:
- completed:
size: 4871
url: https://github.com/jez/pandoc-sidenote/archive/7aacfa4b20a44562de48725dea812c5de2c5aeac.tar.gz
cabal-file:
size: 1578
sha256: 27753af099fd14469ec326713c5437ff8dcf9307c9711ab8d319a7ae9678a862
name: pandoc-sidenote
version: 0.20.0.0
sha256: 280c0ef67602128f0e8f9f184868f14a71c3938bebf8644c55e6988413db7e9f
version: 0.22.2.0
git: https://github.com/jez/pandoc-sidenote.git
pantry-tree:
size: 575
sha256: ace183ff53f1fe2987fc3ae77f38fa8c5ee1e656fe3bed0941691150bc1771ab
sha256: 45a4f6017904d000a25f0ddcd7a1b92c3ef9926dfb4b35630878908e10cf62fa
commit: c9dfcadfcff475e6e26626af379b8b6d3f38d187
original:
url: https://github.com/jez/pandoc-sidenote/archive/7aacfa4b20a44562de48725dea812c5de2c5aeac.tar.gz
- completed:
hackage: monad-gen-0.3.0.1@sha256:a2569465cfbd468d3350ef25de56b3362580e77537224313aab1210f40804a3b,821
pantry-tree:
size: 288
sha256: a825dc8dcc3ee27dbbc1b71f6853703790ed320249b8f8510bb36d726664e795
original:
hackage: monad-gen-0.3.0.1@sha256:a2569465cfbd468d3350ef25de56b3362580e77537224313aab1210f40804a3b,821
- completed:
hackage: hakyll-4.13.4.0@sha256:d97cb1b1cf7b901ce049e6e0aa5b1ac702cf52d2e475f5d3fe2de3694bb7dc7b,8867
pantry-tree:
size: 7841
sha256: e31b612480429149bd2c042dd49cdb1a5eb9c807d4acce4a971a6da3d6f5db81
original:
hackage: hakyll-4.13.4.0@sha256:d97cb1b1cf7b901ce049e6e0aa5b1ac702cf52d2e475f5d3fe2de3694bb7dc7b,8867
git: https://github.com/jez/pandoc-sidenote.git
commit: c9dfcadfcff475e6e26626af379b8b6d3f38d187
snapshots:
- completed:
size: 532381
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/16/11.yaml
sha256: 1f43c4ad661a114a4f9dd4580988f30da1208d844c097714f5867c52a02e0aa1
original: lts-16.11
size: 616897
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/0.yaml
sha256: bbf2be02f17940bac1f87cb462d4fb0c3355de6dcfc53d84f4f9ad3ee2164f65
original: lts-19.0