templates

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BlobTemplate = Must(Must(layout.Clone()).Parse(blobContent))
View Source
var BranchesTemplate = Must(Must(layout.Clone()).Parse(branchesContent))
View Source
var CSSMarkdownDark string
View Source
var CSSMarkdownLight string
View Source
var CommitTemplate = Must(Must(layout.Clone()).Parse(commitContent))
View Source
var CommitsListTemplate = Must(Must(layout.Clone()).Parse(commitsListContent))
View Source
var ListTemplate = Must(Must(layout.Clone()).Parse(listContent))
View Source
var MarkdownTemplate = Must(Must(layout.Clone()).Parse(markdownContent))
View Source
var PreviewTemplate = Must(New("preview").Parse(previewContent))
View Source
var TagsTemplate = Must(Must(layout.Clone()).Parse(tagsContent))

Functions

This section is empty.

Types

type BlobParams

type BlobParams struct {
	LayoutParams
	HeaderParams
	CSS      CSS
	Blob     git.Blob
	IsImage  bool
	IsBinary bool
	Content  HTML
}

type BranchEntry

type BranchEntry struct {
	Name        string
	Href        string
	IsDefault   bool
	CommitsHref string
}

type BranchesParams

type BranchesParams struct {
	LayoutParams
	Branches []BranchEntry
}
type Breadcrumb struct {
	Name  string
	Href  string
	IsDir bool
}

type CommitParams

type CommitParams struct {
	LayoutParams
	Commit    git.Commit
	DiffCSS   CSS
	FileTree  []*FileTree
	FileViews []FileView
}

type CommitsListParams

type CommitsListParams struct {
	LayoutParams
	HeaderParams
	Ref     git.Ref
	Commits []git.Commit
	Page    Pagination
}

type FileTree

type FileTree struct {
	Name     string
	Path     string
	IsDir    bool
	Children []*FileTree

	// File status (applicable when IsDir == false)
	IsNew    bool
	IsDelete bool
	IsRename bool
	OldName  string
	NewName  string
	// Anchor id for this file (empty for directories)
	Anchor string
}

FileTree represents a directory or file in a commit's changed files tree. For directories, IsDir is true and Children contains nested nodes. For files, status flags indicate the type of change.

type FileTreeParams

type FileTreeParams struct {
	Nodes []*FileTree
}

type FileView

type FileView struct {
	Path       string
	OldName    string
	NewName    string
	IsNew      bool
	IsDelete   bool
	IsRename   bool
	IsBinary   bool
	HasChanges bool
	HTML       HTML // pre-rendered HTML for diff of this file
}

FileView represents a single file section on the commit page with its pre-rendered HTML diff and metadata used by the template.

type HeaderParams

type HeaderParams struct {
	Ref         git.Ref
	Header      string
	Breadcrumbs []Breadcrumb
}

type LayoutParams

type LayoutParams struct {
	Title         string
	Name          string
	Dark          bool
	CSSMarkdown   CSS
	RootHref      string
	CurrentRefDir string
	Selected      string
}

type ListEntry

type ListEntry struct {
	Name  string
	Href  string
	IsDir bool
	Mode  string
	Size  string
}

type ListParams

type ListParams struct {
	LayoutParams
	HeaderParams
	Ref        git.Ref
	ParentHref string
	Dirs       []ListEntry
	Files      []ListEntry
	Readme     HTML
}

type MarkdownParams

type MarkdownParams struct {
	LayoutParams
	HeaderParams
	Blob    git.Blob
	Content HTML
}

type Pagination

type Pagination struct {
	Page       int
	TotalPages int
	PrevHref   string
	NextHref   string
	FirstHref  string
	LastHref   string
}

type PreviewCard

type PreviewCard struct {
	Name string
	Tone string
	HTML HTML
}

type PreviewParams

type PreviewParams struct {
	Count  int
	Themes []PreviewCard
}

type TagsParams

type TagsParams struct {
	LayoutParams
	Tags []git.Tag
}

Jump to

Keyboard shortcuts

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