Add script to check images and show slide count

This commit is contained in:
Jérôme Petazzoni
2017-11-04 11:45:18 -07:00
parent 5a58b17bb5
commit 241452bab4
2 changed files with 30 additions and 0 deletions

View File

@@ -45,3 +45,12 @@ and publish them to http://container.training/.
Pull requests are automatically deployed to testing
subdomains. I had no idea that I would ever say this
about a static page hosting service, but it is seriously awesome. ⚡️💥
## Extra bells and whistles
You can run `./slidechecker foo.yml.html` to check for
missing images and show the number of slides in that deck.
It requires `phantomjs` to be installed. It takes some
time to run so it is not yet integrated with the publishing
pipeline.

21
slides/slidechecker.js Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env phantomjs
var system = require('system');
var filename = system.args[1];
var url = 'file://' + system.env.PWD + '/' + filename;
var page = require('webpage').create();
page.onResourceError = function(resourceError) {
console.log('ResourceError: ' + resourceError.url);
}
console.log('Loading: ' + url);
page.open(url, function(status) {
console.log('Loaded: ' + url + '(' + status + ')');
var slides = page.evaluate(function() {
return document.getElementsByClassName('remark-slide-container');
});
console.log('Number of slides: ' + slides.length);
console.log('Done: ' + url + '(' + status + ')');
phantom.exit();
});