diff --git a/slides/appendcheck.py b/slides/appendcheck.py new file mode 100755 index 00000000..ebbb4807 --- /dev/null +++ b/slides/appendcheck.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +import logging +import os +import subprocess +import sys + +logging.basicConfig(level=os.environ.get("LOG_LEVEL", "INFO")) + +filename = sys.argv[1] + +logging.info("Checking file {}...".format(filename)) +text = subprocess.check_output(["./slidechecker.js", filename]) +html = open(filename).read() +html = html.replace("", "\n---\n```\n{}\n```\n".format(text)) + +open(filename, "w").write(html) diff --git a/slides/build.sh b/slides/build.sh index f6133b6d..de646a8d 100755 --- a/slides/build.sh +++ b/slides/build.sh @@ -7,6 +7,9 @@ once) break } done + [ -n "$SLIDECHECKER" ] && for YAML in *.yml; do + ./appendcheck.py $YAML.html + done ;; forever) diff --git a/slides/slidechecker.js b/slides/slidechecker.js index 4aa936c5..4a4d4d90 100755 --- a/slides/slidechecker.js +++ b/slides/slidechecker.js @@ -10,12 +10,12 @@ page.onResourceError = function(resourceError) { } page.onConsoleMessage = function(msg) { - /*console.log('Console: ' +msg);*/ + //console.log('Console: ' +msg); } -console.log('Loading: ' + url); +console.log('DEBUG Loading: ' + url); page.open(url, function(status) { - console.log('Loaded: ' + url + '(' + status + ')'); + console.log('DEBUG Loaded: ' + url + '(' + status + ')'); /* analyze will be an object with: * @@ -34,7 +34,7 @@ page.open(url, function(status) { var ret = {}, i, n = slideshow.getSlideCount(); ret = []; for (i=1; i<=n; i++) { - console.log('Current slide: ' + i + '/' + n); + console.log('DEBUG Current slide: ' + i + '/' + n); var visible_slide = document.getElementsByClassName('remark-visible')[0]; var debug = visible_slide.getElementsByClassName('debug'); if (debug.length==0) { @@ -46,7 +46,7 @@ page.open(url, function(status) { var slide_desc = 'Slide ' + i + '/' + n + ' (' + debug + ')'; ['h1', 'h2'].forEach(function(tag) { var titles = visible_slide.getElementsByTagName(tag); - console.log('Found ' + titles.length + ' titles with tag ' + tag); + console.log('DEBUG Found ' + titles.length + ' titles with tag ' + tag); titles.forEach(function(t) { if (t.clientHeight>60) { ret.push(slide_desc + ' has a long title: ' + t.textContent); @@ -66,6 +66,6 @@ page.open(url, function(status) { analyze.forEach(function(msg) { console.log(msg); }); - console.log('Done: ' + url + '(' + status + ')'); + console.log('DEBUG Done: ' + url + '(' + status + ')'); phantom.exit(); });