tmplview

package
v1.20240717.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CatUiIdReg = regexp.MustCompile(`^[a-z0-9_]+$`)
View Source
var DumpPath string = ""
View Source
var ErrUnsupportedSocketType = errors.New("unsupported socket type.")

Functions

func TmplFileType

func TmplFileType(name string) string

Types

type CatUiConfig

type CatUiConfig struct {
	Url string
	Var []CatUiVar
}

type CatUiParam

type CatUiParam struct {
	CatUiConfig
	Name string
}

type CatUiVar

type CatUiVar struct {
	Id      string
	Label   string
	Comment string `toml:",omitempty"`
}

type DummyGetter

type DummyGetter struct{}

func (DummyGetter) Get

func (DummyGetter) Get(string) string

type DummySetter

type DummySetter struct{}

func (DummySetter) Set

func (DummySetter) Set(string, string)

type DumpWrite

type DumpWrite struct {
	// contains filtered or unexported fields
}

func NewDumpWrite

func NewDumpWrite(out io.Writer, eout io.Writer) *DumpWrite

func (*DumpWrite) Error

func (w *DumpWrite) Error(msg string, code int)

func (*DumpWrite) Header

func (w *DumpWrite) Header() Setter

func (*DumpWrite) ServeFile

func (hw *DumpWrite) ServeFile(fsys fs.FS, file string)

func (*DumpWrite) Write

func (w *DumpWrite) Write(buf []byte) (int, error)

func (*DumpWrite) WriteHeader

func (w *DumpWrite) WriteHeader(code int)

type Getter

type Getter interface {
	Get(string) string
}

type HttpWrite

type HttpWrite struct {
	// contains filtered or unexported fields
}

func NewHttpWriter

func NewHttpWriter(w http.ResponseWriter, r *http.Request) *HttpWrite

func (*HttpWrite) Error

func (hw *HttpWrite) Error(msg string, code int)

func (*HttpWrite) Header

func (hw *HttpWrite) Header() Setter

func (*HttpWrite) ServeFile

func (hw *HttpWrite) ServeFile(fsys fs.FS, file string)

func (*HttpWrite) Write

func (hw *HttpWrite) Write(buf []byte) (int, error)

func (*HttpWrite) WriteHeader

func (hw *HttpWrite) WriteHeader(code int)

type HttpWriter

type HttpWriter interface {
	Header() Setter
	Write([]byte) (int, error)
	Error(string, int)
	WriteHeader(int)
	ServeFile(fsys fs.FS, file string)
}

type Setter

type Setter interface {
	Set(string, string)
}

type TmplOnce

type TmplOnce = func(string) bool
var DummyTmplOnce TmplOnce = func(string) bool { return true }

func NewTmplOnce

func NewTmplOnce() TmplOnce

type TmplView

type TmplView struct {
	SocketType string
	SocketPath string

	SystemFS fs.FS

	CacheControl string
	UrlTopPath   string
	UrlLibPath   string

	UserMap         *authz.UserMap
	AuthnUserHeader string

	OriginTmpl *template.Template

	DocumentRoot upath.UPath
	SvgIconPath  upath.UPath
	IndexName    string

	MdTmplName string
	Md2Html    *md2html.Md2Html

	MimeExtTable   *mtable.MimeExtTable
	MarkdownExt    []string
	MarkdownConfig *md2html.MdConfig

	ThemeStyle   string
	LocationNavi string

	DirectoryViewMode       string
	DirectoryViewRoots      []upath.UPath
	DirectoryViewHidden     []*regexp.Regexp
	DirectoryViewPathHidden []*regexp.Regexp
	TimeStampFormat         string
	DirViewStamp            *dirview.DirViewStamp

	TextViewMode string

	CatUiConfigPath upath.UPath
	CatUiConfigExt  string
	CatUiTmplName   string

	ConfigModTime time.Time
	TemplateTag   []byte
}

func NewTmplView

func NewTmplView(cfg *TmplViewConfig) (*TmplView, error)

func (*TmplView) CatUi

func (tmpv *TmplView) CatUi(api_name string) string

func (*TmplView) Dump

func (tmpv *TmplView) Dump(out, eout io.Writer, req_path string)

func (*TmplView) Handler

func (tmpv *TmplView) Handler(w http.ResponseWriter, r *http.Request)

func (*TmplView) ListenAndServe

func (tmpv *TmplView) ListenAndServe(cc task.Canceller) error

func (*TmplView) MakeEtag

func (tmpv *TmplView) MakeEtag(t time.Time, user string) string

func (*TmplView) Serve

func (tmpv *TmplView) Serve(cc task.Canceller, lstn net.Listener) error

func (*TmplView) SumTemplate

func (tmpv *TmplView) SumTemplate() ([]byte, error)

func (*TmplView) TmplSvgIcon

func (tmpv *TmplView) TmplSvgIcon(name string) string

func (*TmplView) Warn

func (tmpv *TmplView) Warn(format string, v ...interface{})

func (*TmplView) WriteTestCatUi

func (tmpv *TmplView) WriteTestCatUi(w io.Writer) error

type TmplViewConfig

type TmplViewConfig struct {
	SocketType   string
	SocketPath   string
	CacheControl string `toml:",omitempty"`

	UrlTopPath string `toml:",omitempty"`
	UrlLibPath string `toml:",omitempty"`

	Authz authzConfig
	Tmpl  tmplConfig

	SystemFS fs.FS     `toml:"-"`
	ModTime  time.Time `toml:"-"`
}

func NewTmplViewConfig

func NewTmplViewConfig(file string) (*TmplViewConfig, error)

func NewTmplViewConfigFS

func NewTmplViewConfigFS(fsys fs.FS, file string) (*TmplViewConfig, error)

Jump to

Keyboard shortcuts

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