Implement a Template struct and necessary methods in Go to support the functionality tested in the provided test code.
Requirements:
Define the Template struct with the following fields:
Path string
Generator *Generator
Elements []*Element
Blocks map[string]*Block
Super *Template (optional based on context)
Implement the following methods:
AppendElement(e *Element)
Adds the element e to the Elements slice of the Template.
Html(embedMap *EmbedMap)
Generates and returns HTML as a string based on the elements contained in the template.
This method requires the integration of the Element struct's properties to correctly produce the HTML output.
Dir() string
Returns the directory part of the Path. If there are no slashes in Path, return "./". If there are slashes, return the path up to and including the last slash.
AddBlock(name string, block *Block)
Adds a Block to the Blocks map with the specified name.
Create a constructor function:
NewTemplate(path string, g *Generator) *Template
Initializes a new Template instance with the specified path and Generator.
Define the Element, Generator, EmbedMap, and Block structs as necessary to support the operations required by the Template.
Ensure that all methods and structs comply with the expected behavior dictated by the provided tests, so they will pass successfully when executed.
Place your implementation in the /app/ directory.
Important: declare your solution in package gold (the test file uses package gold, so the implementation must use the matching package name).