transpile

package
v0.0.0-...-de5ff62 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 8 Imported by: 0

README

TextML / Transpile

Usage

textml transpile is used for reading *.tml files and translating it to other common formats. For now you must pass a file and use one of the following command line options

  • --format, -f: Set a format, available formats are

    • go: Uses https://github.com/alecthomas/repr/ to show the parsed tree structure

    • json: Converts the parsed document to JSON

    • inline-json: As previous but inlined

    • transpile.html: A simple semantic to convert #html.ELEMENT { ... } to the corresponding HTML element. This will get a major write pretty soon.

  • --output, -o: Set output file or "-" for stdout.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Registry = map[string]any{

	"repr": &Repr{},

	"html":        &Html{Inline: false},
	"html.inline": &Html{Inline: true},

	"json":        &Json{Inline: false},
	"json.inline": &Json{Inline: true},
}

Functions

This section is empty.

Types

type Html

type Html struct {
	Inline bool
}

func (*Html) Transpile

func (h *Html) Transpile(b ast.Block) (string, error)

func (*Html) TranspileBlock

func (h *Html) TranspileBlock(b ast.Block) (string, error)

func (*Html) TranspileElement

func (h *Html) TranspileElement(node *ast.ElementNode) (string, error)

type Json

type Json struct{ Inline bool }

func (*Json) Transpile

func (t *Json) Transpile(w io.Writer, block ast.Block) error

type Repr

type Repr struct{}

func (Repr) Transpile

func (Repr) Transpile(w io.Writer, block ast.Block) error

type StringTranspiler

type StringTranspiler interface {
	Transpile(block ast.Block) (string, error)
}

type WriteTranspiler

type WriteTranspiler interface {
	Transpile(w io.Writer, block ast.Block) error
}

Jump to

Keyboard shortcuts

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