PSHTML icon indicating copy to clipboard operation
PSHTML copied to clipboard

prohibit /enforce some tags only in nested tags (Content blocks)

Open Stephanevg opened this issue 7 years ago • 2 comments

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.

Stephanevg avatar Sep 30 '18 20:09 Stephanevg

Some guidance could be found here --> https://kevinmarquette.github.io/2017-03-13-Powershell-DSL-design-patterns/#restricted-dsl

Stephanevg avatar Oct 02 '18 11:10 Stephanevg

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

Stephanevg avatar Dec 13 '18 00:12 Stephanevg