extractFeatures extracts the features field from frontmatter Returns a map of feature flags and configuration options (supports boolean flags and string values)
(frontmatter map[string]any)
| 17 | // extractFeatures extracts the features field from frontmatter |
| 18 | // Returns a map of feature flags and configuration options (supports boolean flags and string values) |
| 19 | func (c *Compiler) extractFeatures(frontmatter map[string]any) map[string]any { |
| 20 | frontmatterMetadataLog.Print("Extracting features from frontmatter") |
| 21 | value, exists := frontmatter["features"] |
| 22 | if !exists { |
| 23 | frontmatterMetadataLog.Print("No features field found in frontmatter") |
| 24 | return nil |
| 25 | } |
| 26 | |
| 27 | // Features should be an object with any values (boolean or string) |
| 28 | if featuresMap, ok := value.(map[string]any); ok { |
| 29 | result := make(map[string]any) |
| 30 | // Accept any value type (boolean, string, etc.) |
| 31 | maps.Copy(result, featuresMap) |
| 32 | frontmatterMetadataLog.Printf("Extracted %d features", len(result)) |
| 33 | return result |
| 34 | } |
| 35 | |
| 36 | frontmatterMetadataLog.Print("Features field is not a map") |
| 37 | return nil |
| 38 | } |
| 39 | |
| 40 | // extractDescription extracts the description field from frontmatter |
| 41 | func (c *Compiler) extractDescription(frontmatter map[string]any) string { |