Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


What is it?

You can find out more about HAML at
You can find out more about GO at

I’ve tried to remain diligent about reproducing the output from the canonical Ruby-based parser, so if you feel familiar with the one, then you should feel familiar with the other.

This branch compiles with 6g/8g “go version go1.0.3.”

Is it done?

I think so. It has…

  • Tags with
    • empty content;
    • attributes of the form {:attr => "value"};
    • id moniker using “#” (#divId); and,
    • class moniker using “.” (.divClass).
  • Tag nesting
  • Scope lookup
    • Arbitrary number of keys as specified by struct (someKeyInScope.Subkey1.Subkey2)
    • Valid as tag content (%p= someKeyInScope)
    • Valid as tag attribute value (%p{:attr => someKeyInScope})
    • Valid as tag attribute name (%p{someKeyInScope => "value"})
  • Engine-level autoclose option (<br /> vs. <br>)
  • Tag-specific close option (%br/ becomes <br /> regardless of autoclose setting)
  • Whitespace removal with the < operator
  • Simple scripting
    • Declaration and assignment of strings, floats, and ints (- varname := “value”)
    • Range looping construct (- for i, v := range scopeVar)
  • Error messages for badly-formed templates

If you would like another feature added, just log an issue and I’ll review it forthright.

How can I install this?

To install the library for use in your project, you can use goinstall.

go get ""

How can I install this from source?

In a Go workspace, create a directory for gohaml.

mkdir -p src/

Clone the gohaml repository into that newly created directory.
git clone git:// src/

Now build and install it.
go install

How can I use it?

How about something like this? Save it, compile it, link it, and run it!

package main

import (

func main() {
	var scope = make(map[string]interface{})
	scope["lang"] = "HAML"
	content := "I love <\n=lang<\n!"
	engine, _ := gohaml.NewEngine(content)
	output := engine.Render(scope)
	fmt.Println(output) // Prints "I love HAML!"


An implementation of the popular XHTML Abstraction Markup Language using the Go language.




No packages published
You can’t perform that action at this time.