processTree traverses the node tree and swaps render and partial declarations with equivalent template calls. It returns all referenced templates encountered during the traversal.
(t *templateFile)
| 8 | // processTree traverses the node tree and swaps render and partial declarations with equivalent template calls. |
| 9 | // It returns all referenced templates encountered during the traversal. |
| 10 | func processTree(t *templateFile) ([]nestedFile, error) { |
| 11 | ts, err := processNode(t, nil, 0, t.Tree.Root) |
| 12 | if err != nil { |
| 13 | if err, ok := err.(posErr); ok { |
| 14 | line, col := pos(t.body, err.pos) |
| 15 | return ts, fmt.Errorf("%s:%d:%d: %s: %w", t.Name(), line, col, t.typ, err) |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | return ts, nil |
| 20 | } |
| 21 | |
| 22 | func processNode(root *templateFile, parent *parse.ListNode, index int, node parse.Node) (ts []nestedFile, err error) { |
| 23 | // appendResult appends the specified templates to the list of template names when there are no errors |
no test coverage detected