From 02364e70ae2b62022eb23c1fb47305999138053d Mon Sep 17 00:00:00 2001 From: Robin Bedemann Date: Sun, 20 Jan 2019 13:50:19 +0100 Subject: [PATCH 1/2] make rendering of substeps as separate page optional --- decktape.js | 19 ++++++++++++++++++- plugins/impress.js | 10 ++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/decktape.js b/decktape.js index 0c77a18..5faeda4 100755 --- a/decktape.js +++ b/decktape.js @@ -51,6 +51,13 @@ parser.script('decktape').options({ default : 0, help : 'Duration in milliseconds between the page has loaded and starting to export slides', }, + enableSubsteps: { + abbr: 'substeps', + metavar: '', + type: 'boolean', + help: 'If substeps should be used as separate slides', + default: true + }, screenshots : { default : false, flag : true, @@ -299,8 +306,18 @@ async function exportSlides(plugin, page, printer) { exportedSlides : 0, pdfFonts : {}, pdfXObjects : {}, - totalSlides : await plugin.slideCount(), + totalSlides : await plugin.slideCount(options.enableSubsteps), }; + + if(options.enableSubsteps===false){ + page.$$eval('.substep', substeps => { + substeps.forEach(substep=>{ + substep.classList.remove('substep'); + substep.classList.add('substep-visible'); + }); + }) + } + // TODO: support a more advanced "fragment to pause" mapping // for special use cases like GIF animations // TODO: support plugin optional promise to wait until a particular mutation diff --git a/plugins/impress.js b/plugins/impress.js index 9fac704..d89d612 100644 --- a/plugins/impress.js +++ b/plugins/impress.js @@ -22,9 +22,15 @@ class Impress { }); } - slideCount() { + slideCount(enableSubsteps) { + if(enableSubsteps){ + return this.page.evaluate(_ => + document.querySelectorAll('#impress .step, #impress .substep').length); + } return this.page.evaluate(_ => - document.querySelectorAll('#impress .step, #impress .substep').length); + document.querySelectorAll('#impress .step').length); + + } nextSlide() { From d7f82d39fa1f496798e2627425e6f16527c78794 Mon Sep 17 00:00:00 2001 From: Robin Bedemann Date: Sun, 20 Jan 2019 15:06:13 +0100 Subject: [PATCH 2/2] change scale to fit page better --- decktape.js | 1 + 1 file changed, 1 insertion(+) diff --git a/decktape.js b/decktape.js index 5faeda4..400249e 100755 --- a/decktape.js +++ b/decktape.js @@ -365,6 +365,7 @@ async function exportSlide(plugin, page, printer, context) { printBackground : true, pageRanges : '1', displayHeaderFooter : false, + scale: 1.5 }); printSlide(printer, new BufferReader(buffer), context); context.exportedSlides++;