PSHTML
PSHTML copied to clipboard
prohibit /enforce some tags only in nested tags (Content blocks)
Some HTML elements are only allowed to be used when they are nested in other elements. A good example for that is the <Area> element.
The <area> element is always nested inside a <map> tag.
Some guidance could be found here --> https://kevinmarquette.github.io/2017-03-13-Powershell-DSL-design-patterns/#restricted-dsl
Example from pester:
# in module scope
$script:pester
function describe () {
$script:pester.EnterBlock("describe")
}
function it () {
if ($script:pester.Block -ne "Describe") {
throw "it can only be in describe"
}
$script:pester.EnterBlock("it")
}
function should () {
if ($script:pester.Block -ne "It") {
throw "should can only be in it"
}
}
Source: https://gist.github.com/nohwnd/3ab59610d328efe4f862fb0951f70fe0