| 13 | CLEANUP = [] |
| 14 | |
| 15 | def preBuild(site): |
| 16 | for path in fileList(site.paths['pages']): |
| 17 | |
| 18 | #only file ends with haml |
| 19 | if not path.endswith('.haml'): |
| 20 | continue |
| 21 | |
| 22 | #read the lines |
| 23 | haml_lines = codecs.open(path, 'r', encoding='utf-8').read().splitlines() |
| 24 | |
| 25 | #compile haml to html |
| 26 | compiler = Compiler() |
| 27 | output = compiler.process_lines(haml_lines) |
| 28 | |
| 29 | #replace path |
| 30 | outPath = path.replace('.haml', '.html') |
| 31 | |
| 32 | #write the html file |
| 33 | with open(outPath,'w') as f: |
| 34 | f.write(output) |
| 35 | |
| 36 | CLEANUP.append(outPath) |
| 37 | |
| 38 | |
| 39 | def postBuild(site): |