view

package
v0.0.0-...-c0cdbda Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTemplateNotFound = errors.New("view: template not found")

Functions

func Init

func Init(cfg *config.Config) error

Init loads the HTML templates.

func Render

func Render(name string, w io.Writer, data any) error

Render writes the given data to w using the template with the given name.

Types

type Bytes

type Bytes uint64

func (Bytes) String

func (b Bytes) String() string

type FileInfo

type FileInfo struct {
	Name    string
	Mode    FileMode
	Content string
	Size    Bytes
	Lines   int
}

FileInfo contains the information of a file.

type FileMode

type FileMode filemode.FileMode

FileMode is a wrapper around go-git's filemode.FileMode for templating.

func (FileMode) IsDir

func (mode FileMode) IsDir() bool

func (FileMode) String

func (mode FileMode) String() string
type Navigation struct {
	Ref      string
	Path     string
	PathMode FileMode
	Active   string
}

Navigation stores the information of the page navigation.

type Readme

type Readme struct {
	Content string
	IsHTML  bool
}

Readme stores the information of a repository's README file.

func (Readme) HTML

func (r Readme) HTML() template.HTML

func (Readme) String

func (r Readme) String() string

type Repository

type Repository struct {
	Name       string
	Desc       string
	DefaultRef string
	LatestTag  string
	Commit     string
	Updated    time.Time
}

Repository stores the general information of a Git repository.

type TreeEntry

type TreeEntry struct {
	Name string
	Size Bytes
	Mode FileMode
}

TreeEntry contains the properties of an object in a tree.

Jump to

Keyboard shortcuts

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