render

package
v0.0.0-...-720af6a Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package render sets up the interface for rendering a .claw file to a language native representation. It also supports registering the handlers of those renderers (which are in other packages).

Index

Constants

This section is empty.

Variables

View Source
var Supported = map[Lang]Renderer{}

Supported is langauges that we have registered support for.

Functions

This section is empty.

Types

type Lang

type Lang uint8

Lang represents a programming language we can render a from a .claw file.

const (
	Unknown Lang = 0
	Go      Lang = 1
)

type Rendered

type Rendered struct {
	// Package is the Claw package this represents.
	Package string
	// RepoVersion is the version the repo is at.
	RepoVersion string
	// Path is the path in the local filesystem that source .claw file can be found at.
	Path string
	// Lang is the language this is for.
	Lang Lang
	// Native is the output for the language.
	Native []byte
}

Rendered represents rendered output for a language.

func Render

func Render(ctx context.Context, config *imports.Config, langs ...Lang) ([]Rendered, error)

Render is used to render a set of languages from the .claw file.

type Renderer

type Renderer interface {
	Render(ctx context.Context, config *imports.Config, path string) ([]byte, error)
}

Renderer renders a language native file from a .claw file.

Directories

Path Synopsis
Package golang implements the Go language renderer.
Package golang implements the Go language renderer.

Jump to

Keyboard shortcuts

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