core

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx *Context, listen string, fs fs.FS) error

Types

type Builder

type Builder interface {
	Build(context.Context) error
}

type Config

type Config struct {
	*viper.Viper
}

func DefaultConfig

func DefaultConfig() *Config

func NewConfig

func NewConfig() *Config

func (*Config) GetSubSlice

func (conf *Config) GetSubSlice(key string) []*viper.Viper

func (*Config) LoadFromFile

func (conf *Config) LoadFromFile(file string) error

func (*Config) MergeFromDefaultConfig

func (conf *Config) MergeFromDefaultConfig(force bool)

func (*Config) MergeFromThemeConfig

func (conf *Config) MergeFromThemeConfig(theme fs.FS) error

func (*Config) Reset

func (conf *Config) Reset(m map[string]any, force bool)

func (*Config) SetDebug

func (conf *Config) SetDebug()

func (*Config) SetMode

func (conf *Config) SetMode(mode string)

type Context

type Context struct {
	*LocaleContext
	Logger         Logger
	ThemeFS        fs.FS
	OtherLanguages map[string]*LocaleContext
}

func NewContext

func NewContext(conf *Config, opts ...ContextOption) (*Context, error)

func (*Context) For

func (ctx *Context) For(lang string) *LocaleContext

func (*Context) GetAllLanguages

func (ctx *Context) GetAllLanguages() []string

func (*Context) GetDefaultLanguage

func (ctx *Context) GetDefaultLanguage() string

func (*Context) GetFS

func (ctx *Context) GetFS(path string, internal bool) (fs.FS, error)

func (*Context) VerifyLanguage

func (ctx *Context) VerifyLanguage(lang string) bool

type ContextOption

type ContextOption func(*Context)

func WithLogger

func WithLogger(log Logger) ContextOption

type Error

type Error struct {
	Op   string
	Err  error
	Path string
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type LocaleContext

type LocaleContext struct {
	Config *Config
}

func (*LocaleContext) GetBaseURL

func (ctx *LocaleContext) GetBaseURL() string

func (*LocaleContext) GetContentDir

func (ctx *LocaleContext) GetContentDir() string

func (*LocaleContext) GetFormatConfig

func (ctx *LocaleContext) GetFormatConfig(name string, keyName string) Result

func (*LocaleContext) GetHighlightStyle

func (ctx *LocaleContext) GetHighlightStyle() string

func (*LocaleContext) GetLanguage

func (ctx *LocaleContext) GetLanguage() string

func (*LocaleContext) GetOutputDir

func (ctx *LocaleContext) GetOutputDir() string

func (*LocaleContext) GetPageConfig

func (ctx *LocaleContext) GetPageConfig(dir string) map[string]any

func (*LocaleContext) GetPathSlug

func (ctx *LocaleContext) GetPathSlug(path string) string

func (*LocaleContext) GetRelURL

func (ctx *LocaleContext) GetRelURL(path string) string

func (*LocaleContext) GetSectionConfig

func (ctx *LocaleContext) GetSectionConfig(dir string) map[string]any

func (*LocaleContext) GetSlug

func (ctx *LocaleContext) GetSlug(name string) string

func (*LocaleContext) GetStaticDir

func (ctx *LocaleContext) GetStaticDir() string

func (*LocaleContext) GetSummary

func (ctx *LocaleContext) GetSummary(content string) string

func (*LocaleContext) GetTaxonomyConfig

func (ctx *LocaleContext) GetTaxonomyConfig(name string, keyName string) Result

func (*LocaleContext) GetThemeDir

func (ctx *LocaleContext) GetThemeDir() string

func (*LocaleContext) GetURL

func (ctx *LocaleContext) GetURL(path string) string

type Logger

type Logger interface {
	Debug(...any)
	Debugf(string, ...any)
	Debugln(...any)
	Info(...any)
	Infof(string, ...any)
	Infoln(...any)
	Warn(...any)
	Warnf(string, ...any)
	Warnln(...any)
	Error(...any)
	Errorf(string, ...any)
	Errorln(...any)
	Fatal(...any)
	Fatalf(string, ...any)
	Fatalln(...any)
}

type Result

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

func (Result) Bool

func (r Result) Bool() bool

func (Result) Int

func (r Result) Int() int

func (Result) Int32

func (r Result) Int32() int32

func (Result) Int64

func (r Result) Int64() int64

func (Result) String

func (r Result) String() string

func (Result) StringMap

func (r Result) StringMap() map[string]any

func (Result) StringSlice

func (r Result) StringSlice() []string

type Server

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

func (*Server) ServeHTTP

func (m *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Writer

type Writer interface {
	Write(context.Context, string, io.Reader) error
}

Jump to

Keyboard shortcuts

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