In SHP v1 it was possible to use a (very rough) workaround to create parametrized templates. Because v2 has no namespaces, it no longer is possible.
Implement a proper system for parametrized templates.
Proposed / example usage:
// define the template
@template[#ExampleTemplate] {
$div[.Example] {
$h3 { @slot[#Name] }
@slot[#Content]
}
}
// insert twice with different parameters
$div[#Listing] {
@insert[template = ExampleTemplate] {
@param[#Name] {Hello}
@param[#Content] {
$img[src = "/img/hello.png"]
Hello world\!
}
}
@insert[template = ExampleTemplate] {
@param[#Name] {Goodbye}
@param[#Content] {
$img[src = "/img/bye.png"]
The end\!
}
}
}
Because SHP functions are executed after the tokens are already parsed into nodes, I doubt it would be possible to parametrize something that is not itself a node (for example, tag parameters).
In SHP v1 it was possible to use a (very rough) workaround to create parametrized templates. Because v2 has no namespaces, it no longer is possible.
Implement a proper system for parametrized templates.
Proposed / example usage:
Because SHP functions are executed after the tokens are already parsed into nodes, I doubt it would be possible to parametrize something that is not itself a node (for example, tag parameters).