def preprocess(self, source, name, filename=None):
        if not name or os.path.splitext(name)[1] not in self.HAML_EXTENSIONS:
            return source

        compiler = Compiler()
        try:
            return compiler.process(source)
        except Exception, e:
            raise TemplateSyntaxError(e, None, name=name, filename=filename)
 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)
Beispiel #3
0
    def preprocess(self, source, name, filename=None):
        if not name or os.path.splitext(name)[1] not in self.HAML_EXTENSIONS:
            return source

        compiler = Compiler()
        try:
            return compiler.process(source)
        except Exception, e:
            raise TemplateSyntaxError(e, None, name=name, filename=filename)
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)
Beispiel #5
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)
Beispiel #6
0
def hamlpy (t):
    #from hamlpy.hamlpy import Compiler
    return Compiler().process(t)