<commit_before><#
.SYNOPSIS
Creates the get-carbon.org website.

.DESCRIPTION
The `New-Website.ps1` script generates the get-carbon.org website. It uses the Silk module for Markdown to HTML conversion.
#>
[CmdletBinding()]
param(
)

#Requires -Version 4
Set-StrictMode -Version 'Latest'

function Out-HtmlPage
{
    param(
        [Parameter(Mandatory=$true,ValueFromPipeline=$true)]
        # The contents of the page.
        $Content,

        [Parameter(Mandatory=$true)]
        # The title of the page.
        $Title,

        [Parameter(Mandatory=$true)]
        # The path under the web root of the page.
        $VirtualPath,

        [Switch]
        # Include JQuery in the page.
        $JQuery
    )

    begin
    {
        Set-StrictMode -Version 'Latest'
    }

    process
    {

        $jQueryScriptTag = ''
        if( $JQuery )
        {
            $jQueryScriptTag = '<script src="/jquery-2.1.4.min.js"></script>{0}<script src="/helpindex.js"></script>' -f ([Environment]::NewLine)
        }

        $path = Join-Path -Path $webRoot -ChildPath $VirtualPath
        $templateArgs = @(
                            $Title,
                            $jQueryScriptTag,
                            $Content,
                            (Get-Date).Year
                        )
        @'
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>{0}</title>
	<link href="styles.css" type="text/css" rel="stylesheet" />
    {1}
</head>
<body>

    <ul id="SiteNav">
		<li><a href="/">Get-Carbon</a></li>
        <li><a href="https://bitbucket.org/splatteredbits/carbon/downloads">-Download</li>
		<li><a href="/help/index.html">-Documentation</a></li>
        <li><a href="/releasenotes.html">-ReleaseNotes</a></li>
		<li><a href="http://pshdo.com">-Blog</a></li>
    </ul>

    {2}

	<div class="Footer">
		Copyright &copy; 2012 - {3} <a href="http://pshdo.com"><NAME></a>.  All rights reserved.
	</div>

</body>
</html>
'@ -f $templateArgs | Set-Content -Path $path
    }

    end
    {
    }
}

& (Join-Path -Path $PSScriptRoot -ChildPath '.\Tools\Silk\Import-Silk.ps1' -Resolve)

& (Join-Path -Path $PSScriptRoot -ChildPath '.\Carbon\Import-Carbon.ps1' -Resolve)

$webRoot = Join-Path -Path $PSScriptRoot -ChildPath 'Website'
$cmdRoot = Join-Path -Path $webRoot -ChildPath 'help'
$tagsRoot = Join-Path -Path $webRoot -ChildPath 'tags'

$tagsJson = Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath 'tags.json') | ConvertFrom-Json
if( -not $tagsJson )
{
    return
}

$tags = @{ }

foreach( $item in $tagsJson )
{
    foreach( $tagName in $item.Tags )
    {
        if( -not $tags.ContainsKey( $tagName ) )
        {
            $tags[$tagName] = New-Object 'Collections.Generic.List[string]'
        }

        $tags[$tagName].Add( $item.Name )
    }
}

$tagCloud = $tags.Keys | Sort-Object | ForEach-Object { 

    $commands = $tags[$_] | ForEach-Object { '<li><a href="/help/{0}.html">{0}</a></li>' -f $_ }
@'
<h3>{0}</h3>

<ul>
    {1}
</ul>
'@ -f $_,($commands -join ([Environment]::NewLine))
}

$verbs = @{ }

$commands = Get-Command -Module 'Carbon' | Where-Object { $_.CommandType -ne 'Alias' } | Sort-Object -Property 'Name'
[int]$numCommands = $commands | Measure-Object | Select-Object -ExpandProperty 'Count'
$count = 0
foreach( $command in $commands )
{
    if( -not $verbs.ContainsKey( $command.Verb ) )
    {
        $verbs[$command.Verb] = New-Object 'Collections.Generic.List[string]'
    }
    $verbs[$command.Verb].Add( $command.Name )

    Write-Progress -Activity 'Generating Command HTML' -PercentComplete ($count / $numCommands * 100) -CurrentOperation $command.Name
    #Convert-HelpToHtml -Name $command.Name | Out-HtmlPage -Title ('PowerShell - {0} - Carbon' -f $command.Name) -VirtualPath ('/help/{0}.html' -f $command.Name)<commit_msg>Turning on command help generation.<commit_after><#
.SYNOPSIS
Creates the get-carbon.org website.

.DESCRIPTION
The `New-Website.ps1` script generates the get-carbon.org website. It uses the Silk module for Markdown to HTML conversion.
#>
[CmdletBinding()]
param(
)

#Requires -Version 4
Set-StrictMode -Version 'Latest'

function Out-HtmlPage
{
    param(
        [Parameter(Mandatory=$true,ValueFromPipeline=$true)]
        # The contents of the page.
        $Content,

        [Parameter(Mandatory=$true)]
        # The title of the page.
        $Title,

        [Parameter(Mandatory=$true)]
        # The path under the web root of the page.
        $VirtualPath,

        [Switch]
        # Include JQuery in the page.
        $JQuery
    )

    begin
    {
        Set-StrictMode -Version 'Latest'
    }

    process
    {

        $jQueryScriptTag = ''
        if( $JQuery )
        {
            $jQueryScriptTag = '<script src="/jquery-2.1.4.min.js"></script>{0}<script src="/helpindex.js"></script>' -f ([Environment]::NewLine)
        }

        $path = Join-Path -Path $webRoot -ChildPath $VirtualPath
        $templateArgs = @(
                            $Title,
                            $jQueryScriptTag,
                            $Content,
                            (Get-Date).Year
                        )
        @'
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>{0}</title>
	<link href="styles.css" type="text/css" rel="stylesheet" />
    {1}
</head>
<body>

    <ul id="SiteNav">
		<li><a href="/">Get-Carbon</a></li>
        <li><a href="https://bitbucket.org/splatteredbits/carbon/downloads">-Download</li>
		<li><a href="/help/index.html">-Documentation</a></li>
        <li><a href="/releasenotes.html">-ReleaseNotes</a></li>
		<li><a href="http://pshdo.com">-Blog</a></li>
    </ul>

    {2}

	<div class="Footer">
		Copyright &copy; 2012 - {3} <a href="http://pshdo.com"><NAME></a>.  All rights reserved.
	</div>

</body>
</html>
'@ -f $templateArgs | Set-Content -Path $path
    }

    end
    {
    }
}

& (Join-Path -Path $PSScriptRoot -ChildPath '.\Tools\Silk\Import-Silk.ps1' -Resolve)

& (Join-Path -Path $PSScriptRoot -ChildPath '.\Carbon\Import-Carbon.ps1' -Resolve)

$webRoot = Join-Path -Path $PSScriptRoot -ChildPath 'Website'
$cmdRoot = Join-Path -Path $webRoot -ChildPath 'help'
$tagsRoot = Join-Path -Path $webRoot -ChildPath 'tags'

$tagsJson = Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath 'tags.json') | ConvertFrom-Json
if( -not $tagsJson )
{
    return
}

$tags = @{ }

foreach( $item in $tagsJson )
{
    foreach( $tagName in $item.Tags )
    {
        if( -not $tags.ContainsKey( $tagName ) )
        {
            $tags[$tagName] = New-Object 'Collections.Generic.List[string]'
        }

        $tags[$tagName].Add( $item.Name )
    }
}

$tagCloud = $tags.Keys | Sort-Object | ForEach-Object { 

    $commands = $tags[$_] | ForEach-Object { '<li><a href="/help/{0}.html">{0}</a></li>' -f $_ }
@'
<h3>{0}</h3>

<ul>
    {1}
</ul>
'@ -f $_,($commands -join ([Environment]::NewLine))
}

$verbs = @{ }

$commands = Get-Command -Module 'Carbon' | Where-Object { $_.CommandType -ne 'Alias' } | Sort-Object -Property 'Name'
[int]$numCommands = $commands | Measure-Object | Select-Object -ExpandProperty 'Count'
$count = 0
foreach( $command in $commands )
{
    if( -not $verbs.ContainsKey( $command.Verb ) )
    {
        $verbs[$command.Verb] = New-Object 'Collections.Generic.List[string]'
    }
    $verbs[$command.Verb].Add( $command.Name )

    Write-Progress -Activity 'Generating Command HTML' -PercentComplete ($count / $numCommands * 100) -CurrentOperation $command.Name
    Convert-HelpToHtml -Name $command.Name | Out-HtmlPage -Title ('PowerShell - {0} - Carbon' -f $command.Name) -VirtualPath ('/help/{0}.html' -f $command.Name)
{'fraction_non_alphanumeric': 0.17330754352030947, 'fraction_numerical': 0.008768536428110896, 'mean_word_length': 2.51268115942029, 'pattern_counts': {'":': 0, '<': 101, '<?xml version=': 0, '>': 101, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5062227', 'n_tokens_mistral': 2751, 'n_tokens_neox': 2641, 'n_words': 565}