def run(self, *args, **kwargs):
     for haml in self.files():
         haml_lines = codecs.open(haml, 'r', encoding='utf-8').read().splitlines()
         compiler = Compiler()
         output = compiler.process_lines(haml_lines)
         html = haml.replace('.haml', '.html')
         logging.info("[HAML] Compiling {0} -> {1}...".format(haml, html))
         with open(html, 'w') as f:
             f.write(output)
Example #2
0
def preBuild(site):
    for path in fileList(site.paths['pages']):

        #only file ends with haml
        if not path.endswith('.haml'):
            continue

        #read the lines
        haml_lines = codecs.open(path, 'r', encoding='utf-8').read().splitlines()

        #compile haml to html
        compiler = Compiler()
        output = compiler.process_lines(haml_lines)

        #replace path
        outPath = path.replace('.haml', '.html')

        #write the html file
        with open(outPath,'w') as f:
            f.write(output)

        CLEANUP.append(outPath)
Example #3
0
def preBuild(site):
    for path in fileList(site.paths['pages']):

        #only file ends with haml
        if not path.endswith('.haml'):
            continue

        #read the lines
        haml_lines = codecs.open(path, 'r',
                                 encoding='utf-8').read().splitlines()

        #compile haml to html
        compiler = Compiler()
        output = compiler.process_lines(haml_lines)

        #replace path
        outPath = path.replace('.haml', '.html')

        #write the html file
        with open(outPath, 'w') as f:
            f.write(output)

        CLEANUP.append(outPath)