Documentation
¶
Index ¶
- type ConfigAdapter
- type LoggerAdapter
- func (l *LoggerAdapter) Debug(msg string, keysAndValues ...any)
- func (l *LoggerAdapter) Error(msg string, keysAndValues ...any)
- func (l *LoggerAdapter) Fatal(msg string, keysAndValues ...any)
- func (l *LoggerAdapter) Info(msg string, keysAndValues ...any)
- func (l *LoggerAdapter) Panic(msg string, keysAndValues ...any)
- func (l *LoggerAdapter) Warn(msg string, keysAndValues ...any)
- type PageCollectionAdapter
- func (a *PageCollectionAdapter) GetPageCollection() *entities.PageCollection
- func (a *PageCollectionAdapter) InitializePageCollection(config *entities.Config) error
- func (a *PageCollectionAdapter) RegisterPageCollectionObserver(observer entities.PageCollectionObserver)
- func (a *PageCollectionAdapter) UnregisterPageCollectionObserver(observer *entities.PageCollectionObserver)
- func (a *PageCollectionAdapter) WatchPageCollection() error
- type SiteAdapter
- type ThemeAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigAdapter ¶
type ConfigAdapter struct {
}
ConfigAdapter implements the ConfigPort interface.
func NewConfigAdapter ¶
func NewConfigAdapter() *ConfigAdapter
NewConfigAdapter returns a new ConfigAdapter.
func (*ConfigAdapter) LoadConfig ¶
func (a *ConfigAdapter) LoadConfig(filename string) (*entities.Config, error)
LoadConfig loads the config from a file.
type LoggerAdapter ¶
type LoggerAdapter struct {
// contains filtered or unexported fields
}
func NewLoggerAdapter ¶
func NewLoggerAdapter() *LoggerAdapter
func (*LoggerAdapter) Debug ¶
func (l *LoggerAdapter) Debug(msg string, keysAndValues ...any)
Debug logs a debug message with optional fields.
func (*LoggerAdapter) Error ¶
func (l *LoggerAdapter) Error(msg string, keysAndValues ...any)
Error logs an error message with optional fields.
func (*LoggerAdapter) Fatal ¶
func (l *LoggerAdapter) Fatal(msg string, keysAndValues ...any)
Fatal logs a fatal message with optional fields.
func (*LoggerAdapter) Info ¶
func (l *LoggerAdapter) Info(msg string, keysAndValues ...any)
Info logs an info message with optional fields.
func (*LoggerAdapter) Panic ¶
func (l *LoggerAdapter) Panic(msg string, keysAndValues ...any)
Panic logs a panic message with optional fields.
func (*LoggerAdapter) Warn ¶
func (l *LoggerAdapter) Warn(msg string, keysAndValues ...any)
Warn logs a warning message with optional fields.
type PageCollectionAdapter ¶
type PageCollectionAdapter struct {
// contains filtered or unexported fields
}
PageCollectionAdapter implements the PageCollectionPort interface.
func NewPageCollectionAdapter ¶
func NewPageCollectionAdapter(logger ports.LoggerPort) *PageCollectionAdapter
NewPageCollectionAdapter returns a new PageCollectionAdapter.
func (*PageCollectionAdapter) GetPageCollection ¶
func (a *PageCollectionAdapter) GetPageCollection() *entities.PageCollection
GetPageCollection returns the page collection.
func (*PageCollectionAdapter) InitializePageCollection ¶
func (a *PageCollectionAdapter) InitializePageCollection(config *entities.Config) error
InitializePageCollection initializes the page collection. It walks the content path and creates a page for each markdown file. It also sets the default language. It returns an error if the content path could not be walked. It returns an error if a page could not be created from a markdown file.
func (*PageCollectionAdapter) RegisterPageCollectionObserver ¶
func (a *PageCollectionAdapter) RegisterPageCollectionObserver(observer entities.PageCollectionObserver)
RegisterPageCollectionObserver registers a page collection observer.
func (*PageCollectionAdapter) UnregisterPageCollectionObserver ¶
func (a *PageCollectionAdapter) UnregisterPageCollectionObserver(observer *entities.PageCollectionObserver)
UnregisterPageCollectionObserver unregisters a page collection observer.
func (*PageCollectionAdapter) WatchPageCollection ¶
func (a *PageCollectionAdapter) WatchPageCollection() error
WatchPageCollection watches the content path for changes.
type SiteAdapter ¶
type SiteAdapter struct {
// contains filtered or unexported fields
}
SiteAdapter implements the SitePort interface.
func NewSiteAdapter ¶
func NewSiteAdapter(config *entities.Config) *SiteAdapter
NewSiteAdapter returns a new SiteAdapter.
func (*SiteAdapter) FetchSite ¶
func (sa *SiteAdapter) FetchSite(collection *entities.PageCollection, path *url.URL, userLanguage fields.RequiredString) (*entities.Site, error)
FetchSite returns a new Site. The Site contains the current page and all pages. The Site also contains the config. The Site also contains the current path. The Site also contains the base URL. The Site also contains a map for custom data. The Site also contains the current language.
type ThemeAdapter ¶
type ThemeAdapter struct {
// contains filtered or unexported fields
}
ThemeAdapter is the adapter for the theme port. It is used to render the pages.
func NewThemeAdapter ¶
func NewThemeAdapter(config *entities.Config, logger ports.LoggerPort) *ThemeAdapter
NewThemeAdapter returns a new ThemeAdapter
func (*ThemeAdapter) AddTemplateVariable ¶
func (a *ThemeAdapter) AddTemplateVariable(name string, value any)
AddTemplateVariable adds a variable to the global context.
func (*ThemeAdapter) NotFoundRenderer ¶
func (a *ThemeAdapter) NotFoundRenderer() ports.ThemeRenderer
NotFoundRenderer returns a renderer for the 404 page.
func (*ThemeAdapter) TemplateRenderer ¶
func (a *ThemeAdapter) TemplateRenderer() ports.ThemeRenderer
TemplateRenderer returns a renderer for a page.
func (*ThemeAdapter) WatchTemplates ¶
func (a *ThemeAdapter) WatchTemplates()
WatchTemplates checks for changes in the templates and reloads them if necessary.