Code Monkey home page Code Monkey logo

breve's Introduction

Brevé is a Python template engine that is designed to be clean and elegant with minimal syntax. Brevé was heavily inspired by Nevow Stan.

Like Stan (and unlike most Python template engines), Brevé is neither an XML parser nor PSP-style regex engine. Rather, Brevé templates are actual Python expressions. In popular parlance, Brevé is an internal DSL.

Unlike Stan, Brevé doesn't depend on Twisted or Nevow (it's a ground-up rewrite and has no external dependencies outside the Python Standard Library). Also Brevé is a full template engine, supporting concepts not found in Stan such as template inheritance, include files and simple conditionals. Brevé also drops support for a few Stan concepts that aren't strictly needed (e.g. patterns).

Brevé is relatively small, being around 300 lines of code for the engine proper, and around another 700 lines of code for the HTML entity and tag definitions.

Brevé supports the Buffet template engine API which means it works automatically with several frameworks, including Pylons, CherryPy and TurboGears. Brevé can also be used with Django, Tornado, or even standalone outside a framework.

A short example:

html [
    head [
        title [ 'A Brevé Template' ]
    ],

    body [
        h1 [ 'Briefly, Brevé' ], br,
        div ( style = 'text-align: center;' ) [
            span [ '''
                As you can see, Brevé maps very
                directly to the final HTML output.
            ''' ]
        ]
    ]
]

breve's People

Contributors

benoitzugmeyer avatar svenberkvens avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.