gotmpl2html

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 7 Imported by: 0

README

gotmpl2html

gotmpl2html is a cli tool to convert gotemplate to html.

Usage

$ gotmpl2html input.gotmpl > output.html

For more information, see usage

Feature

  • JSON Binding

    Example

    • employeelist.json
      {
          "title": "Employee List",
          "employees": [
              {
                  "id": "001",
                  "name": "James",
                  "age": 20
              },
              {
                  "id": "002",
                  "name": "Mary",
                  "age": 30
              },
              {
                  "id": "003",
                  "name": "Linda",
                  "age": 40
              }
          ]
      }
      
    • input.gotmpl
      {{data "/employeelist.json" }}
      <html>
      <head>
          <title>{{.title}}</title>
      </head>
      <body>
          {{template "/_header.partial" . }}
          <table>
              {{range .employees}}
              <tr>
                  <td>{{.id}}</td>
                  <td>{{.name}}</td>
                  <td>{{.age}}</td>
              </tr>
              {{end}}
          </table>
          {{template "/_footer.partial" . }}
      </body>
      </html>
      

Documentation

Index

Constants

View Source
const (
	EXIT_SUCCESS = 0
	EXIT_FAILURE = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	*ui.IO
	Name    string
	Version string
	Usage   string
	Args    []string
}

func New

func New() *App

func (*App) Run

func (a *App) Run() (exitStatus int)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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