Documentation ¶
Index ¶
- Variables
- func AddTemplate(metadata, content string)
- func ClearTemplateStore()
- func GetHyperScriptFiles(baseUrl string) ([]string, error)
- func GetLogger() *zap.SugaredLogger
- func GetTemplate(metadata string) (string, bool)
- func GetTemplateStore() map[string]string
- func LogTemplates()
- func LookupByPath(data map[string]interface{}, path string) (interface{}, error)
- func ParseHyperScript(input string) map[string]interface{}
- func PreprocessHyperScript(hyperBricks string, hyperbricksDir string, templateDir string) (string, error)
- func PrintConfig(config map[string]interface{}, level int) string
- func PrintJSON(config map[string]interface{}) string
- func StripCDATAAndStore(input string) string
- func StripComments(input string) string
- func StripCommentsV2(input string) string
- func StripCommentsV3(input string) string
- type HyperScriptStringArray
- func (tsa *HyperScriptStringArray) GetAllHyperBricks() map[string]string
- func (t *HyperScriptStringArray) GetHyperScriptContents(route string) (string, bool)
- func (t *HyperScriptStringArray) PreProcessHyperBricksFromFiles(hyperbricksDir string, templateDir string) error
- func (t *HyperScriptStringArray) PreProcessHyperScriptFromFile(hyperbricksfile string, hyperbricksDir string, templateDir string) error
Constants ¶
This section is empty.
Variables ¶
var (
HbConfig map[string]interface{}
)
var KnownTypes = map[string]bool{}
var (
PostProcessedHyperScriptStoreMutex sync.RWMutex
)
Functions ¶
func AddTemplate ¶
func AddTemplate(metadata, content string)
AddTemplate stores a template in the global map using a unique key (metadata).
func ClearTemplateStore ¶
func ClearTemplateStore()
ClearTemplateStore clears all templates in the global template store.
func GetHyperScriptFiles ¶
GetHyperScriptFiles returns a list of .hyperbricks files in the specified directory.
func GetLogger ¶
func GetLogger() *zap.SugaredLogger
GetLogger returns the singleton SugaredLogger instance
func GetTemplate ¶
GetTemplate retrieves a template by its metadata key.
func GetTemplateStore ¶
GetTemplateStore retrieves a copy of the current template store.
func LogTemplates ¶
func LogTemplates()
func LookupByPath ¶
LookupByPath retrieves a value from a nested map using a dot-separated key path.
func ParseHyperScript ¶
ParseHyperScript parses HyperBricks input and returns a nested configuration. It now supports variable definitions and substitutions.
func PreprocessHyperScript ¶
func PreprocessHyperScript(hyperBricks string, hyperbricksDir string, templateDir string) (string, error)
PreprocessHyperScript processes @import directives and replaces TEMPLATE tokens.
func PrintConfig ¶
PrintConfig recursively builds a structured representation of the configuration.
func StripCDATAAndStore ¶
StripCDATAAndStore extracts custom CDATA sections with metadata and content, replaces them with the metadata name, and stores them in the global templateStore via AddTemplate.
func StripComments ¶
func StripCommentsV2 ¶
func StripCommentsV3 ¶
Types ¶
type HyperScriptStringArray ¶
type HyperScriptStringArray struct { HyperBricksStore map[string]string PreProcessedHyperScriptStoreMutex sync.RWMutex }
HyperScriptStringArray is a struct that holds a map of loaded HyperBricks strings and provides thread-safe access to the data.
func (*HyperScriptStringArray) GetAllHyperBricks ¶
func (tsa *HyperScriptStringArray) GetAllHyperBricks() map[string]string
GetAllHyperBricks returns a copy of all loaded Hyperbricks contents. This method is exported (starts with an uppercase letter) to be accessible from other packages.
func (*HyperScriptStringArray) GetHyperScriptContents ¶
func (t *HyperScriptStringArray) GetHyperScriptContents(route string) (string, bool)
GetHyperScriptContents retrieves the content of a Hyperbricks by its route (metadata key).
func (*HyperScriptStringArray) PreProcessHyperBricksFromFiles ¶
func (t *HyperScriptStringArray) PreProcessHyperBricksFromFiles(hyperbricksDir string, templateDir string) error
PreProcessHyperBricksFromFiles loads Hyperbricks files' contents from the specified directory and stores them in the HyperScriptStringArray instance.
func (*HyperScriptStringArray) PreProcessHyperScriptFromFile ¶
func (t *HyperScriptStringArray) PreProcessHyperScriptFromFile(hyperbricksfile string, hyperbricksDir string, templateDir string) error
PreProcessHyperScriptFromFile loads a HyperBricks file's content from the specified file path and stores it in the HyperScriptStringArray instance.