RaspberryPiFoundation / lesson_format

Lesson formatter
17 stars 28 forks source link

[#17] Improve automatic PDF generation #42

Closed andylolz closed 9 years ago

andylolz commented 9 years ago

This is incomplete, but it’s a big step forward.

You can see the output (for all languages) here: http://codeclub.treadsoft.ly

Both wkhtmltopdf and phantom.js should work. You can test pdf generation with commands of the following form:

python build.py --pdf wkhtmltopdf uk lessons/scratch output/codeclubuk

(For usage instructions, type: python build.py -h)

andylolz commented 9 years ago

Refs #17.

andylolz commented 9 years ago

Note that this PR:

However, it does add some extra (hidden) html to each page (this). This could be injected via javascript instead, but then any future effort to translate the text inside might be tricky.

rikcross commented 9 years ago

These look awesome! The only problem I can see is that all of the steps are labelled as step 1. Is that because of the way I've used ordered lists in the markdown, rather than a problem with the PDF generation? It's difficult to know, as they are displayed as checkboxes in the HTML.

andylolz commented 9 years ago

Ahh! Good spot – I hadn’t noticed all those 1s!

The explanation is here: http://johnmacfarlane.net/pandoc/README.html#the-four-space-rule

Run-on paragraphs need to be indented with 4 spaces. I’ve updated that lesson accordingly, and have made a PR here: CodeClub/python-curriculum#37

The PDF output is here, and includes numbers other than 1!

andylolz commented 9 years ago

@gahjelle ping! Have you taken a look at this? Could be of interest. Example Norwegian auto-generated pdfs here: http://codeclub.treadsoft.ly/nb-NO/index.html

Jonic commented 9 years ago

I think Rik's going to want to give this a good test with the Python curriculum he's been working on. Is it currently only set up to generate a PDF for Scratch projects?

andylolz commented 9 years ago

Nope – it generates everything. There’s some python project output here: http://codeclub.treadsoft.ly/en-GB/04_python/index.html

Rik commented ^^^ just up there about the first python project.

rikcross commented 9 years ago

Yeah, I've amended the markdown to sort out the numbering of steps, so now I'm pretty happy with the output. :)

andylolz commented 9 years ago

Nice one Rik :+1:

andylolz commented 9 years ago

My mouse is literally poised over this button right now:

screen shot 2014-09-18 at 17 18 15

Jonic commented 9 years ago

Woooooo! Amazing work, man. MUCH appreciated :)