Prepare resolved documents and autocorrection rules
This commit is contained in:
@@ -42,6 +42,20 @@ func sessionFieldExplicit(cfg *SessionConfig, name string) bool {
|
||||
return result != nil && result.Metadata().IsExplicit(configkit.Keys("inputs", name))
|
||||
}
|
||||
|
||||
// AutocorrectionSource identifies the authored source of the selected rules.
|
||||
func AutocorrectionSource(cfg *Config) string {
|
||||
if cfg == nil || cfg.Session == nil {
|
||||
return "derived_from_configuration"
|
||||
}
|
||||
if sessionFieldExplicit(cfg.Session, "autocorrect") || (cfg.Session.ConfigKitResult() == nil && cfg.Session.Inputs.Autocorrect != nil) {
|
||||
return "session_config"
|
||||
}
|
||||
if cfg.Campaign != nil && cfg.Campaign.Inputs.Autocorrect != nil {
|
||||
return "campaign_config"
|
||||
}
|
||||
return "derived_from_configuration"
|
||||
}
|
||||
|
||||
func documentResource(resolution *configkit.Resolution, path configkit.Path, value *string, invocationDir string, sources map[string]string) {
|
||||
if info, ok := resolution.EntryInfo(path); ok && len(info.Origin.Locations) == 1 {
|
||||
if source, ok := resolution.Source(info.Origin.Locations[0].SourceID); ok {
|
||||
|
||||
Reference in New Issue
Block a user