templates

package
v1.15.6 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: MIT Imports: 35 Imported by: 138

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionContent2Commits

func ActionContent2Commits(act Actioner) *repository.PushCommits

ActionContent2Commits converts action content to push commits

func ActionIcon

func ActionIcon(opType models.ActionType) string

ActionIcon accepts an action operation type and returns an icon class name.

func Avatar added in v1.14.0

func Avatar(item interface{}, others ...interface{}) template.HTML

Avatar renders user avatars. args: user, size (int), class (string)

func AvatarByAction added in v1.14.0

func AvatarByAction(action *models.Action, others ...interface{}) template.HTML

AvatarByAction renders user avatars from action. args: action, size (int), class (string)

func AvatarByEmail added in v1.14.0

func AvatarByEmail(email string, name string, others ...interface{}) template.HTML

AvatarByEmail renders avatars by email address. args: email, name, size (int), class (string)

func AvatarHTML added in v1.14.0

func AvatarHTML(src string, size int, class string, name string) template.HTML

AvatarHTML creates the HTML for an avatar

func DiffLineTypeToStr

func DiffLineTypeToStr(diffType int) string

DiffLineTypeToStr returns diff line type name

func DiffTypeToStr

func DiffTypeToStr(diffType int) string

DiffTypeToStr returns diff type name

func Escape added in v1.3.3

func Escape(raw string) string

Escape escapes a HTML string

func GetAsset added in v1.14.0

func GetAsset(name string) ([]byte, error)

GetAsset returns asset content via name

func GetAssetNames added in v1.14.0

func GetAssetNames() []string

GetAssetNames returns assets list

func HTMLRenderer added in v1.6.0

func HTMLRenderer() *render.Render

HTMLRenderer returns a render.

func IsMultilineCommitMessage added in v1.4.0

func IsMultilineCommitMessage(msg string) bool

IsMultilineCommitMessage checks to see if a commit message contains multiple lines.

func JSEscape added in v1.14.0

func JSEscape(raw string) string

JSEscape escapes a JS string

func List

func List(l *list.List) chan interface{}

List traversings the list

func Mailer

func Mailer() (*texttmpl.Template, *template.Template)

Mailer provides the templates required for sending notification mails.

func MigrationIcon added in v1.10.0

func MigrationIcon(hostname string) string

MigrationIcon returns a Font Awesome name matching the service an issue/comment was migrated from

func NewFuncMap

func NewFuncMap() []template.FuncMap

NewFuncMap returns functions for injecting to templates

func NewTextFuncMap added in v1.11.0

func NewTextFuncMap() []texttmpl.FuncMap

NewTextFuncMap returns functions for injecting to text templates It's a subset of those used for HTML and other templates

func ReactionToEmoji added in v1.12.0

func ReactionToEmoji(reaction string) template.HTML

ReactionToEmoji renders emoji for use in reactions

func RenderCommitBody added in v1.4.0

func RenderCommitBody(msg, urlPrefix string, metas map[string]string) template.HTML

RenderCommitBody extracts the body of a commit message without its title.

func RenderCommitMessage

func RenderCommitMessage(msg, urlPrefix string, metas map[string]string) template.HTML

RenderCommitMessage renders commit message with XSS-safe and special links.

func RenderCommitMessageLink(msg, urlPrefix, urlDefault string, metas map[string]string) template.HTML

RenderCommitMessageLink renders commit message as a XXS-safe link to the provided default url, handling for special links.

func RenderCommitMessageLinkSubject added in v1.10.0

func RenderCommitMessageLinkSubject(msg, urlPrefix, urlDefault string, metas map[string]string) template.HTML

RenderCommitMessageLinkSubject renders commit message as a XXS-safe link to the provided default url, handling for special links without email to links.

func RenderEmoji added in v1.12.0

func RenderEmoji(text string) template.HTML

RenderEmoji renders html text with emoji post processors

func RenderIssueTitle added in v1.14.0

func RenderIssueTitle(text, urlPrefix string, metas map[string]string) template.HTML

RenderIssueTitle renders issue/pull title with defined post processors

func RenderNote added in v1.9.0

func RenderNote(msg, urlPrefix string, metas map[string]string) template.HTML

RenderNote renders the contents of a git-notes file as a commit message.

func RepoAvatar added in v1.14.0

func RepoAvatar(repo *models.Repository, others ...interface{}) template.HTML

RepoAvatar renders repo avatars. args: repo, size(int), class (string)

func SVG added in v1.13.0

func SVG(icon string, others ...interface{}) template.HTML

SVG render icons - arguments icon name (string), size (int), class (string)

func Safe

func Safe(raw string) template.HTML

Safe render raw as HTML

func SafeJS added in v1.2.0

func SafeJS(raw string) template.JS

SafeJS renders raw as JS

func Sha1

func Sha1(str string) string

Sha1 returns sha1 sum of string

func Str2html

func Str2html(raw string) template.HTML

Str2html render Markdown text to HTML

func TrN added in v1.3.0

func TrN(lang string, cnt interface{}, key1, keyN string) string

TrN returns key to be used for plural text translation

Types

type Actioner

type Actioner interface {
	GetOpType() models.ActionType
	GetActUserName() string
	GetRepoUserName() string
	GetRepoName() string
	GetRepoPath() string
	GetRepoLink() string
	GetBranch() string
	GetContent() string
	GetCreate() time.Time
	GetIssueInfos() []string
}

Actioner describes an action

type Vars added in v1.14.0

type Vars map[string]interface{}

Vars represents variables to be render in golang templates

func BaseVars added in v1.14.0

func BaseVars() Vars

BaseVars returns all basic vars

func (Vars) Merge added in v1.14.0

func (vars Vars) Merge(another map[string]interface{}) Vars

Merge merges another vars to the current, another Vars will override the current

Jump to

Keyboard shortcuts

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