Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make rendering of substeps as separate page optional #174

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 18 additions & 1 deletion decktape.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would basically cover #24. I wonder what could be the best terminology across all the HTML presentation frameworks. Reveal calls it fragments, other refer to incremental display of slide content...

abbr: 'substeps',
metavar: '<true|false>',
type: 'boolean',
help: 'If substeps should be used as separate slides',
default: true
},
screenshots : {
default : false,
flag : true,
Expand Down Expand Up @@ -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){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is specific to Impress so that should better be added to the configure method of the Impress plugin.

The options object can be passed to the Impress plugin constructor.

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
Expand Down
10 changes: 8 additions & 2 deletions plugins/impress.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ class Impress {
});
}

slideCount() {
slideCount(enableSubsteps) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be preferable to have the options object passed to the Impress plugin constructor and remove the extra argument.

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() {
Expand Down