Skip to content

Instantly share code, notes, and snippets.

@syrusakbary
Created August 6, 2012 21:22
Show Gist options
  • Save syrusakbary/3278536 to your computer and use it in GitHub Desktop.
Save syrusakbary/3278536 to your computer and use it in GitHub Desktop.
Compilador de pyjade sin utilizar ningún motor de templates (Django, Jinja2 o Mako)
from pyjade.ext.html import HTMLCompiler
from pyjade.utils import process
plantilla = "h1= titulo"
contexto = {"titulo": "Titulo principal"}
def compilar(plantilla, contexto):
compiler = HTMLCompiler
compiler.global_context = contexto
return process(plantilla,compiler=compiler)
texto_html = compilar(plantilla, contexto)
print texto_html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment