templates

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2017 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionContent2Commits

func ActionContent2Commits(act Actioner) *models.PushCommits

ActionContent2Commits converts action content to push commits

func ActionIcon

func ActionIcon(opType int) string

ActionIcon accepts a int that represents action operation type and returns a icon class name.

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 List

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

List traversings the list

func Mailer

func Mailer() *template.Template

Mailer provides the templates required for sending notification mails.

func NewFuncMap

func NewFuncMap() []template.FuncMap

NewFuncMap returns functions for injecting to templates

func RenderCommitMessage

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

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

func Renderer

func Renderer() macaron.Handler

Renderer implements the macaron handler for serving the templates.

func ReplaceLeft

func ReplaceLeft(s, old, new string) string

ReplaceLeft replaces all prefixes 'old' in 's' with 'new'.

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 ToUTF8

func ToUTF8(content string) string

ToUTF8 converts content to UTF8 encoding and ignore error

func ToUTF8WithErr

func ToUTF8WithErr(content []byte) (string, error)

ToUTF8WithErr converts content to UTF8 encoding

Types

type Actioner

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

Actioner describes an action

Jump to

Keyboard shortcuts

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