Skip to content

Commit

Permalink
feat: Porting Razor Template to Language Function (Fixes #620)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Nov 12, 2023
1 parent 3332e64 commit 9e2b030
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 69 deletions.
28 changes: 28 additions & 0 deletions Commands/Languages/Razor/Razor-Language.ps.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Language function Razor {
<#
.SYNOPSIS
Razor Template Transpiler.
.DESCRIPTION
Allows PipeScript to generate Razor.
Multiline comments blocks like this ```<!--{}-->``` will be treated as blocks of PipeScript.
JavaScript/CSS comment blocks like ```/*{}*/``` will also be treated as blocks of PipeScript.
Razor comment blocks like ```@*{}*@``` will also be treated as blocks of PipeScript.
#>
[ValidatePattern('\.(cshtml|razor)$')]
param(
)


# We start off by declaring a number of regular expressions:
$startComment = '(?><\!--|/\*|\@\*)'
$endComment = '(?>-->|\*/|\*@)'
$Whitespace = '[\s\n\r]{0,}'
# * StartPattern ```$StartComment + '{' + $Whitespace```
$startPattern = "(?<PSStart>${startComment}\{$Whitespace)"
# * EndPattern ```$whitespace + '}' + $EndComment```
$endPattern = "(?<PSEnd>$Whitespace\}${endComment}\s{0,})"

}
69 changes: 0 additions & 69 deletions Transpilers/Templates/Razor.Template.psx.ps1

This file was deleted.

0 comments on commit 9e2b030

Please sign in to comment.