Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.12 KB

README.md

File metadata and controls

52 lines (38 loc) · 1.12 KB

IndentLang

A templating language mainly to output balised language (html, xml, etc.).

usage

Start by importing the template package :

import "github.com/dvaumoron/indentlang/template"

And use it in two step:

// parse a template
tmpl, err := template.ParsePath(tmplPath)
// and use it
err = tmpl.Execute(writer, data)

With the input (indentation matters):

html
    head
        meta @charset="utf-8"
        title "Hello World"
    body
        h1 @class="greetings" "Hello World"

The output will look like (cleaned):

<html>
    <head>
        <meta charset="utf-8"/>
        <title>Hello World</title>
    </head>
    <body>
        <h1 class="greetings">Hello World</h1>
    </body>
</html>

The file indentlang.go is an adapted copy of engine.go for demo and testing purpose (see examples).

More examples can be found here.

See API Documentation.