
general program mode in calibre != python programs
"program:" is how you begin a template in general program mode. copy-paste the whole code box as given, for the template.
I don't think we need to format the number here... so here is a simpler one:
Code:
program:
divide(field('#words'),300)