|
| 1 | + |
| 2 | +function Language.Liquid { |
| 3 | +<# |
| 4 | + .SYNOPSIS |
| 5 | + Liquid PipeScript Language Definition |
| 6 | + .DESCRIPTION |
| 7 | + Allows PipeScript to generate [Liquid](https://shopify.github.io/liquid/) |
| 8 | + #> |
| 9 | +[ValidatePattern("\.liquid$")] |
| 10 | +param() |
| 11 | +$this = $myInvocation.MyCommand |
| 12 | +if (-not $this.Self) { |
| 13 | +$languageDefinition = New-Module { |
| 14 | + param() |
| 15 | + |
| 16 | + # Liquid files have a `.liquid` extension. |
| 17 | + $FilePattern = '\.liquid$' |
| 18 | + |
| 19 | + # Liquid Comments are `{% comment %}` and `{% endcomment %}`, respectively. |
| 20 | + $StartComment = "\{\%\s{1,}comment\s{1,}\%\}" |
| 21 | + $EndComment = "\{\%\s{1,}endcomment\s{1,}\%\}" |
| 22 | + |
| 23 | + # PipeScript exists within liquid as block encased in a pseudocomment. |
| 24 | + $StartPattern = "\{\%\s{1,}(?>pipescript|\{)" |
| 25 | + $EndPattern = "(?>pipescript|\})\s{1,}\%\}" |
| 26 | + |
| 27 | + $Website = 'https://shopify.github.io/liquid/' |
| 28 | + $ProjectURI = 'https://github.com/Shopify/liquid' |
| 29 | + $LanguageName = 'Liquid' |
| 30 | + Export-ModuleMember -Variable * -Function * -Alias * |
| 31 | +} -AsCustomObject |
| 32 | +$languageDefinition.pstypenames.clear() |
| 33 | +$languageDefinition.pstypenames.add("Language") |
| 34 | +$languageDefinition.pstypenames.add("Language.Liquid") |
| 35 | +$this.psobject.properties.add([PSNoteProperty]::new('Self',$languageDefinition)) |
| 36 | +} |
| 37 | +$this.Self |
| 38 | +} |
| 39 | + |
| 40 | + |
0 commit comments