render

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 13 Imported by: 33

Documentation

Overview

Copyright 2016 Wenhui Shen <www.webx.top>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Copyright 2016 Wenhui Shen <www.webx.top>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var DefaultFuncMapSkipper = func(c echo.Context) bool {
	return c.Format() != `html` && !c.IsAjax() && !c.IsPjax()
}
View Source
var (
	DefaultOptions = &Options{
		Skipper:              echo.DefaultSkipper,
		ErrorPages:           make(map[int]string),
		DefaultHTTPErrorCode: http.StatusInternalServerError,
		SetFuncMap: []echo.HandlerFunc{
			func(c echo.Context) error {
				c.SetFunc(`Lang`, c.Lang)
				c.SetFunc(`Now`, time.Now)
				c.SetFunc(`T`, c.T)
				return nil
			},
		},
	}
)

Functions

func Auto added in v1.3.7

func Auto() echo.MiddlewareFunc

func Del

func Del(key string)

func HTTPErrorHandler added in v1.1.0

func HTTPErrorHandler(opt *Options) echo.HTTPErrorHandler

func Middleware

func Middleware(d echo.Renderer) echo.MiddlewareFunc

Middleware set renderer

func New

func New(key string, tmplDir string, args ...logger.Logger) Driver

func Reg

func Reg(key string, val func(string) Driver)

Types

type Config added in v1.1.0

type Config struct {
	TmplDir              string
	Theme                string
	Engine               string
	Style                string
	Reload               bool
	ParseStrings         map[string]string
	ParseStringFuncs     map[string]func() string
	ErrorPages           map[int]string
	ErrorProcessors      []ErrorProcessor
	DefaultHTTPErrorCode int
	StaticOptions        *middleware.StaticOptions
	Debug                bool

	FuncMapGlobal map[string]interface{}
	RendererDo    []func(driver.Driver)
	CustomParser  func(tmpl string, content []byte) []byte
	// contains filtered or unexported fields
}

func (*Config) AddFuncSetter added in v1.3.9

func (t *Config) AddFuncSetter(set ...echo.HandlerFunc) *Config

func (*Config) AddRendererDo added in v1.4.3

func (t *Config) AddRendererDo(rd ...func(driver.Driver)) *Config

func (*Config) ApplyTo added in v1.1.1

func (t *Config) ApplyTo(e *echo.Echo, manager ...driver.Manager) *Config

func (*Config) HTTPErrorHandler added in v1.6.0

func (t *Config) HTTPErrorHandler() echo.HTTPErrorHandler

func (*Config) MakeRenderer added in v1.6.0

func (t *Config) MakeRenderer(manager ...driver.Manager) driver.Driver

func (*Config) NewRenderer added in v1.1.1

func (t *Config) NewRenderer(manager ...driver.Manager) driver.Driver

NewRenderer 新建渲染接口

func (*Config) Parser added in v1.1.0

func (t *Config) Parser() func(tmpl string, content []byte) []byte

func (*Config) Renderer added in v1.1.1

func (t *Config) Renderer() driver.Driver

func (*Config) SetFuncSetter added in v1.3.9

func (t *Config) SetFuncSetter(set ...echo.HandlerFunc) *Config

func (*Config) SetRendererDo added in v1.4.3

func (t *Config) SetRendererDo(rd ...func(driver.Driver)) *Config

func (*Config) StaticMiddleware added in v1.6.0

func (t *Config) StaticMiddleware() interface{}

func (*Config) ThemeDir added in v1.1.1

func (t *Config) ThemeDir(args ...string) string

ThemeDir 主题所在文件夹的路径

type ErrorProcessor added in v1.6.0

type ErrorProcessor func(ctx echo.Context, err error) (processed bool, newErr error)

type Options added in v1.1.1

type Options struct {
	Skipper              echo.Skipper
	ErrorPages           map[int]string
	ErrorProcessors      []ErrorProcessor
	DefaultHTTPErrorCode int
	SetFuncMap           []echo.HandlerFunc
	CodeLinks            map[code.Code]echo.KVList
}

func (*Options) AddErrorProcessor added in v1.6.0

func (opt *Options) AddErrorProcessor(h ...ErrorProcessor) *Options

func (*Options) AddFuncSetter added in v1.3.9

func (opt *Options) AddFuncSetter(set ...echo.HandlerFunc) *Options

func (*Options) SetErrorProcessor added in v1.6.0

func (opt *Options) SetErrorProcessor(h ...ErrorProcessor) *Options

func (*Options) SetFuncSetter added in v1.3.9

func (opt *Options) SetFuncSetter(set ...echo.HandlerFunc) *Options

Directories

Path Synopsis
jet
sse
*

Jump to

Keyboard shortcuts

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