Functions/Public/pre.ps1
Function pre { <# .SYNOPSIS Create a pre tag in an HTML document. .EXAMPLE pre .EXAMPLE pre -Content @" whatever it is you ne ed "@ .EXAMPLE pre -class "classy" -style "stylish" -Content @" whatever it is you ne ed "@ .NOTES Current version 1.0 History: 2018.10.02:bateskevin; Updated to v2 2018.04.01;bateskevin;Creation. .LINK https://github.com/Stephanevg/PSHTML #> [Cmdletbinding()] Param( [Parameter(Mandatory=$true)] [AllowEmptyString()] [AllowNull()] [String] $Content, [AllowEmptyString()] [AllowNull()] [String]$Class="", [String]$Id, [AllowEmptyString()] [AllowNull()] [String]$Style, [String]$title, [Hashtable]$Attributes ) Process { $CommonParameters = @('tagname') + [System.Management.Automation.PSCmdlet]::CommonParameters + [System.Management.Automation.PSCmdlet]::OptionalCommonParameters $CustomParameters = $PSBoundParameters.Keys | ? { $_ -notin $CommonParameters } $htmltagparams = @{} $tagname = "pre" if ($CustomParameters) { foreach ($entry in $CustomParameters) { if ($entry -eq "content") { $htmltagparams.$entry = $PSBoundParameters[$entry] } else { $htmltagparams.$entry = "{0}" -f $PSBoundParameters[$entry] } } if ($Attributes) { $htmltagparams += $Attributes } } Set-HtmlTag -TagName $tagname -Attributes $htmltagparams -TagType nonVoid } } |