From 6f2727afa8a8741618370d7e52a8e24bae18c11b Mon Sep 17 00:00:00 2001
From: Orestis <orestis.malaspinas@pm.me>
Date: Sat, 19 Feb 2022 22:33:54 +0100
Subject: [PATCH] hopefully this works now

---
 hakyll-bootstrap/Main.hs                      | 35 +++++++++++------
 hakyll-bootstrap/Makefile                     |  2 +
 hakyll-bootstrap/templates/static_course.html | 38 +++++++++++++++++++
 3 files changed, 64 insertions(+), 11 deletions(-)
 create mode 100644 hakyll-bootstrap/templates/static_course.html

diff --git a/hakyll-bootstrap/Main.hs b/hakyll-bootstrap/Main.hs
index 5c249b8..65b91ad 100644
--- a/hakyll-bootstrap/Main.hs
+++ b/hakyll-bootstrap/Main.hs
@@ -56,6 +56,7 @@ main = hakyllWith config $ do
         .||. "cours/prog_seq/slides/figs/*"
         -- .||. "cours/algo/slides/figs/*"
         .||. "cours/math_tech_info/figs/*"
+        -- .||. "cours/algo/slides/*.json"
         .||. "cours/algo/slides/*.pdf"
         .||. "cours/math_tech_info/cours.pdf"
         .||. "cours/isc_physics/cours.pdf"
@@ -128,20 +129,26 @@ main = hakyllWith config $ do
                 >>= relativizeUrls
 
 
-    -- -- Algorithmique slides
+    -- Algorithmique slides
     -- match "cours/algo/slides/*.markdown" $ do
     --     route $ setExtension "html"
     --     compile $ pandocRevealCompiler
     --         >>= loadAndApplyTemplate "templates/reveal.html" postCtx
     --         >>= relativizeUrls
 
+    match "cours/algo/slides/index.md" $ do
+        route $ setExtension "html"
+        compile $ pandocCompiler
+            >>= loadAndApplyTemplate "templates/post.html" postCtx
+            >>= relativizeUrls   
+
     -- Prog seq post list
     create ["cours/algo.html"] $ do
         route idRoute
         compile $ do
             posts <- recentFirst =<< loadAll "cours/algo/slides/index.md"
             makeItem ""
-                >>= loadAndApplyTemplate "templates/archive.html" (pagesCtx posts "Algorithmique et structure de données")
+                >>= loadAndApplyTemplate "templates/archive.html" (courseCtx posts "Les slides d'Algorithmique en PDF" "algo/slides/index.html")
                 >>= relativizeUrls
 
     -- Team description
@@ -219,6 +226,7 @@ main = hakyllWith config $ do
     where
         staticPages =
             [ "pages/contact.md"
+            -- , "cours/algo/slides/index.md"
             ]
 
     -- Used to compile to PDF
@@ -247,6 +255,11 @@ mathCtx = field "mathjax" $ \item -> do
            then "<script type=\"text/javascript\" src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML\"></script>"
            else ""
 
+noPostCtx title pdfurl =
+  constField "title" title
+  `mappend` constField "pdfurl" pdfurl
+  `mappend` defaultContext
+
 courseCtx posts title pdfurl =
   listField "posts" postCtx (return posts)
   `mappend` constField "title" title
@@ -358,17 +371,17 @@ config :: Configuration
 config = defaultConfiguration
     {
           deploySite = deploy
---        , ignoreFile = ignoreFile'
+        -- , ignoreFile = ignoreFile'
     }
   where
-    -- ignoreFile' path
-    --     | "."    `isPrefixOf` fileName = False
-    --     | "#"    `isPrefixOf` fileName = True
-    --     | "~"    `isSuffixOf` fileName = True
-    --     | ".swp" `isSuffixOf` fileName = True
-    --     | otherwise                    = False
-    --   where
-    --     fileName = takeFileName path
+  --   ignoreFile' path
+  --       | "."    `isPrefixOf` fileName = False
+  --       | "#"    `isPrefixOf` fileName = True
+  --       | "~"    `isSuffixOf` fileName = True
+  --       | ".swp" `isSuffixOf` fileName = True
+  --       | otherwise                    = False
+  --     where
+  --       fileName = takeFileName path
     deploy :: Configuration -> IO ExitCode
     deploy _c = do
         Process.rawSystem "rsync"
diff --git a/hakyll-bootstrap/Makefile b/hakyll-bootstrap/Makefile
index b5f318d..a94b139 100644
--- a/hakyll-bootstrap/Makefile
+++ b/hakyll-bootstrap/Makefile
@@ -11,6 +11,8 @@ build: update Main.hs cours/math_tech_info/*.md cours/isc_physics/*.md
 	make -C cours/isc_physics
 	make markdown -C cours/prog_seq/slides
 	# make markdown -C cours/algo/slides
+	make puppeteer -C cours/algo/slides
+	make -C cours/algo/slides
 	make index -C cours/algo/slides
 	stack build --allow-different-user && stack exec --allow-different-user blog -- build
 	# cabal install && blog build
diff --git a/hakyll-bootstrap/templates/static_course.html b/hakyll-bootstrap/templates/static_course.html
new file mode 100644
index 0000000..89f31e8
--- /dev/null
+++ b/hakyll-bootstrap/templates/static_course.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="description" content="">
+    <meta name="author" content="">
+    <title>$title$</title>
+    <link href="/css/bootstrap.css" rel="stylesheet">
+    <link href="/css/syntax.css" rel="stylesheet">
+    <link href="/css/carousel.css" rel="stylesheet">
+    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
+    <style>
+        body { 
+            font-family: 'Open Sans', sans-serif;
+        }
+        body { margin-top: 80px; }
+        footer { margin-top: 80px; }
+    </style>
+  </head>
+  <body>
+    $partial("templates/nav.html")$
+
+    <div class="container">
+      <h1>$title$</h1>
+      $if(pdfurl)$
+      <h3><a href="$pdfurl$">Le polycopié en entier [pdf]</a></h3>
+      $endif$
+      <h2>Les chapitres</h2>
+      $partial("templates/footer.html")$
+    </div>
+
+    </div><!-- /.container -->
+    <script src="/js/jquery.js"></script>
+    <script src="/js/bootstrap.js"></script>
+    <script src="/js/holder.js"></script>
+  </body>
+</html>
-- 
GitLab