acerender

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2014 License: MIT Imports: 7 Imported by: 3 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Martini Acerender

wercker status GoDoc Coverage Status

Overview

Martini Acerender is a Martini middleware/handler for parsing Ace templates and rendering HTML.

Example

main.go

package main

import (
	"github.com/go-martini/martini"
	"github.com/yosssi/martini-acerender"
)

func main() {
	m := martini.Classic()
	m.Use(acerender.Renderer(nil))
	m.Get("/", func(r acerender.Render) {
		r.HTML(200, "base:inner", map[string]string{"Msg": "Hello Acerender"}, nil)
	})
	m.Run()
}

base.ace

= doctype html
html lang=en
  head
    meta charset=utf-8
    meta http-equiv=Content-Type content="text/html;charset=UTF-8"
    meta name=viewport content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
    title Ace example
    = css
      h1 { color: blue; }
  body
    h1 Base Template : {{.Msg}}
    #container.wrapper
      = yield main
      = yield sub
    = javascript
      alert('{{.Msg}}');

inner.ace

= content main
  h2 Inner Template - Main : {{.Msg}}

= content sub
  h3 Inner Template - Sub : {{.Msg}}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Renderer

func Renderer(_ *Options) martini.Handler

Renderer is a Martini middleware that maps a render.Render service into the Martini handler chain.

Types

type Options

type Options struct{}

Options represents options for the Ace renderer.

type Render

type Render interface {
	HTML(status int, name string, v interface{}, opts *ace.Options)
}

Render is an interface for parsing Ace templates and redering HTML.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址