Commit 95709e58 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Utilise directement les sources de pole-is/tools/reveal.js (branche gulp).

parent 305b028b
...@@ -3,9 +3,12 @@ import del from "del"; ...@@ -3,9 +3,12 @@ import del from "del";
import drawio from "./lib/drawio"; import drawio from "./lib/drawio";
import index from "./lib/index"; import index from "./lib/index";
import pandoc from "./lib/pandoc"; import pandoc from "./lib/pandoc";
import path from "path";
import revealjs from "@irstea/reveal.js/gulpfile.esm";
import server from "gulp-server-livereload"; import server from "gulp-server-livereload";
import wkhtmltopdf from "./lib/wkhtmltopdf"; import wkhtmltopdf from "./lib/wkhtmltopdf";
const REVEALJS_URL = process.env.REVEALJS_URL || "reveal.js";
const SRC_DIR = process.env.SRC || "src"; const SRC_DIR = process.env.SRC || "src";
const DEST_DIR = process.env.OUTPUT || "public"; const DEST_DIR = process.env.OUTPUT || "public";
...@@ -21,18 +24,33 @@ export const clean = () => del(`${DEST_DIR}/**`, { force: true }); ...@@ -21,18 +24,33 @@ export const clean = () => del(`${DEST_DIR}/**`, { force: true });
export const assets = () => export const assets = () =>
src(ASSET_GLOB, { since: lastRun(assets) }).pipe(dest(DEST_DIR)); src(ASSET_GLOB, { since: lastRun(assets) }).pipe(dest(DEST_DIR));
export const prez = () => export const prez = () =>
src(PREZ_GLOB, { since: lastRun(prez) }) src(PREZ_GLOB, { since: lastRun(prez) })
.pipe(index()) .pipe(index())
.pipe(pandoc()) .pipe(pandoc({ variables: { "revealjs-url": REVEALJS_URL } }))
.pipe(dest(DEST_DIR)); .pipe(dest(DEST_DIR));
export const graphs = () => export const graphs = () =>
src(GRAPH_GLOB, { since: lastRun(graphs) }) src(GRAPH_GLOB, { since: lastRun(graphs) })
.pipe(drawio()) .pipe(drawio())
.pipe(dest(DEST_DIR)); .pipe(dest(DEST_DIR));
export const pdf = () => src(PDF_GLOB).pipe(wkhtmltopdf()).pipe(dest(DEST_DIR)); export const pdf = () => src(PDF_GLOB).pipe(wkhtmltopdf()).pipe(dest(DEST_DIR));
export const build = series(clean, parallel(assets, prez, graphs), pdf); export const library = !REVEALJS_URL.startsWith("http")
? series(revealjs, () =>
src(__dirname + "/node_modules/@irstea/reveal.js/public/**").pipe(
dest(path.join(DEST_DIR, REVEALJS_URL))
)
)
: () => false;
export const build = series(
clean,
parallel(library, assets, prez, graphs),
pdf
);
const serve = () => { const serve = () => {
src(DEST_DIR).pipe( src(DEST_DIR).pipe(
......
import gulpPandoc from "gulp-pandoc"; import gulpPandoc from "gulp-pandoc";
import { merge } from "merge-anything";
const REVEALJS_URL = const DEFAULTS = {
process.env.REVEALJS_URL || slideLevel: 2,
"https://pole-is.gitlab.irstea.page/tools/reveal.js"; tocDepth: 2,
variables: {
"revealjs-url": "reveal.js",
width: 1024,
height: 768,
navigationMode: "linear",
theme: "inrae",
slideNumber: true,
history: true,
fragmentInURL: true,
},
};
export default function pandoc() { export default function pandoc(options = {}) {
const { slideLevel, tocDepth, variables } = merge({}, DEFAULTS, options);
return gulpPandoc({ return gulpPandoc({
from: from:
"markdown+backtick_code_blocks+pandoc_title_block+yaml_metadata_block", "markdown+backtick_code_blocks+pandoc_title_block+yaml_metadata_block",
...@@ -12,17 +25,12 @@ export default function pandoc() { ...@@ -12,17 +25,12 @@ export default function pandoc() {
ext: ".html", ext: ".html",
args: [ args: [
"--standalone", "--standalone",
"--slide-level=2", `--slide-level=${slideLevel}`,
"--toc", "--toc",
"--toc-depth=2", `--toc-depth=${tocDepth}`,
`--variable=revealjs-url:${REVEALJS_URL}`, ...Object.getOwnPropertyNames(variables).map(
"--variable=width:1024", (name) => `--variable=${name}:${variables[name]}`
"--variable=height:768", ),
"--variable=history:true",
"--variable=navigationMode:linear",
"--variable=fragmentInURL:true",
"--variable=theme:inrae",
"--variable=slideNumber:true",
], ],
}); });
} }
This diff is collapsed.
...@@ -18,12 +18,14 @@ ...@@ -18,12 +18,14 @@
"node": ">=12 <14" "node": ">=12 <14"
}, },
"dependencies": { "dependencies": {
"@irstea/reveal.js": "git+https://gitlab.irstea.fr/pole-is/tools/reveal.js.git#gulp",
"del": "^5.1.0", "del": "^5.1.0",
"esm": "^3.2.25", "esm": "^3.2.25",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-pandoc": "^0.2.2", "gulp-pandoc": "^0.2.2",
"gulp-server-livereload": "^1.9.2", "gulp-server-livereload": "^1.9.2",
"gulplog": "^1.0.0", "gulplog": "^1.0.0",
"merge-anything": "^3.0.3",
"plugin-error": "^1.0.1", "plugin-error": "^1.0.1",
"through2": "^3.0.1", "through2": "^3.0.1",
"vinyl": "^2.2.0", "vinyl": "^2.2.0",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment