Documentation
¶
Index ¶
- func AnyStubsInStubs(src, tgt PageStubs) (found bool)
- func AsTyped[T interface{}](f Feature) (t T, ok bool)
- func FilterTyped[T interface{}](list Features) (found []T)
- func FirstTyped[T interface{}](list Features) (found T)
- func MustTyped[T interface{}](f Feature) (t T)
- func RegisterPageMatcherFuncs(matchers ...MatcherFn)
- type Action
- type Actions
- func (a Actions) Append(actions ...Action) (modified Actions)
- func (a Actions) AsNewlines() (newlines string)
- func (a Actions) FilterKnown(other Actions) (known Actions)
- func (a Actions) FilterUnknown(other Actions) (unknown Actions)
- func (a Actions) Has(action Action) (present bool)
- func (a Actions) HasSubject(subject string) (present bool)
- func (a Actions) HasVerb(verb string) (present bool)
- func (a Actions) Len() int
- func (a Actions) String() (s string)
- type ApplyMiddleware
- type Author
- type BaseMakePreset
- type Buildable
- type Builder
- type CConsole
- type CEnjinBlock
- type CEnjinFeature
- func (f *CEnjinFeature) NjnCheckClass(tagClass NjnClass) (allow bool)
- func (f *CEnjinFeature) NjnCheckTag(tagName string) (allow bool)
- func (f *CEnjinFeature) NjnClassAllowed() (allowed NjnClass, ok bool)
- func (f *CEnjinFeature) NjnTagsAllowed() (allowed []string, ok bool)
- func (f *CEnjinFeature) NjnTagsDenied() (denied []string, ok bool)
- type CEnjinField
- type CFeature
- func (f *CFeature) BaseTag() (pkg Tag)
- func (f *CFeature) Build(b Buildable) (err error)
- func (f *CFeature) CloneBaseFeature() (cloned CFeature)
- func (f *CFeature) Depends() (deps Tags)
- func (f *CFeature) Init(this interface{})
- func (f *CFeature) Make() Feature
- func (f *CFeature) Self() (self Feature)
- func (f *CFeature) Setup(enjin Internals)
- func (f *CFeature) Shutdown()
- func (f *CFeature) Startup(ctx *cli.Context) (err error)
- func (f *CFeature) Tag() (tag Tag)
- func (f *CFeature) This() (this interface{})
- func (f *CFeature) UsageNotes() (notes []string)
- type CPreset
- func (p *CPreset[MakeTypedPreset]) Include(features ...Feature) MakeTypedPreset
- func (p *CPreset[MakeTypedPreset]) IncludeFeature(b Builder, f Feature)
- func (p *CPreset[MakeTypedPreset]) Init(this interface{})
- func (p *CPreset[MakeTypedPreset]) Label() (name string)
- func (p *CPreset[MakeTypedPreset]) Make() Preset
- func (p *CPreset[MakeTypedPreset]) OmitTags(features ...Tag) MakeTypedPreset
- func (p *CPreset[MakeTypedPreset]) Overload(tag Tag, feature Feature) MakeTypedPreset
- func (p *CPreset[MakeTypedPreset]) Prepend(features ...Feature) MakeTypedPreset
- func (p *CPreset[MakeTypedPreset]) Preset(b Builder) (err error)
- type CacheEnjinFeature
- type CanSetupInternals
- type Console
- type ContentSecurityPolicyModifier
- type DataRestrictionHandler
- type Database
- type EmailProvider
- type EmailSender
- type EnjinBlock
- type EnjinContextProvider
- type EnjinFeature
- type EnjinField
- type EnjinRenderer
- type EnjinRunner
- type EnjinSystem
- type Feature
- type Features
- type FeaturesCache
- func (c *FeaturesCache) Add(f Feature) (err error)
- func (c *FeaturesCache) Get(tag Tag) (f Feature, ok bool)
- func (c *FeaturesCache) List() (list Features)
- func (c *FeaturesCache) MustGet(tag Tag) (f Feature)
- func (c *FeaturesCache) Prepend(f Feature) (err error)
- func (c *FeaturesCache) Tags() (list Tags)
- type FileProvider
- type FuncMap
- type FuncMapProvider
- type HeadersModifier
- type Internals
- type KeywordProvider
- type LoggerContext
- type MakeConsole
- type MakeFeature
- type MakePreset
- type MatcherFn
- type MenuProvider
- type MiddlewareFn
- type NjnClass
- type NotifyHook
- type OutputTransformer
- type OutputTranslator
- type Page
- type PageContextFilterFn
- type PageContextModifier
- type PageContextProvider
- type PageFormat
- type PageFormatProvider
- type PageIndexFeature
- type PageProvider
- type PageRestrictionHandler
- type PageShortcodeProcessor
- type PageStub
- type PageStubs
- type PageTypeProcessor
- type PermissionsPolicyModifier
- type Preset
- type Processor
- type QueryIndexFeature
- type ReqProcessFn
- type RequestFilter
- type RequestFilterFn
- type RequestModifier
- type RequestRewriter
- type RootInternals
- type RoutePagesHandler
- type Runner
- type SearchDocumentMapperFeature
- type SearchEnjinFeature
- type ServePathFeature
- type Service
- type ServiceListener
- type ServiceLogHandler
- type ServiceLogger
- type ServiceResponseLogger
- type SiteEnjin
- type SiteInfo
- type System
- type Tag
- type Tags
- type TemplatePartialsProvider
- type Theme
- type ThemeConfig
- type ThemeLayout
- type ThemeLayouts
- type ThemeRenderer
- type TransformOutputFn
- type TranslateOutputFn
- type UseMiddleware
- type ValueStubPair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyStubsInStubs ¶ added in v0.4.0
func FilterTyped ¶ added in v0.2.15
func FilterTyped[T interface{}](list Features) (found []T)
func FirstTyped ¶ added in v0.2.15
func FirstTyped[T interface{}](list Features) (found T)
func RegisterPageMatcherFuncs ¶ added in v0.4.0
func RegisterPageMatcherFuncs(matchers ...MatcherFn)
Types ¶
type Action ¶ added in v0.4.0
type Action string
Action is a kebab-cased name consisting of a verb, a subject (feature.Tag) and one or more additional details, separated by periods. For example: the action `view_fs-content_page` has a verb of "view", a subject of "fs-content" and one additional detail of "page". Details are individually converted to kebab-case and joined with hyphens, ie: `view_fs-content_page.search`
func ParseAction ¶ added in v0.4.0
type Actions ¶ added in v0.4.0
type Actions []Action
Actions are the collection of one or more groups
func NewActionsFromStringNL ¶ added in v0.4.0
func NewActionsFromStrings ¶ added in v0.4.0
func ParseActions ¶ added in v0.4.0
func (Actions) AsNewlines ¶ added in v0.4.0
func (Actions) FilterKnown ¶ added in v0.4.0
func (Actions) FilterUnknown ¶ added in v0.4.0
func (Actions) HasSubject ¶ added in v0.4.0
type ApplyMiddleware ¶ added in v0.1.0
type BaseMakePreset ¶ added in v0.4.0
type BaseMakePreset[MakeTypedPreset interface{}] interface {
// Include specifies additional features to be included during the build phase
Include(features ...Feature) MakeTypedPreset
// Prepend includes the specified features before all other features within the preset
Prepend(features ...Feature) MakeTypedPreset
// OmitTags specifies preset Feature.Tag()s to be omitted during the build phase
OmitTags(features ...Tag) MakeTypedPreset
// Overload provides a replacement for an existing feature (by tag)
// Note: panics if tag specified is not found
Overload(tag Tag, feature Feature) MakeTypedPreset
}
type Buildable ¶
type Buildable interface {
Builder
// MakeEnvKey returns name with EnvPrefix (SCREAMING_SNAKE formatted)
MakeEnvKey(name string) (key string)
// MakeEnvKeys returns name with EnvPrefix (SCREAMING_SNAKE formatted)
MakeEnvKeys(names ...string) (key []string)
// RegisterPublicFileSystem mounts the given static FileSystems
RegisterPublicFileSystem(mount string, filesystems ...fs.FileSystem)
// RegisterTemplatePartial sets the named go-template content for inclusion at the specified block and position
// Notes:
// * "block" must be one of "head" or "body"
// * position must be one of "head" or "tail"
// * adds the given name tmpl to the first feature.TemplatePartialsProvider
// * auto-adds a feature.TemplatePartialsProvider if none are present
RegisterTemplatePartial(block, position, name, tmpl string) (err error)
}
type Builder ¶
type Builder interface {
SiteTag(key string) Builder
SiteName(name string) Builder
SiteTagLine(title string) Builder
SiteCopyrightName(name string) Builder
SiteCopyrightNotice(notice string) Builder
SiteLanguageMode(mode lang.Mode) Builder
SiteDefaultLanguage(tag language.Tag) Builder
SiteSupportedLanguages(tags ...language.Tag) Builder
SiteLanguageDisplayNames(names map[language.Tag]string) Builder
// Set a custom context key with value
Set(key string, value interface{}) Builder
// AddPreset includes the given presets just before the normal enjin Build() phase, presets are added in the same
// order given and any features added will be inserted before all other enjin features present
AddPreset(presets ...Preset) Builder
// AddHtmlHeadTag adds a custom (singleton) HTML tag to the <head> section
// of the page output, example meta tag:
// AddHtmlHeadTag("meta",map[string]string{"name":"og:thing","content":"stuff"})
AddHtmlHeadTag(name string, attr map[string]string) Builder
// AddDomains restricts inbound requests to only the domain names given
AddDomains(domains ...string) Builder
// AddFlags adds custom command line flags
AddFlags(flags ...cli.Flag) Builder
// AddCommands adds custom command line commands
AddCommands(commands ...*cli.Command) Builder
// AddConsole adds custom command line go-curses consoles (ctk.Window)
AddConsole(c Console) Builder
// AddFeature appends the given feature within the built Enjin (appends it to the end of the list of features
// included)
AddFeature(f Feature) Builder
// PrependFeature prepends the given feature within the built Enjin (inserts it at the start of the list of
// features included)
PrependFeature(f Feature) Builder
// AddRouteProcessor adds the given route processor to the Enjin route
// processing middleware
AddRouteProcessor(route string, processor ReqProcessFn) Builder
// AddOutputTranslator adds the given output filter (for the given mime type)
AddOutputTranslator(mime string, filter TranslateOutputFn) Builder
// AddModifyHeadersFn adds the given headers.ModifyHeadersFn function to the
// default headers enjin middleware layer
AddModifyHeadersFn(fn headers.ModifyHeadersFn) Builder
AddNotifyHook(name string, hook NotifyHook) Builder
// AddPageFromString is a convenience wrapper around AddPage
AddPageFromString(path, raw string) Builder
// SetStatusPage overrides specific HTTP error pages, ie: 404
SetStatusPage(status int, path string) Builder
// AddTheme includes the given theme within the built Enjin
AddTheme(t Theme) Builder
// SetTheme configures the default theme
SetTheme(name string) Builder
// HotReload enables or disables hot-reloading theme templates and content files
HotReload(enabled bool) Builder
// SetPublicAccess specifies the list of actions unauthorized visitors have
//
// Note: not specifying any public access results in no public access given
SetPublicAccess(actions ...Action) Builder
// AddUserAction adds the given actions to the overall known list of
// registered user actions across all features
AddUserAction(actions ...Action) Builder
// Build constructs an Enjin Runner from the Builder configuration
Build() Runner
}
type CEnjinBlock ¶
type CEnjinBlock struct {
CEnjinFeature
}
type CEnjinFeature ¶
type CEnjinFeature struct {
CFeature
}
func (*CEnjinFeature) NjnCheckClass ¶
func (f *CEnjinFeature) NjnCheckClass(tagClass NjnClass) (allow bool)
func (*CEnjinFeature) NjnCheckTag ¶
func (f *CEnjinFeature) NjnCheckTag(tagName string) (allow bool)
func (*CEnjinFeature) NjnClassAllowed ¶
func (f *CEnjinFeature) NjnClassAllowed() (allowed NjnClass, ok bool)
func (*CEnjinFeature) NjnTagsAllowed ¶
func (f *CEnjinFeature) NjnTagsAllowed() (allowed []string, ok bool)
func (*CEnjinFeature) NjnTagsDenied ¶
func (f *CEnjinFeature) NjnTagsDenied() (denied []string, ok bool)
type CEnjinField ¶
type CEnjinField struct {
CEnjinFeature
}
type CFeature ¶
type CFeature struct {
PackageTag Tag
FeatureTag Tag
Enjin Internals
sync.RWMutex
// contains filtered or unexported fields
}
func (*CFeature) CloneBaseFeature ¶ added in v0.2.5
func (*CFeature) UsageNotes ¶ added in v0.4.0
type CPreset ¶ added in v0.4.0
type CPreset[MakeTypedPreset interface{}] struct {
Name string
Features Features
// contains filtered or unexported fields
}
func (*CPreset[MakeTypedPreset]) IncludeFeature ¶ added in v0.4.0
IncludeFeature will prepend the given feature to the Builder enjin, taking into account omissions and overloads
func (*CPreset[MakeTypedPreset]) Init ¶ added in v0.4.0
func (p *CPreset[MakeTypedPreset]) Init(this interface{})
type CacheEnjinFeature ¶ added in v0.4.0
type CacheEnjinFeature interface {
NewCache(bucket string) (err error)
Mounted(bucket, path string) (ok bool)
Mount(bucket, mount, path string, mfs fs.FileSystem)
Rebuild(bucket string) (ok bool)
Lookup(bucket string, tag language.Tag, url string) (mount, path string, p Page, err error)
LookupTranslations(bucket, url string) (pgs []Page)
LookupRedirect(bucket, url string) (p Page, ok bool)
LookupPrefix(bucket, prefix string) (found []Page)
TotalCached(bucket string) (count uint64)
}
type CanSetupInternals ¶
type CanSetupInternals interface {
Setup(enjin Internals)
}
type DataRestrictionHandler ¶
type Database ¶
type Database interface {
Feature
// ListDB returns a sorted list of connected db tags for use with DB and
// MustDB
ListDB() (tags []string)
// DB returns the database connection or an error
DB(tag string) (db interface{}, err error)
// MustDB returns the database connection or panics on error
MustDB(tag string) (db interface{})
}
type EmailProvider ¶ added in v0.1.0
type EmailSender ¶ added in v0.1.0
type EnjinBlock ¶
type EnjinBlock interface {
EnjinFeature
NjnBlockType() (name string)
ProcessBlock(re EnjinRenderer, blockType string, data map[string]interface{}) (html template.HTML, redirect string, err error)
PrepareBlock(re EnjinRenderer, blockType string, data map[string]interface{}) (block map[string]interface{}, redirect string, err error)
RenderPreparedBlock(re EnjinRenderer, block map[string]interface{}) (html template.HTML, err error)
}
type EnjinContextProvider ¶ added in v0.4.0
type EnjinFeature ¶
type EnjinField ¶
type EnjinField interface {
EnjinFeature
NjnFieldNames() (tagNames []string)
PrepareNjnData(re EnjinRenderer, tagName string, field map[string]interface{}) (data map[string]interface{}, err error)
}
type EnjinRenderer ¶
type EnjinRenderer interface {
RequestArgv() (reqArgv *argv.RequestArgv)
RequestContext() (ctx context.Context)
RenderNjnTemplate(tag string, data map[string]interface{}) (html template.HTML, err error)
ProcessBlock(data map[string]interface{}) (html template.HTML, redirect string, err error)
PrepareBlock(data map[string]interface{}) (block map[string]interface{}, redirect string, err error)
RenderPreparedBlock(block map[string]interface{}) (html template.HTML, err error)
PrepareGenericBlockData(contentData interface{}) (blockDataContent map[string]interface{}, err error)
PrepareGenericBlock(typeName string, data map[string]interface{}) (preparedData map[string]interface{})
GetData() (data interface{})
GetBlockIndex() (index int)
GetWithinAside() (within bool)
SetWithinAside(within bool)
GetCurrentDepth() (depth int)
IncCurrentDepth() (depth int)
DecCurrentDepth() (depth int)
GetHeadingCount() (count int)
SetHeadingCount(count int)
IncHeadingCount()
GetHeadingLevel() (level int)
SetHeadingLevel(level int)
IncHeadingLevel()
DecHeadingLevel()
AddFootnote(blockIndex int, field map[string]interface{}) (index int)
PrepareFootnotes(blockIndex int) (footnotes []map[string]interface{}, err error)
ParseTypeName(data map[string]interface{}) (name string, ok bool)
ParseFieldAndTypeName(data interface{}) (field map[string]interface{}, name string, ok bool)
PrepareStringTags(text string) (data []interface{}, err error)
WalkStringTags(doc *html.Node) (prepared []interface{})
PrepareBlockHeader(content map[string]interface{}) (combined []interface{}, ok bool)
ParseBlockHeadingLevel(count, current int, blockData map[string]interface{}) (level, headingReset, headingLevel int)
RenderBlockHeader(content map[string]interface{}) (html template.HTML, ok bool)
PrepareInlineFieldText(field map[string]interface{}) (combined []interface{}, err error)
PrepareInlineFieldList(list []interface{}) (combined []interface{}, err error)
PrepareInlineFields(fields []interface{}) (combined []interface{}, err error)
PrepareInlineField(field map[string]interface{}) (prepared map[string]interface{}, err error)
PrepareContainerFieldText(field map[string]interface{}) (fields []interface{}, err error)
PrepareContainerFieldList(list []interface{}) (fields []interface{}, err error)
PrepareContainerFields(fields []interface{}) (combined []map[string]interface{}, err error)
PrepareContainerField(field map[string]interface{}) (prepared map[string]interface{}, err error)
RenderInlineField(field map[string]interface{}) (combined []template.HTML, err error)
RenderInlineFields(fields []interface{}) (combined []template.HTML, err error)
RenderInlineFieldList(list []interface{}) (html template.HTML, err error)
RenderInlineFieldText(field map[string]interface{}) (text template.HTML, err error)
RenderContainerField(field map[string]interface{}) (combined []template.HTML, err error)
RenderContainerFields(fields []interface{}) (combined []template.HTML, err error)
RenderContainerFieldList(list []interface{}) (html template.HTML, err error)
RenderContainerFieldText(field map[string]interface{}) (text template.HTML, err error)
}
type EnjinRunner ¶
type EnjinSystem ¶
type EnjinSystem interface {
InlineFields() (field map[string]EnjinField)
ContainerFields() (field map[string]EnjinField)
InlineBlocks() (field map[string]EnjinBlock)
ContainerBlocks() (field map[string]EnjinBlock)
StringTags() (names []string)
FindField(tagClass NjnClass, fieldType string) (field EnjinField, ok bool)
FindBlock(tagClass NjnClass, blockType string) (block EnjinBlock, ok bool)
}
type FeaturesCache ¶ added in v0.2.15
type FeaturesCache struct {
// contains filtered or unexported fields
}
func NewFeaturesCache ¶ added in v0.2.15
func NewFeaturesCache() (cache *FeaturesCache)
func (*FeaturesCache) Add ¶ added in v0.2.15
func (c *FeaturesCache) Add(f Feature) (err error)
func (*FeaturesCache) Get ¶ added in v0.2.15
func (c *FeaturesCache) Get(tag Tag) (f Feature, ok bool)
func (*FeaturesCache) List ¶ added in v0.2.15
func (c *FeaturesCache) List() (list Features)
func (*FeaturesCache) MustGet ¶ added in v0.2.15
func (c *FeaturesCache) MustGet(tag Tag) (f Feature)
func (*FeaturesCache) Prepend ¶ added in v0.4.0
func (c *FeaturesCache) Prepend(f Feature) (err error)
func (*FeaturesCache) Tags ¶ added in v0.2.15
func (c *FeaturesCache) Tags() (list Tags)
type FileProvider ¶ added in v0.1.0
type FuncMap ¶ added in v0.4.0
type FuncMap textTemplate.FuncMap
func (FuncMap) AsHTML ¶ added in v0.4.0
func (fm FuncMap) AsHTML() htmlTemplate.FuncMap
func (FuncMap) AsTEXT ¶ added in v0.4.0
func (fm FuncMap) AsTEXT() textTemplate.FuncMap
type FuncMapProvider ¶ added in v0.4.0
type HeadersModifier ¶
type HeadersModifier interface {
Feature
ModifyHeaders(w http.ResponseWriter, r *http.Request)
}
type Internals ¶
type Internals interface {
Service
signaling.SignalsSupport
SiteEnjin
Self() (self interface{})
Features() (cache *FeaturesCache)
Pages() (pages map[string]Page)
Theme() (theme string)
Theming() (theming map[string]Theme)
Headers() (headers []headers.ModifyHeadersFn)
Domains() (domains []string)
Consoles() (consoles map[Tag]Console)
Processors() (processors map[string]ReqProcessFn)
Translators() (translators map[string]TranslateOutputFn)
Transformers() (transformers map[string]TransformOutputFn)
Slugsums() (enabled bool)
DB(tag string) (db interface{}, err error)
MustDB(tag string) (db interface{})
SpecificDB(fTag Tag, tag string) (db interface{}, err error)
MustSpecificDB(fTag Tag, tag string) (db interface{})
MakeFuncMap(ctx context.Context) (fm FuncMap)
PublicFileSystems() (registry fs.Registry)
ListTemplatePartials(block, position string) (names []string)
GetTemplatePartial(block, position, name string) (tmpl string, ok bool)
}
type KeywordProvider ¶ added in v0.4.0
type LoggerContext ¶ added in v0.4.0
type LoggerContext interface {
// URL is the parsed request URL
URL() (parsed *url.URL)
// Size is the number of response bytes
Size() (size int)
// StatusCode is the HTTP status code of the response
StatusCode() (status int)
// TimeStamp returns when the request was first received
TimeStamp() (when time.Time)
// Duration returns the total time taken to complete the request
Duration() (duration time.Duration)
// Request returns the request object
Request() (r *http.Request)
}
LoggerContext is a per-request context used with ServiceLogger implementations
type MakeConsole ¶
type MakeConsole interface {
Make() Console
}
type MakeFeature ¶
type MakeFeature interface {
Make() Feature
}
type MakePreset ¶ added in v0.4.0
type MakePreset interface {
Make() Preset
BaseMakePreset[MakePreset]
}
func NewPresetWith ¶ added in v0.4.0
func NewPresetWith(name string, features ...Feature) MakePreset
type MatcherFn ¶ added in v0.4.0
func GetPageMatcherFuncs ¶ added in v0.4.0
func GetPageMatcherFuncs() (funcs []MatcherFn)
type MenuProvider ¶
type NotifyHook ¶
type NotifyHook = func(format string, argv ...interface{})
type OutputTransformer ¶
type OutputTranslator ¶
type Page ¶ added in v0.4.0
type Page interface {
Type() (pageType string)
Format() (pageFormat string)
Url() (url string)
Slug() (slug string)
Path() (path string)
Title() (title string)
Summary() (summary string)
Description() (description string)
Layout() (layoutName string)
Section() (section string)
Archetype() (archetype string)
Permalink() (id uuid.UUID)
PermalinkSha() (shasum string)
Language() (code string)
LanguageTag() (tag language.Tag)
Translates() (url string)
Shasum() (shasum string)
Content() (content string)
FrontMatter() (frontMatter string)
FrontMatterType() (frontMatterType matter.FrontMatterType)
PageMatter() (pageMatter *matter.PageMatter)
CreatedAt() (at time.Time)
UpdatedAt() (at time.Time)
DeletedAt() (at sql.NullTime)
Context() (ctx beContext.Context)
String() (jsonPage string)
Match(path string) (found string, ok bool)
MatchQL(query string) (ok bool, err error)
MatchPrefix(prefix string) (found string, ok bool)
Redirections() (redirects []string)
IsRedirection(path string) (ok bool)
IsTranslation(path string) (ok bool)
HasTranslation() (ok bool)
SetType(pageType string)
SetFormat(pageFormat string) (path string)
SetSlugUrl(url string)
SetTitle(title string)
SetSummary(summary string)
SetDescription(description string)
SetLayout(layoutName string)
SetArchetype(archetype string)
SetPermalink(value string) (err error)
SetLanguage(tag language.Tag)
SetTranslates(url string)
SetContent(content string)
SetFrontMatter(frontMatter string)
SetFrontMatterType(frontMatterType matter.FrontMatterType)
SetCreatedAt(at time.Time)
SetUpdatedAt(at time.Time)
SetDeletedAt(at sql.NullTime)
Copy() (copy Page)
}
type PageContextFilterFn ¶
type PageContextModifier ¶
type PageContextProvider ¶ added in v0.4.0
type PageContextProvider interface {
FindPageStub(shasum string) (stub *PageStub)
PageContextValuesCount(key string) (count uint64)
PageContextValueCounts(key string) (counts map[interface{}]uint64)
YieldPageContextValues(key string) (values chan interface{})
YieldPageContextValueStubs(key string) (pairs chan *ValueStubPair)
YieldFilterPageContextValueStubs(include bool, key string, value interface{}) (pairs chan *ValueStubPair)
FilterPageContextValueStubs(include bool, key string, value interface{}) (stubs PageStubs)
}
type PageFormat ¶ added in v0.4.0
type PageFormat interface {
Feature
Name() (name string)
Label() (label string)
Extensions() (extensions []string)
Prepare(ctx context.Context, content string) (out context.Context, err error)
Process(ctx context.Context, content string) (html template.HTML, redirect string, err error)
IndexDocument(pg Page) (doc interface{}, err error)
NewDocumentMapping(tag language.Tag) (doctype, analyzer string, dm *mapping.DocumentMapping)
}
type PageFormatProvider ¶ added in v0.4.0
type PageFormatProvider interface {
ListFormats() (names []string)
GetFormat(name string) (format PageFormat)
MatchFormat(filename string) (format PageFormat, match string)
}
type PageIndexFeature ¶ added in v0.4.0
type PageProvider ¶
type PageRestrictionHandler ¶
type PageShortcodeProcessor ¶ added in v0.4.0
type PageStub ¶ added in v0.4.0
type PageStub struct {
Origin string
FS fs.FileSystem
Point string
Shasum string
Source string
Language language.Tag
Fallback language.Tag
EnjinCtx beContext.Context
}
func NewPageStub ¶ added in v0.4.0
func (*PageStub) MarshalBinary ¶ added in v0.4.0
func (*PageStub) UnmarshalBinary ¶ added in v0.4.0
type PageStubs ¶ added in v0.4.0
type PageStubs []*PageStub
type PageTypeProcessor ¶
type PermissionsPolicyModifier ¶
type PermissionsPolicyModifier interface {
Feature
ModifyPermissionsPolicy(policy permissions.Policy, r *http.Request) (modified permissions.Policy)
}
type QueryIndexFeature ¶ added in v0.4.0
type ReqProcessFn ¶
type RequestFilter ¶
type RequestFilterFn ¶
type RequestModifier ¶
type RequestModifier interface {
Feature
ModifyRequest(w http.ResponseWriter, r *http.Request)
}
type RequestRewriter ¶
type RootInternals ¶
type RoutePagesHandler ¶ added in v0.4.0
type RoutePagesHandler interface {
Feature
RoutePage(w http.ResponseWriter, r *http.Request)
}
type SearchDocumentMapperFeature ¶ added in v0.4.0
type SearchDocumentMapperFeature interface {
SearchDocumentMapping(tag language.Tag) (doctype string, dm *mapping.DocumentMapping)
AddSearchDocumentMapping(tag language.Tag, indexMapping *mapping.IndexMappingImpl)
}
type SearchEnjinFeature ¶ added in v0.4.0
type SearchEnjinFeature interface {
PrepareSearch(tag language.Tag, input string) (query string)
PerformSearch(tag language.Tag, input string, size, pg int) (results *bleve.SearchResult, err error)
AddToSearchIndex(stub *PageStub, p Page) (err error)
RemoveFromSearchIndex(tag language.Tag, file, shasum string)
}
type ServePathFeature ¶ added in v0.1.0
type Service ¶
type Service interface {
Prefix() (prefix string)
Context() (ctx context.Context)
GetTheme() (t Theme, err error)
MustGetTheme() (t Theme)
ThemeNames() (names []string)
ServerName() (name string)
ServiceInfo() (scheme, listen string, port int)
ContentSecurityPolicy() (handler *csp.PolicyHandler)
PermissionsPolicy() (handler *permissions.PolicyHandler)
ServeRedirect(destination string, w http.ResponseWriter, r *http.Request)
Serve204(w http.ResponseWriter, r *http.Request)
Serve400(w http.ResponseWriter, r *http.Request)
Serve401(w http.ResponseWriter, r *http.Request)
ServeBasic401(w http.ResponseWriter, r *http.Request)
Serve403(w http.ResponseWriter, r *http.Request)
Serve404(w http.ResponseWriter, r *http.Request)
Serve405(w http.ResponseWriter, r *http.Request)
Serve500(w http.ResponseWriter, r *http.Request)
ServeNotFound(w http.ResponseWriter, r *http.Request)
ServeInternalServerError(w http.ResponseWriter, r *http.Request)
ServeStatusPage(status int, w http.ResponseWriter, r *http.Request)
ServePage(p Page, w http.ResponseWriter, r *http.Request) (err error)
ServePath(urlPath string, w http.ResponseWriter, r *http.Request) (err error)
ServeJSON(v interface{}, w http.ResponseWriter, r *http.Request) (err error)
ServeStatusJSON(status int, v interface{}, w http.ResponseWriter, r *http.Request) (err error)
ServeData(data []byte, mime string, w http.ResponseWriter, r *http.Request)
MatchQL(query string) (pages []Page)
MatchStubsQL(query string) (stubs []*PageStub)
SelectQL(query string) (selected map[string]interface{})
CheckMatchQL(query string) (pages []Page, err error)
CheckMatchStubsQL(query string) (stubs []*PageStub, err error)
CheckSelectQL(query string) (selected map[string]interface{}, err error)
FindPageStub(shasum string) (stub *PageStub)
FindPage(tag language.Tag, url string) (p Page)
FindFile(path string) (data []byte, mime string, err error)
FindEmailAccount(account string) (emailSender EmailSender)
SendEmail(account string, message *gomail.Message) (err error)
GetPublicAccess() (actions Actions)
FindAllUserActions() (list Actions)
Notify(tag string)
NotifyF(tag, format string, argv ...interface{})
TranslateShortcodes(content string, ctx context.Context) (modified string)
GetThemeRenderer(ctx context.Context) (renderer ThemeRenderer)
signaling.EmitterSupport
}
type ServiceListener ¶ added in v0.4.0
type ServiceLogHandler ¶ added in v0.4.0
type ServiceLogger ¶ added in v0.4.0
type ServiceLogger interface {
Feature
RequestLogger(ctx LoggerContext) (err error)
}
type ServiceResponseLogger ¶ added in v0.4.0
type SiteEnjin ¶ added in v0.4.0
type SiteEnjin interface {
SiteTag() (key string)
SiteName() (name string)
SiteTagLine() (tagLine string)
SiteLocales() (locales []language.Tag)
SiteLangCatalog() (c *catalog.Catalog)
SiteLanguageMode() (mode lang.Mode)
SiteLanguageCatalog() (c catalog2.Catalog)
SiteDefaultLanguage() (tag language.Tag)
SiteSupportsLanguage(tag language.Tag) (supported bool)
SiteLanguageDisplayName(tag language.Tag) (name string, ok bool)
FindTranslations(url string) (pages []Page)
FindPage(tag language.Tag, url string) (p Page)
FindPages(prefix string) (pages []Page)
}
type SiteInfo ¶ added in v0.4.0
type SiteInfo struct {
Tag string
Name string
TagLine string
Locales []language.Tag
LangMode lang.Mode
DefaultLang language.Tag
}
func MakeSiteInfo ¶ added in v0.4.0
type Tag ¶
type Tag string
Tag is the primary identifier type for enjin Feature implementations
const NotImplemented Tag = "not-implemented"
func (Tag) Equal ¶ added in v0.4.0
Equal returns true if the kebab-case of this Tag is the same as the kebab-case of the other Tag
func (Tag) ScreamingKebab ¶ added in v0.1.0
ScreamingKebab returns the Tag as a SCREAMING-KEBAB-CASED string
func (Tag) ScreamingSnake ¶ added in v0.1.0
ScreamingSnake returns the Tag as a SCREAMING_SNAKE_CASED string
type Tags ¶
type Tags []Tag
func SortedFeatureTags ¶ added in v0.1.0
SortedFeatureTags returns a sortorder.Natural list of Tag keys
func StringsAsTags ¶ added in v0.1.0
StringsAsTags returns a list of Tags based on the names given
type TemplatePartialsProvider ¶ added in v0.4.0
type Theme ¶ added in v0.4.0
type Theme interface {
Name() (name string)
Reload() (err error)
GetParent() (parent Theme)
GetBlockThemeNames() (names []string)
ThemeFS() fs.FileSystem
StaticFS() fs.FileSystem
Locales() (locales fs.FileSystem, ok bool)
GetConfig() (config ThemeConfig)
Layouts() ThemeLayouts
FindLayout(named string) (layout ThemeLayout, name string, ok bool)
AddFormatProvider(providers ...PageFormatProvider)
PageFormatProvider
Middleware(next http.Handler) http.Handler
NewHtmlTemplate(enjin Internals, name string, ctx context.Context) (tmpl *htmlTemplate.Template, err error)
NewTextTemplate(enjin Internals, name string, ctx context.Context) (tmpl *textTemplate.Template, err error)
}
type ThemeConfig ¶ added in v0.4.0
type ThemeConfig struct {
Name string
Parent string
License string
LicenseLink string
Description string
Homepage string
Authors []Author
Extends string
RootStyles []htmlTemplate.CSS
BlockStyles map[string][]htmlTemplate.CSS
BlockThemes map[string]map[string]interface{}
FontawesomeLinks map[string]string
FontawesomeClasses []string
CacheControl string
PermissionsPolicy []permissions.Directive
ContentSecurityPolicy csp.ContentSecurityPolicyConfig
Context context.Context
}
type ThemeLayout ¶ added in v0.4.0
type ThemeLayout interface {
Name() (name string)
NewHtmlTemplate(enjin Internals, ctx context.Context) (tmpl *htmlTemplate.Template, err error)
NewTextTemplate(enjin Internals, ctx context.Context) (tmpl *textTemplate.Template, err error)
NewHtmlTemplateFrom(enjin Internals, parent ThemeLayout, ctx context.Context) (tmpl *htmlTemplate.Template, err error)
NewTextTemplateFrom(enjin Internals, parent ThemeLayout, ctx context.Context) (tmpl *textTemplate.Template, err error)
ApplyHtmlTemplate(enjin Internals, tt *htmlTemplate.Template, ctx context.Context) (err error)
ApplyTextTemplate(enjin Internals, tt *textTemplate.Template, ctx context.Context) (err error)
}
type ThemeLayouts ¶ added in v0.4.0
type ThemeLayouts interface {
GetLayout(name string) (layout ThemeLayout)
SetLayout(name string, layout ThemeLayout)
NewHtmlTemplate(enjin Internals, name string, ctx context.Context) (tmpl *htmlTemplate.Template, err error)
NewTextTemplate(enjin Internals, name string, ctx context.Context) (tmpl *textTemplate.Template, err error)
ApplyHtmlTemplates(enjin Internals, tmpl *htmlTemplate.Template, ctx context.Context) (err error)
ApplyTextTemplates(enjin Internals, tmpl *textTemplate.Template, ctx context.Context) (err error)
}
type ThemeRenderer ¶ added in v0.4.0
type ThemeRenderer interface {
Feature
Render(view string, ctx context.Context) (data []byte, err error)
RenderPage(ctx context.Context, p Page) (data []byte, redirect string, err error)
NewHtmlTemplateWith(name string, ctx context.Context) (tt *htmlTemplate.Template, err error)
NewTextTemplateWith(name string, ctx context.Context) (tt *textTemplate.Template, err error)
RenderHtmlTemplateContent(ctx context.Context, tmplContent string) (rendered string, err error)
RenderTextTemplateContent(ctx context.Context, tmplContent string) (rendered string, err error)
NewHtmlTemplateFromContext(view string, ctx context.Context) (tt *htmlTemplate.Template, err error)
NewTextTemplateFromContext(view string, ctx context.Context) (tt *textTemplate.Template, err error)
}
type TransformOutputFn ¶
type TranslateOutputFn ¶
type UseMiddleware ¶ added in v0.1.0
type UseMiddleware interface {
Feature
Use(s System) MiddlewareFn
}
type ValueStubPair ¶ added in v0.4.0
type ValueStubPair struct {
Value interface{}
Stub *PageStub
}
Source Files
¶
- action.go
- actions.go
- buildable.go
- builder.go
- console_stub.go
- db.go
- email.go
- enjin.go
- enjin_block.go
- enjin_field.go
- enjin_renderer.go
- enjin_runner.go
- enjin_system.go
- feature.go
- features-cache.go
- features-utils.go
- features.go
- funcmaps.go
- menu.go
- middleware.go
- notify.go
- output.go
- page-format.go
- page-indexing.go
- page-matchers.go
- page-stub.go
- page-stubs.go
- page.go
- pages.go
- preset.go
- processor.go
- request.go
- runner.go
- service.go
- site.go
- system.go
- tag.go
- tags.go
- theme.go