ParseGhostDirective extracts ghost configuration from sheet content. Returns nil if no ghost directive is found.
(content string)
| 13 | // ParseGhostDirective extracts ghost configuration from sheet content. |
| 14 | // Returns nil if no ghost directive is found. |
| 15 | func ParseGhostDirective(content string) (map[string]string, error) { |
| 16 | match := ghostDirectiveRegex.FindStringSubmatch(content) |
| 17 | if len(match) < 2 { |
| 18 | return nil, nil |
| 19 | } |
| 20 | |
| 21 | var flags map[string]string |
| 22 | if err := json.Unmarshal([]byte(match[1]), &flags); err != nil { |
| 23 | return nil, err |
| 24 | } |
| 25 | |
| 26 | return flags, nil |
| 27 | } |
| 28 | |
| 29 | // IsGhostEnabled checks if ghost is enabled by checking for directive presence. |
| 30 | func IsGhostEnabled(content string) bool { |