resourcesAfter.ps1
<#
This is an example configuration file By default, it is enough to have a single one of them, however if you have enough configuration settings to justify having multiple copies of it, feel totally free to split them into multiple files. #> <# # Example Configuration Set-PSFConfig -Module 'EbookBuilder' -Name 'Example.Setting' -Value 10 -Initialize -Validation 'integer' -Handler { } -Description "Example configuration setting. Your module can then use the setting using 'Get-PSFConfigValue'" #> Set-PSFConfig -Module 'EbookBuilder' -Name 'Import.DoDotSource' -Value $false -Initialize -Validation 'bool' -Description "Whether the module files should be dotsourced on import. By default, the files of this module are read as string value and invoked, which is faster but worse on debugging." Set-PSFConfig -Module 'EbookBuilder' -Name 'Import.IndividualFiles' -Value $false -Initialize -Validation 'bool' -Description "Whether the module files should be imported individually. During the module build, all module code is compiled into few files, which are imported instead by default. Loading the compiled versions is faster, using the individual files is easier for debugging and testing out adjustments." <# # Example: Register-PSFTeppScriptblock -Name "EbookBuilder.alcohol" -ScriptBlock { 'Beer','Mead','Whiskey','Wine','Vodka','Rum (3y)', 'Rum (5y)', 'Rum (7y)' } #> <# # Example: Register-PSFTeppArgumentCompleter -Command Get-Alcohol -Parameter Type -Name EbookBuilder.alcohol #> New-PSFLicense -Product 'EbookBuilder' -Manufacturer 'Friedrich Weinmann' -ProductVersion $script:ModuleVersion -ProductType Module -Name MIT -Version "1.0.0.0" -Date (Get-Date "2018-09-18") -Text @" Copyright (c) 2018 Friedrich Weinmann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. "@ # Storage for block conversion logic $script:mdBlockTypes = @{ } Register-EBMarkdownBlock -Name bullet -Converter { param ($Data) [System.Text.StringBuilder]$sb = $Data.StringBuilder switch ($Data.Attributes.type) { 'simple' { $null = $sb.AppendLine('<ul>') foreach ($line in $Data.Lines) { $null = $sb.AppendLine("<li>$($line.Trim(" +") | ConvertFrom-MarkdownLine)</li>") } $null = $sb.AppendLine('</ul>') } default { $null = $sb.AppendLine('<table class="systemdata">') #region Create header if ($Data.Attributes.title) { $null = $sb.AppendLine('<tr>') $null = $sb.AppendLine("<th>$($Data.Attributes.title | ConvertFrom-MarkdownLine)</th>") $null = $sb.AppendLine('</tr>') } #endregion Create header $null = $sb.AppendLine('<tr>') $null = $sb.AppendLine('<td>') $null = $sb.AppendLine('<ul>') foreach ($line in $Data.Lines) { $null = $sb.AppendLine("<li>$($line.Trim(" +") | ConvertFrom-MarkdownLine)</li>") } $null = $sb.AppendLine('</ul>') $null = $sb.AppendLine('</td>') $null = $sb.AppendLine('</tr>') $null = $sb.AppendLine('</table>') } } # Create new firstpar $true } Register-EBMarkdownBlock -Name divide -Converter { param ($Data) [System.Text.StringBuilder]$sb = $Data.StringBuilder $null = $sb.AppendLine('<p class="divide">* * *</p>') # Create new firstpar $true } Register-EBMarkdownBlock -Name SystemMessage -Converter { param ($Data) [System.Text.StringBuilder]$sb = $Data.StringBuilder $null = $sb.AppendLine('<table class="systemmessage">') $null = $sb.AppendLine('<tr>') $string = $Data.Lines -join "<br/>" | ConvertFrom-MarkdownLine $null = $sb.AppendLine(('<td><p class="systemmessage">{0}</p></td>' -f $string)) $null = $sb.AppendLine('</tr>') $null = $sb.AppendLine('</table>') # Create new firstpar $true } Register-EBMarkdownBlock -Name table -Converter { param ($Data) [System.Text.StringBuilder]$sb = $Data.StringBuilder $null = $sb.AppendLine('<table class="systemdata">') #region Create header if ($Data.Attributes.title) { $null = $sb.AppendLine('<tr>') $null = $sb.AppendLine("<th>$($Data.Attributes.title | ConvertFrom-MarkdownLine)</th>") $null = $sb.AppendLine('</tr>') } #endregion Create header #region Creat Body foreach ($line in $Data.Lines) { $null = $sb.AppendLine('<tr>') switch ($Data.Attributes.Type) { #region Default markdown table 'markdown' { $entries = $line.Trim('|') -split '\|' foreach ($entry in $entries) { $null = $sb.AppendLine("<td>$($entry.Trim() | ConvertFrom-MarkdownLine)</td>") } } #endregion Default markdown table #region Default Table Style default { $entries = $line -split ":", 2 $null = $sb.AppendLine("<td>$($entries[0].Trim() | ConvertFrom-MarkdownLine)</td>") $null = $sb.AppendLine("<td>$($entries[1].Trim() | ConvertFrom-MarkdownLine)</td>") } #endregion Default Table Style } $null = $sb.AppendLine('</tr>') } #endregion Creat Body $null = $sb.AppendLine('</table>') # Create new firstpar $true } |