PSParseHTML.psm1

function Convert-InternalHTMLToText {
    [CmdletBinding()]
    param(
        [string] $Content
    )
    $Output = [NUglify.Uglify]::HtmlToText($Content)
    if ($Output.HasErrors) {
        Write-Warning "Convert-HTMLToText -Errors: $($Output.Errors)"
    }
    $Output.Code
}
function ConvertFrom-HTMLTableAgilityPack {
    [cmdletbinding()]
    param(
        [Uri] $Url,
        [string] $Content,
        [System.Collections.IDictionary] $ReplaceContent,
        [System.Collections.IDictionary] $ReplaceHeaders,
        [switch] $ReverseTable
    )
    Begin { }
    Process {
        if ($Content) {
            [HtmlAgilityPack.HtmlDocument] $HtmlDocument = [HtmlAgilityPack.HtmlDocument]::new()
            $HtmlDocument.LoadHtml($Content)
        } else {
            [HtmlAgilityPack.HtmlWeb] $HtmlWeb = [HtmlAgilityPack.HtmlWeb]::new()
            [HtmlAgilityPack.HtmlDocument] $HtmlDocument = $HtmlWeb.Load($url)
        }
        [Array] $Tables = $HtmlDocument.DocumentNode.SelectNodes("//table")


        [Array] $OutputTables = :table foreach ($table in $Tables) {
            $Rows = $table.SelectNodes('.//tr')
            if ($ReverseTable) {
                $Count = 0
                [Array] $TableContent = @(
                    $obj = [ordered] @{ }
                    $TableContent = foreach ($Row in $Rows) {
                        $Count++

                        #for ($x = 0; $x -lt $headers.count; $x++) {
                        # if ($($headers[$x])) {
                        # $obj["$($headers[$x])"] = $row.SelectNodes("th|td")[$x].InnerText.Trim()
                        [string] $CellHeader = $row.SelectNodes("th").InnerText
                        [string] $CellContent = $row.SelectNodes("td").InnerText
                        $CellContent = $CellContent.Trim()
                        if ($ReplaceContent) {
                            foreach ($Key in $ReplaceContent.Keys) {
                                $CellContent = $CellContent -replace $Key, $ReplaceContent.$Key
                            }
                        }
                        if ($CellHeader) {
                            $obj["$($CellHeader)"] = $CellContent
                        } else {
                            $obj["$Count"] = $CellContent
                        }
                        # } else {
                        # $obj["$x"] = $row.SelectNodes("th|td")[$x].InnerText.Trim()
                        # }
                        #}

                    }
                    #[PSCustomObject] $obj
                    $obj
                )
            } else {
                $Headers = foreach ($Row in $Rows[0]) {
                    foreach ($Cell in $row.SelectNodes("th|td")) {
                        $CellContent = $Cell.InnerText.Trim()
                        if ($ReplaceHeaders) {
                            foreach ($Key in $ReplaceHeaders.Keys) {
                                $CellContent = $CellContent -replace $Key, $ReplaceHeaders.$Key
                            }
                        }
                        $CellContent
                    }
                }
                $TableContent = foreach ($Row in $Rows | Select-Object -Skip 1) {
                    $obj = [ordered] @{ }
                    for ($x = 0; $x -lt $headers.count; $x++) {
                        if ($($headers[$x])) {
                            # $obj["$($headers[$x])"] = $row.SelectNodes("th|td")[$x].InnerText.Trim()
                            [string] $CellContent = $row.SelectNodes("th|td")[$x].InnerText
                            $CellContent = $CellContent.Trim()
                            if ($ReplaceContent) {
                                foreach ($Key in $ReplaceContent.Keys) {
                                    $CellContent = $CellContent -replace $Key, $ReplaceContent.$Key
                                }
                            }
                            $obj["$($headers[$x])"] = $CellContent
                        } else {
                            $obj["$x"] = $row.SelectNodes("th|td")[$x].InnerText.Trim()
                        }
                    }
                    [PSCustomObject] $obj
                }
            }
            @(, $TableContent)
        }
        $OutputTables
    }
    End { }
}
function ConvertFrom-HTMLTableAngle {
    [cmdletbinding()]
    param(
        [Uri] $Url,
        [string] $Content,
        [System.Collections.IDictionary] $ReplaceContent,
        [System.Collections.IDictionary] $ReplaceHeaders
    )
    Begin { }
    Process {
        if ($Url) {
            $Content = (Invoke-WebRequest -Uri $Url).Content
        }
        if (-not $Content) {
            return
        }
        # Initialize the parser
        $HTMLParser = [AngleSharp.Html.Parser.HtmlParser]::new()
        # Load the html
        $ParsedDocument = $HTMLParser.ParseDocument($Content)

        # Get all the tables
        [Array] $Tables = $ParsedDocument.GetElementsByTagName('table')

        # For each table
        :table foreach ($table in $tables) {
            [Array] $headers = foreach ($_ in $Table.Rows[0].Cells) {
                $CellContent = $_.TextContent.Trim()
                if ($ReplaceHeaders) {
                    foreach ($Key in $ReplaceHeaders.Keys) {
                        $CellContent = $CellContent -replace $Key, $ReplaceHeaders.$Key
                    }
                }
                $CellContent
            }

            # if headers have value
            if ($Headers.Count -ge 1) {
                [Array] $output = foreach ($row in $table.Rows | Select-Object -Skip 1) {

                    $obj = [ordered]@{ }
                    # add all the properties, one per row
                    for ($x = 0; $x -lt $headers.count; $x++) {
                        if ($($headers[$x])) {
                            if ($row.Cells[$x].TextContent) {
                                $CellContent = $row.Cells[$x].TextContent.Trim()
                                if ($ReplaceContent) {
                                    foreach ($Key in $ReplaceContent.Keys) {
                                        $CellContent = $CellContent -replace $Key, $ReplaceContent.$Key
                                    }
                                }
                                $obj["$($headers[$x])"] = $CellContent
                            } else {
                                $obj["$($headers[$x])"] = $row.Cells[$x].TextContent
                            }
                        } else {
                            $obj["$x"] = $row.Cells[$x].TextContent #.Trim()
                        }
                    }
                    [PSCustomObject] $obj
                }
                # if there are any rows, output
                if ($output.count -ge 1) {
                    @(, $output)
                } else {
                    Write-Verbose 'ConvertFrom-HtmlTable - Table has no rows. Skipping'
                }
            }
        }
    }
    End { }
}
function Format-InternalCSS {
    [CmdletBinding()]
    param(
        [string] $Content
    )
    $CssParser = [AngleSharp.Css.Parser.CssParser]::new()
    $ParsedDocument = $CssParser.ParseStyleSheet($Content)
    $StringWriter = [System.IO.StringWriter]::new()
    $PrettyMarkupFormatter = [AngleSharp.Css.CssStyleFormatter]::new()
    $ParsedDocument.ToCss($StringWriter, $PrettyMarkupFormatter)
    $StringWriter.ToString()
}
function Format-InternalFormatWithUglify {
    [CmdletBinding()]
    param(
        [string] $Content,
        [string] $Indent = ' ',
        [NUglify.BlockStart] $BlockStartLine = [NUglify.BlockStart]::SameLine,
        [switch] $RemoveOptionalTags,
        [switch] $OutputTextNodesOnNewLine,
        [switch] $RemoveEmptyAttributes,
        [switch] $AlphabeticallyOrderAttributes,
        [switch] $RemoveEmptyBlocks,
        [switch] $RemoveComments,
        [switch] $IsFragment
    )
    $Settings = [NUglify.Html.HtmlSettings]::new()
    # HTML Settings
    if ($IsFragment) {
        $Settings.IsFragmentOnly = $true
    }
    # Keep first comment
    # $Pattern = "<!-- saved from url=\(0014\)about:internet -->"
    # $MOTW = [System.Text.RegularExpressions.Regex]::new($Pattern) #, [System.Text.RegularExpressions.RegexOptions]::MultiLine)
    # $Settings.KeepCommentsRegex.Add($MOTW)

    $Settings.RemoveOptionalTags = $RemoveOptionalTags.IsPresent
    $Settings.PrettyPrint = $true
    $Settings.Indent = $Indent
    $Settings.OutputTextNodesOnNewLine = $OutputTextNodesOnNewLine.IsPresent # option to not indent textnodes when theyre the only child
    $Settings.RemoveEmptyAttributes = $RemoveEmptyAttributes.IsPresent
    $Settings.AlphabeticallyOrderAttributes = $AlphabeticallyOrderAttributes.IsPresent
    $Settings.RemoveComments = $RemoveComments
    $Settings.RemoveQuotedAttributes = $false
    #$Settings.LineTerminator = [System.Environment]::NewLine
    # JS Settings
    $Settings.JsSettings.MinifyCode = $true
    $Settings.JsSettings.OutputMode = [NUglify.OutputMode]::MultipleLines
    $Settings.JsSettings.Indent = $Indent
    $Settings.JsSettings.BlocksStartOnSameLine = $BlockStartLine
    $Settings.JsSettings.PreserveFunctionNames = $true
    $Settings.JsSettings.LocalRenaming = [NUglify.JavaScript.LocalRenaming]::KeepAll
    #$Settings.JsSettings.EvalTreatment = [NUglify.JavaScript.EvalTreatment]::Ignore
    #$Settings.JsSettings.Format = [NUglify.JavaScript.JavaScriptFormat]::Normal
    $Settings.JsSettings.NoAutoRenameList = $true
    $Settings.JsSettings.PreserveFunctionNames = $true
    #$Settings.JsSettings.CollapseToLiteral = $true
    #$Settings.JsSettings.ConstStatementsMozilla = $true
    #$Settings.JsSettings.LineBreakThreshold = 50
    $Settings.JsSettings.ReorderScopeDeclarations = $false
    #$Settings.JsSettings.RenamePairs = $false
    #$Settings.JsSettings.QuoteObjectLiteralProperties = $true
    $Settings.JsSettings.TermSemicolons = $true
    #$Settings.JsSettings.Format = [NUglify.JavaScript.JavaScriptFormat]::Normal
    $Settings.JsSettings.RemoveUnneededCode = $false;
    $Settings.JsSettings.RemoveFunctionExpressionNames = $false;
    # $Settings.NoAutoRenameCollection # ReadOnly
    #$Settings.JsSettings.LineTerminator = "`r`n"
    # CSS Settings
    $Settings.CssSettings.OutputMode = [NUglify.OutputMode]::MultipleLines
    $Settings.CssSettings.Indent = $Indent
    $Settings.CssSettings.BlocksStartOnSameLine = $BlockStartLine
    $Settings.CssSettings.RemoveEmptyBlocks = $RemoveEmptyBlocks
    $Settings.CssSettings.DecodeEscapes = $false
    #$Settings.CssSettings.LineTerminator = "`r`n"
    [NUglify.Uglify]::Html($Content, $Settings).Code
}

function Format-InternalHTML {
    [CmdletBinding()]
    param(
        [string] $Content
    )
    $HTMLParser = [AngleSharp.Html.Parser.HtmlParser]::new()
    $ParsedDocument = $HTMLParser.ParseDocument($Content)
    $StringWriter = [System.IO.StringWriter]::new()
    $PrettyMarkupFormatter = [AngleSharp.Html.PrettyMarkupFormatter]::new()
    $ParsedDocument.ToHtml($StringWriter, $PrettyMarkupFormatter)
    $StringWriter.ToString()
}
function Format-InternalJS {
    [CmdletBinding()]
    param(
        [string] $Content,
        [int] $IndentSize = 4,
        [string] $IndentChar = ' ',
        [bool] $IndentWithTabs = $false,
        [bool] $PreserveNewlines = $true,
        [double] $MaxPreserveNewlines = 10.0,
        [bool] $JslintHappy = $false,
        [Jsbeautifier.BraceStyle] $BraceStyle = [Jsbeautifier.BraceStyle]::Collapse,
        [bool] $KeepArrayIndentation = $false,
        [bool] $KeepFunctionIndentation = $false,
        [bool] $EvalCode = $false,
        #[int] $WrapLineLength = 0,
        [bool] $BreakChainedMethods = $false
    )
    $Jsbeautifier = [Jsbeautifier.Beautifier]::new()
    $Jsbeautifier.Opts.IndentSize = $IndentSize
    $Jsbeautifier.Opts.IndentChar = $IndentChar
    $Jsbeautifier.Opts.IndentWithTabs = $IndentWithTabs
    $Jsbeautifier.Opts.PreserveNewlines = $PreserveNewlines
    $Jsbeautifier.Opts.MaxPreserveNewlines = $MaxPreserveNewlines
    $Jsbeautifier.Opts.JslintHappy = $JslintHappy
    $Jsbeautifier.Opts.BraceStyle = $BraceStyle
    $Jsbeautifier.Opts.KeepArrayIndentation = $KeepArrayIndentation
    $Jsbeautifier.Opts.KeepFunctionIndentation = $KeepFunctionIndentation
    $Jsbeautifier.Opts.EvalCode = $EvalCode
    #$Jsbeautifier.Opts.WrapLineLength = $WrapLineLength
    $Jsbeautifier.Opts.BreakChainedMethods = $BreakChainedMethods

    #$Jsbeautifier.Flags
    <#
    public BeautifierFlags(string mode)
    {
        PreviousMode = "BLOCK";
        Mode = mode;
        VarLine = false;
        VarLineTainted = false;
        VarLineReindented = false;
        InHtmlComment = false;
        IfLine = false;
        ChainExtraIndentation = 0;
        InCase = false;
        InCaseStatement = false;
        CaseBody = false;
        IndentationLevel = 0;
        TernaryDepth = 0;
    }
    #>

    $FormattedJS = $Jsbeautifier.Beautify($Content)
    $FormattedJS
}
function Format-InternalUglifyJS {
    [CmdletBinding()]
    param(
        [string] $Content
    )
    $Settings = [NUglify.JavaScript.CodeSettings]::new()
    $Settings.MinifyCode = $true
    $Settings.OutputMode = [NUglify.OutputMode]::MultipleLines
    $Settings.Indent = $Indent
    $Settings.LocalRenaming = [NUglify.JavaScript.LocalRenaming]::KeepAll
    #$Settings.EvalTreatment = [NUglify.JavaScript.EvalTreatment]::Ignore
    #$Settings.Format = [NUglify.JavaScript.JavaScriptFormat]::Normal
    $Settings.Indent = ' '
    $Settings.NoAutoRenameList = $true
    $Settings.PreserveFunctionNames = $true
    # $Settings.NoAutoRenameCollection # ReadOnly
    [NUglify.Uglify]::Js($Content, $Code).Code
}
function Optimize-InternalCSS {
    [CmdletBinding()]
    param(
        [string] $Content
    )
    $CSSParser = [AngleSharp.Css.Parser.CssParser]::new()
    $ParsedDocument = $CSSParser.ParseStyleSheet($Content)
    $StringWriter = [System.IO.StringWriter]::new()
    $PrettyMarkupFormatter = [AngleSharp.Css.MinifyStyleFormatter]::new()
    $ParsedDocument.ToCss($StringWriter, $PrettyMarkupFormatter)
    $StringWriter.ToString()
}
function Optimize-InternalUglifyCSS {
    [CmdletBinding()]
    param(
        [string] $Content
    )
    $Settings = [NUglify.Css.CssSettings]::new()
    $Settings.DecodeEscapes = $false
    [NUglify.Uglify]::Css($Content, $Settings).Code
}
function Optimize-InternalUglifyHTML {
    [CmdletBinding()]
    param(
        [string] $Content,
        [switch] $CSSDecodeEscapes
    )

    $Settings = [NUglify.Html.HtmlSettings]::new()
    $Settings.RemoveOptionalTags = $false
    $Settings.CssSettings.DecodeEscapes = $CSSDecodeEscapes.IsPresent
    # Keep first comment
    #$Pattern = "<!-- saved from url=\(0014\)about:internet -->"
    #$Pattern = "^\ssaved\sfrom\url="
    #$MOTW = [System.Text.RegularExpressions.Regex]::new($Pattern, [System.Text.RegularExpressions.RegexOptions]::MultiLine)
    #$Settings.KeepCommentsRegex.Add($MOTW)

    if ($Content -like "*<!-- saved from url=(0014)about:internet -->*") {
        $MOTW = "<!-- saved from url=(0014)about:internet -->"
    } else {
        $MOTW = ''
    }
    $Settings.RemoveComments = $true
    $Output = [NUglify.Uglify]::Html($Content, $Settings).Code
    if ($MOTW) {
        $MOTW + [System.Environment]::NewLine + $Output
    } else {
        $Output
    }
}

<# $Settings
AttributesCaseSensitive : False
CollapseWhitespaces : True
RemoveComments : True
RemoveOptionalTags : False
RemoveInvalidClosingTags : True
RemoveEmptyAttributes : True
RemoveQuotedAttributes : True
DecodeEntityCharacters : True
AttributeQuoteChar :
RemoveScriptStyleTypeAttribute : True
ShortBooleanAttribute : True
IsFragmentOnly : False
MinifyJs : True
JsSettings : NUglify.JavaScript.CodeSettings
MinifyCss : True
MinifyCssAttributes : True
CssSettings : NUglify.Css.CssSettings
PrettyPrint : False
RemoveJavaScript : False
InlineTagsPreservingSpacesAround : {[a, True], [abbr, True], [acronym, True], [b, True]...}
KeepOneSpaceWhenCollapsing : False
TagsWithNonCollapsableWhitespaces : {[pre, True], [textarea, True]}
KeepCommentsRegex : {^!, ^/?ko(?:[\s\-]|$)}
KeepTags : {}
RemoveAttributes : {}
AlphabeticallyOrderAttributes : False
#>


<# $Settings.JsSettings
 
HasRenamePairs : False
RenamePairs :
NoAutoRenameCollection : {$super}
NoAutoRenameList : $super
KnownGlobalCollection : {}
KnownGlobalNamesList :
DebugLookupCollection : {}
DebugLookupList :
AlwaysEscapeNonAscii : False
AmdSupport : False
CollapseToLiteral : True
ConstStatementsMozilla : False
ErrorIfNotInlineSafe : False
EvalLiteralExpressions : True
EvalTreatment : Ignore
Format : Normal
IgnoreConditionalCompilation : False
IgnorePreprocessorDefines : False
InlineSafeStrings : True
LocalRenaming : CrunchAll
MacSafariQuirks : True
MinifyCode : True
ManualRenamesProperties : True
PreprocessOnly : False
PreserveFunctionNames : False
PreserveImportantComments : True
QuoteObjectLiteralProperties : False
ReorderScopeDeclarations : True
RemoveFunctionExpressionNames : True
RemoveUnneededCode : True
ScriptVersion : None
SourceMode : Program
StrictMode : False
StripDebugStatements : True
SymbolsMap :
WarningLevel : 0
AllowEmbeddedAspNetBlocks : False
BlocksStartOnSameLine : NewLine
IgnoreAllErrors : False
IndentSize : 4
LineBreakThreshold : 2147482647
OutputMode : SingleLine
TermSemicolons : False
KillSwitch : 0
LineTerminator :
 
IgnoreErrorCollection : {}
IgnoreErrorList :
PreprocessorValues : {}
PreprocessorDefineList :
ResourceStrings : {}
ReplacementTokens : {}
ReplacementFallbacks : {}
#>


<# $Settings.CssSettings
ColorNames : Hex
CommentMode : Important
MinifyExpressions : True
CssType : FullStyleSheet
RemoveEmptyBlocks : True
FixIE8Fonts : True
ExcludeVendorPrefixes : {}
IgnoreRazorEscapeSequence : False
DecodeEscapes : True
WarningLevel : 0
AllowEmbeddedAspNetBlocks : False
BlocksStartOnSameLine : NewLine
IgnoreAllErrors : False
IndentSize : 4
LineBreakThreshold : 2147482647
OutputMode : SingleLine
TermSemicolons : False
KillSwitch : 0
LineTerminator :
 
IgnoreErrorCollection : {}
IgnoreErrorList :
PreprocessorValues : {}
PreprocessorDefineList :
ResourceStrings : {}
ReplacementTokens : {}
ReplacementFallbacks : {}
#>

function Optimize-InternalUglifyJS {
    [CmdletBinding()]
    param(
        [string] $Content,
        [string] $Indent = ' '
    )
    #$Settings = [NUglify.JavaScript.CodeSettings]::new()
    #$Settings.MinifyCode = $true
    #$Settings.OutputMode = [NUglify.OutputMode]::MultipleLines
    #$Settings.Indent = $Indent
    #$Settings.JsSettings.MinifyCode = $true
    #$Settings.JsSettings.OutputMode = [NUglify.OutputMode]::MultipleLines
    #$Settings.JsSettings.Indent = $Indent
    #$Settings.JsSettings.BlocksStartOnSameLine = $BlockStartLine
    [NUglify.Uglify]::Js($Content).Code
}
function Convert-HTMLToText {
    [CmdletBinding()]
    param(
        [string] $File,
        [string] $OutputFile,
        [string] $Content
    )
    # Load from file or text
    if ($File) {
        if (Test-Path -LiteralPath $File) {
            $Content = [IO.File]::ReadAllText($File)
        } else {
            Write-Warning "Convert-HTMLToText - File doesn't exists"
            return
        }
    } elseif ($Content) {

    } else {
        Write-Warning 'Convert-HTMLToText - No choice file or Content. Termninated.'
        return
    }

    $Output = Convert-InternalHTMLToText -Content $Content

    # Output to file or to text
    if ($OutputFile) {
        [IO.File]::WriteAllText($OutputFile, $Output)
    } else {
        $Output
    }
}
function ConvertFrom-HTMLAttributes {
    [alias('ConvertFrom-HTMLTag', 'ConvertFrom-HTMLClass')]
    [cmdletbinding()]
    param (
        [Parameter(Mandatory = $true)][Array] $Content,
        [string] $Tag,
        [string] $Class,
        [string] $Id,
        [string] $Name,
        [switch] $ReturnObject
    )
    Begin {
        # Initialize the parser
        $HTMLParser = [AngleSharp.Html.Parser.HtmlParser]::new()
    }
    Process {
        # Load the html
        $ParsedDocument = $HTMLParser.ParseDocument($content)
        # Get all the tables
        if ($Tag) {
            [Array] $OutputContent = $ParsedDocument.GetElementsByTagName($Tag)
        } elseif ($Class) {
            [Array] $OutputContent = $ParsedDocument.GetElementsByClassName($Class)
        } elseif ($Id) {
            [Array] $OutputContent = $ParsedDocument.GetElementById($Id)
        } elseif ($Name) {
            [Array] $OutputContent = $ParsedDocument.GetElementsByName($Name)
        }
        if ($OutputContent) {
            if ($ReturnObject) {
                $OutputContent
            } else {
                $OutputContent.TextContent
            }
        }
    }
    End { }
}
Function ConvertFrom-HtmlTable {
    [cmdletbinding()]
    param (
        [Parameter(Mandatory, ParameterSetName = 'Content', ValueFromPipeline, ValueFromPipelineByPropertyName)][string]$Content,
        [alias('Uri')][Parameter(Mandatory, ParameterSetName = 'Uri')][Uri] $Url,
        [System.Collections.IDictionary] $ReplaceContent,
        [System.Collections.IDictionary] $ReplaceHeaders,
        [ValidateSet('AngleSharp', 'AgilityPack')] $Engine,
        [switch] $ReverseTable
    )
    Begin {
        # This fixes an issue https://github.com/PowerShell/PowerShell/issues/11287 for ConvertTo-HTML
        $HeadersReplacement = [ordered] @{ '\*' = ''; }
        if (-not $ReplaceHeaders) {
            $ReplaceHeaders = [ordered] @{ }
        }
        foreach ($Key in $HeadersReplacement.Keys) {
            $ReplaceHeaders["$Key"] = $HeadersReplacement.$Key
        }
    }
    Process {
        if ($Engine -eq 'AngleSharp' -and -not $ReverseTable) {
            ConvertFrom-HTMLTableAngle -Url $Url -Content $Content -ReplaceHeaders $ReplaceHeaders -ReplaceContent $ReplaceContent
        } else {
            ConvertFrom-HTMLTableAgilityPack -Url $url -Content $Content -ReplaceHeaders $ReplaceHeaders -ReplaceContent $ReplaceContent -ReverseTable:$ReverseTable
        }
    }
    End { }
}
function Format-CSS {
    [CmdletBinding()]
    param(
        [string] $File,
        [string] $OutputFile,
        [string] $Content
    )
    # Load from file or text
    if ($File) {
        if (Test-Path -LiteralPath $File) {
            $Content = [IO.File]::ReadAllText($File)
        } else {
            Write-Warning "Format-CSS - File doesn't exists"
            return
        }
    } elseif ($Content) {

    } else {
        Write-Warning 'Format-CSS - No choice file or Content. Termninated.'
        return
    }

    $Output = Format-InternalCSS -Content $Content
    #$Content = "<style>$Content</style>"
    #$Output = Format-InternalFormatWithUglify -Content $Content -IsFragment

    # Output to file or to text
    if ($OutputFile) {
        [IO.File]::WriteAllText($OutputFile, $Output)
    } else {
        $Output
    }
}
function Format-HTML {
    [CmdletBinding()]
    param(
        [string] $File,
        [string] $OutputFile,
        [string] $Content,
        [string] $Indent = ' ',
        [NUglify.BlockStart] $BlockStartLine = [NUglify.BlockStart]::SameLine,
        [switch] $RemoveHTMLComments,
        [switch] $RemoveOptionalTags,
        [switch] $OutputTextNodesOnNewLine,
        [switch] $RemoveEmptyAttributes,
        [switch] $AlphabeticallyOrderAttributes,
        [switch] $RemoveEmptyBlocks
    )

    # Load from file or text
    if ($File) {
        if (Test-Path -LiteralPath $File) {
            $Content = [IO.File]::ReadAllText($File)
        } else {
            Write-Warning "Format-HTML - File doesn't exists"
            return
        }
    } elseif ($Content) {

    } else {
        Write-Warning 'Format-HTML - No choice file or Content. Termninated.'
        return
    }

    # Do the magic
    $formatInternalFormatWithUglifySplat = @{
        Content                       = $Content
        Indent                        = $Indent
        BlockStartLine                = $BlockStartLine
        OutputTextNodesOnNewLine      = $OutputTextNodesOnNewLine
        RemoveOptionalTags            = $RemoveOptionalTags
        RemoveEmptyAttributes         = $RemoveEmptyAttributes
        AlphabeticallyOrderAttributes = $AlphabeticallyOrderAttributes
        RemoveEmptyBlocks             = $RemoveEmptyBlocks
        RemoveComments                = $RemoveHTMLComments
        #IsFragment = $true
    }
    $Output = Format-InternalFormatWithUglify @formatInternalFormatWithUglifySplat

    # Output to file or to text
    if ($OutputFile) {
        [IO.File]::WriteAllText($OutputFile, $Output)
    } else {
        $Output
    }
}
function Format-JavaScript {
    [alias('Format-JS')]
    [CmdletBinding()]
    param(
        [string] $File,
        [string] $OutputFile,
        [alias('FileContent')][string] $Content
    )
    # Load from file or text
    if ($File) {
        if (Test-Path -LiteralPath $File) {
            $Content = [IO.File]::ReadAllText($File)
        } else {
            Write-Warning "Format-JavaScript - File doesn't exists"
            return
        }
    } elseif ($Content) {

    } else {
        Write-Warning 'Format-JavaScript - No choice file or Content. Termninated.'
        return
    }

    # For now don't want to give this as an option
    [int] $IndentSize = 4
    [string] $IndentChar = ' '
    [bool] $IndentWithTabs = $false
    [bool] $PreserveNewlines = $true
    [double] $MaxPreserveNewlines = 10.0
    [bool] $JslintHappy = $false
    [Jsbeautifier.BraceStyle] $BraceStyle = [Jsbeautifier.BraceStyle]::Collapse
    [bool] $KeepArrayIndentation = $false
    [bool] $KeepFunctionIndentation = $false
    [bool] $EvalCode = $false
    #[int] $WrapLineLength = 0
    [bool] $BreakChainedMethods = $false

    # do the magic
    $SplatJS = @{
        IndentSize              = $IndentSize
        IndentChar              = $IndentChar
        IndentWithTabs          = $IndentWithTabs
        PreserveNewlines        = $PreserveNewlines
        MaxPreserveNewlines     = $MaxPreserveNewlines
        JslintHappy             = $JslintHappy
        BraceStyle              = $BraceStyle
        KeepArrayIndentation    = $KeepArrayIndentation
        KeepFunctionIndentation = $KeepFunctionIndentation
        EvalCode                = $EvalCode
        #WrapLineLength = $WrapLineLength
        BreakChainedMethods     = $BreakChainedMethods
    }

    #$Output = Format-InternalJS -Content $Content @SplatJS
    $Output = Format-InternalUglifyJS -Content $Content
    if ($OutputFile) {
        [IO.File]::WriteAllText($OutputFile, $Output)
    } else {
        $Output
    }

    <#
    $IndentLenght = $Indent.Length
    $Content = "<script>$Content</script>"
    $Output = Format-InternalFormatWithUglify -Content $Content -IsFragment
    $SplitOutput = ($Output.Split("`n"))
    $NewOutput = for ($i = 1; $i -lt $SplitOutput.Count - 1; $i++) {
        $SplitOutput[$i].SubString($IndentLenght)
    }
    $FinalOutput = $NewOutput -join "`n"
    # Output to file or to text
    if ($OutputFile) {
        [IO.File]::WriteAllText($OutputFile, $FinalOutput)
    } else {
        $FinalOutput
    }
    #>

}
function Optimize-CSS {
    [CmdletBinding()]
    param(
        [string] $File,
        [string] $OutputFile,
        [string] $Content
    )
    # Load from file or text
    if ($File) {
        if (Test-Path -LiteralPath $File) {
            $Content = [IO.File]::ReadAllText($File)
        } else {
            Write-Warning "Optimize-CSS - File doesn't exists"
            return
        }
    } elseif ($Content) {

    } else {
        Write-Warning 'Optimize-CSS - No choice file or Content. Termninated.'
        return
    }

    # Do magic
    #$Output = Optimize-InternalCSS -Content $Content
    $Output = Optimize-InternalUglifyCSS -Content $Content

    # Output to file or to text
    if ($OutputFile) {
        [IO.File]::WriteAllText($OutputFile, $Output)
    } else {
        $Output
    }
}
function Optimize-HTML {
    [CmdletBinding()]
    param(
        [string] $File,
        [string] $OutputFile,
        [string] $Content,
        [switch] $CSSDecodeEscapes
    )
    # Load from file or text
    if ($File) {
        if (Test-Path -LiteralPath $File) {
            $Content = [IO.File]::ReadAllText($File)
        } else {
            Write-Warning "Optimize-HTML - File doesn't exists"
            return
        }
    } elseif ($Content) {

    } else {
        Write-Warning 'Optimize-HTML - No choice file or Content. Termninated.'
        return
    }

    # Do magic
    $Output = Optimize-InternalUglifyHTML -Content $Content -CSSDecodeEscapes:$CSSDecodeEscapes

    # Output to file or to text
    if ($OutputFile) {
        [IO.File]::WriteAllText($OutputFile, $Output)
    } else {
        $Output
    }
}
function Optimize-JavaScript {
    [CmdletBinding()]
    param(
        [string] $File,
        [string] $OutputFile,
        [string] $Content
    )
    # Load from file or text
    if ($File) {
        if (Test-Path -LiteralPath $File) {
            $Content = [IO.File]::ReadAllText($File)
        } else {
            Write-Warning "Optimize-JavaScript - File doesn't exists"
            return
        }
    } elseif ($Content) {

    } else {
        Write-Warning 'Optimize-JavaScript - No choice file or Content. Termninated.'
        return
    }
    $Output = Optimize-InternalUglifyJS -Content $Content

    # Output to file or to text
    if ($OutputFile) {
        [IO.File]::WriteAllText($OutputFile, $Output)
    } else {
        $Output
    }
}


if ($PSEdition -eq 'Core') {
    Add-Type -Path $PSScriptRoot\Lib\Standard\AngleSharp.Css.dll
    Add-Type -Path $PSScriptRoot\Lib\Standard\AngleSharp.dll
    Add-Type -Path $PSScriptRoot\Lib\Standard\HtmlAgilityPack.dll
    Add-Type -Path $PSScriptRoot\Lib\Standard\Jsbeautifier.dll
    Add-Type -Path $PSScriptRoot\Lib\Standard\NUglify.dll
    Add-Type -Path $PSScriptRoot\Lib\Standard\System.Text.Encoding.CodePages.dll
} else {
    Add-Type -Path $PSScriptRoot\Lib\Standard\AngleSharp.Css.dll
    Add-Type -Path $PSScriptRoot\Lib\Standard\AngleSharp.dll
    Add-Type -Path $PSScriptRoot\Lib\Standard\HtmlAgilityPack.dll
    Add-Type -Path $PSScriptRoot\Lib\Standard\Jsbeautifier.dll
    Add-Type -Path $PSScriptRoot\Lib\Standard\NUglify.dll
    Add-Type -Path $PSScriptRoot\Lib\Standard\System.Text.Encoding.CodePages.dll
}

Export-ModuleMember -Function @('ConvertFrom-HTMLAttributes', 'ConvertFrom-HtmlTable', 'Convert-HTMLToText', 'Format-CSS', 'Format-HTML', 'Format-JavaScript', 'Optimize-CSS', 'Optimize-HTML', 'Optimize-JavaScript') -Alias @('ConvertFrom-HTMLClass', 'ConvertFrom-HTMLTag', 'Format-JS')
# SIG # Begin signature block
# MIIdSQYJKoZIhvcNAQcCoIIdOjCCHTYCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUokawoxxRrMqA84arHTe9CU2C
# gsigghhnMIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0B
# AQUFADBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVk
# IElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQsw
# CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu
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