Coder Social home page Coder Social logo

engender's Introduction

Engender is a simple template engine.
It knows several simple scripts to build a template.

The language of Engender should be inside "<%" and "%>".

Engender supports if and foreach, can print data, and math operations.

Engender is used by the class Engender with method engender. Engender methods
create a temporary file to produce template output. Each variable for template
should be map of string keys and object values.

Engender does not support local variable definition.

Examples:

print a variable: <% print $key1.key2 %> 
here key1 is the first key in map, value of key1 is also a map hence the printed
value is the value of key2 from the map key1 returns.

if statement: if( (<boolean expr>) ) { <commands> }
boolean expr is in format: expression op expression
expression is one of math expr, variable or constant. op is one of == != < > <= >=
commands are the squence of the language itself. boolean expr can be combined 
with and or keywords and reversed with ! operator.

math expr is the format variable op number. here op is + - * /

constant can be number, string or quoted string

foreach: foreach( $item : $items ) {  <commands> }
commands are same as in if statement
$item is local variable for loop, $items is variable from map (supports print
variable). foreach has two temporary variable ~index and ~count

engender's People

Contributors

kazimsarikaya 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.