def compile_file(fullpath, outfile_name): """Calls HamlPy compiler.""" if DEBUG: print "Compiling %s -> %s" % (fullpath, outfile_name) haml_lines = codecs.open(fullpath, 'r', encoding='utf-8').read().splitlines() compiler = Compiler() output = compiler.process_lines(haml_lines) outfile = codecs.open(outfile_name, 'w', encoding='utf-8') outfile.write(output)
def compile_file(fullpath, outfile_name): """Calls HamlPy compiler.""" if DEBUG: print "Compiling %s -> %s" % (fullpath, outfile_name) haml_lines = codecs.open(fullpath, 'r', encoding='utf-8').read().splitlines() template_type = sys.argv[2] if len(sys.argv) == 3 else 'django' compiler = Compiler(template_type) output = compiler.process_lines(haml_lines) outfile = codecs.open(outfile_name, 'w', encoding='utf-8') outfile.write(output)
def compile_file(fullpath, outfile_name): """Calls HamlPy compiler.""" try: if DEBUG: print "Compiling %s -> %s" % (fullpath, outfile_name) haml_lines = codecs.open(fullpath, 'r', encoding='utf-8').read().splitlines() compiler = Compiler() output = compiler.process_lines(haml_lines) outfile = codecs.open(outfile_name, 'w', encoding='utf-8') outfile.write(output) except Exception, e: # import traceback print "Failed to compile %s -> %s\nReason:\n%s" % (fullpath, outfile_name, e)
def compile_file(fullpath, outfile_name): """Calls HamlPy compiler.""" print '%s %s -> %s' % (strftime("%H:%M:%S", gmtime()), fullpath, outfile_name) try: if DEBUG: print "Compiling %s -> %s" % (fullpath, outfile_name) haml_lines = codecs.open(fullpath, 'r', encoding='utf-8').read().splitlines() compiler = Compiler() output = compiler.process_lines(haml_lines) outfile = codecs.open(outfile_name, 'w', encoding='utf-8') outfile.write(output) except Exception, e: # import traceback print "Failed to compile %s -> %s\nReason:\n%s" % (fullpath, outfile_name, e)