From 935c09acd6617344fc14da594d4f6b9d33235bfb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= <guillaume.perreal@irstea.fr>
Date: Tue, 3 Mar 2020 17:11:23 +0100
Subject: [PATCH] =?UTF-8?q?Ajoute=20la=20possibilit=C3=A9=20de=20configure?=
 =?UTF-8?q?r=20Pandoc=20par=20pr=C3=A9sentation.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Gruntfile.js | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/Gruntfile.js b/Gruntfile.js
index 38a8c88..d1cf802 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -58,6 +58,8 @@ module.exports = grunt => {
       build: {
         cmd: (pres, env) =>
           [
+            env === "dev" && "set -x ; ",
+            `[ -s '../src/${pres}.conf' ] && . ../src/${pres}.conf ;`,
             "pandoc",
             "--verbose",
             "--from=markdown+smart",
@@ -66,14 +68,15 @@ module.exports = grunt => {
             `--output=./${pres}${env !== "prod" ? "-" + env : ""}.html`,
             "--standalone",
             "--toc",
-            `--toc-depth=${TOC_DEPTH}`,
-            `--slide-level=${SLIDE_LEVEL}`,
+            "--toc-depth=$TOC_DEPTH",
+            "--slide-level=$SLIDE_LEVEL",
             "--variable=lang:fr-FR",
             `--variable=revealjs-url:${relative(dirname(pres), "./reveal.js")}`,
             "--variable=theme:irstea",
             "--variable=history:true",
             "--variable=navigationMode:linear",
             "--variable=fragmentInURL:true",
+            "$PANDOC_ARGS",
             env === "dev" &&
               `--variable=header-includes:"<script src='//${PUBLIC_HOST}:${LIVERELOAD_PORT}/livereload.js'></script>"`
           ]
@@ -81,7 +84,14 @@ module.exports = grunt => {
             .join(" "),
         cwd: "dist",
         stdout: true,
-        stderr: true
+        stderr: true,
+        options: {
+          env: {
+            TOC_DEPTH: "" + TOC_DEPTH,
+            SLIDE_LEVEL: "" + SLIDE_LEVEL,
+            PANDOC_ARGS: ""
+          }
+        }
       }
     },
 
@@ -132,8 +142,13 @@ module.exports = grunt => {
   grunt.registerTask("build:pres", function(env) {
     const done = this.async();
     readdirp
-      .promise("src/", { fileFilter: "*.md" })
-      .then(entries => enqueueBuilds(entries.map(entry => entry.path), env))
+      .promise("src/.", { fileFilter: "*.md" })
+      .then(entries =>
+        enqueueBuilds(
+          entries.map(entry => entry.path),
+          env
+        )
+      )
       .then(done, err => {
         grunt.log.error(err);
         done(false);
-- 
GitLab