feat: импорт старых постов ckc-gel.blogspot.com — 95 черновиков (draft: true)
deploy-dedinit / Build & SFTP Deploy (push) Successful in 5m15s

This commit is contained in:
2026-10-04 19:01:00 +00:00
parent 0f36735f81
commit 890207d707
291 changed files with 7507 additions and 0 deletions
@@ -0,0 +1,33 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 400" width="100%" height="auto">
<rect width="1200" height="400" fill="#0a0c10"/>
<!-- Hexagon pattern -->
<g stroke="#1a2332" stroke-width="1" fill="none" opacity="0.5">
<polygon points="100,100 130,80 160,100 160,140 130,160 100,140"/>
<polygon points="250,100 280,80 310,100 310,140 280,160 250,140"/>
<polygon points="400,100 430,80 460,100 460,140 430,160 400,140"/>
<polygon points="550,100 580,80 610,100 610,140 580,160 550,140"/>
<polygon points="700,100 730,80 760,100 760,140 730,160 700,140"/>
<polygon points="850,100 880,80 910,100 910,140 880,160 850,140"/>
<polygon points="1000,100 1030,80 1060,100 1060,140 1030,160 1000,140"/>
<polygon points="175,160 205,140 235,160 235,200 205,220 175,200"/>
<polygon points="325,160 355,140 385,160 385,200 355,220 325,200"/>
<polygon points="475,160 505,140 535,160 535,200 505,220 475,200"/>
<polygon points="625,160 655,140 685,160 685,200 655,220 625,200"/>
<polygon points="775,160 805,140 835,160 835,200 805,220 775,200"/>
<polygon points="925,160 955,140 985,160 985,200 955,220 925,200"/>
<polygon points="1075,160 1105,140 1135,160 1135,200 1105,220 1075,200"/>
</g>
<!-- Center text -->
<text x="600" y="175" font-family="monospace" font-size="36" fill="#58a6ff" text-anchor="middle" font-weight="bold">
Формирование HTML из Pow
</text>
<text x="600" y="215" font-family="monospace" font-size="20" fill="#8b949e" text-anchor="middle">
2017-11-04 · blog
</text>
<!-- Decor line -->
<line x1="200" y1="250" x2="1000" y2="250" stroke="#30363d" stroke-width="1"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

@@ -0,0 +1,173 @@
---
date: '2017-11-04T18:03:00+03:00'
lastmod: '2017-11-04T18:03:00+03:00'
draft: true
title: 'Формирование HTML из Powershell кода в ISE'
slug: 'formirovanie-html-iz-powershell-koda-v-ise'
categories:
- 'powershell'
tags:
- 'blog'
cover:
image: "hero.svg"
alt: "Формирование HTML из Powershell кода в ISE"
---
![](img-1.jpg)
Увидел как убого выглядит вставляемый код и поискал способ для формирования расцвеченного HTML кода для вставки в статьи блога. Поскольку я использую Powershell совсем не часто, то функционала стандартного ISE мне выше крыши. Так что первым делом попытался найти способ сделать это из этого инструмента.
Нашёл хорошую статью на wiki technet [Wiki: Как вставить отформатированный код сценария PowerShell в TechNet Wiki.](https://social.technet.microsoft.com/wiki/ru-ru/contents/articles/20783.wiki-powershell-technet-wiki.aspx) Но увы PowerShellPack уже вышел в тираж.
Зато на той же wiki нашёл [страницу с дополнениями](https://social.technet.microsoft.com/wiki/contents/articles/2969.windows-powershell-ise-add-on-tools.aspx) для самого ISE. Одним из которых был [Copy As HTML Add-On](http://blog.falchionconsulting.com/index.php/tag/ise/). Удобная штука с собственным установщиком. Пришлось правда использовать set-executionpolicy, но это и так пришлось бы делать. [Схоронил](https://yadi.sk/d/6WQZyMbw3PQfkg) у себя этот архивчик.
В статью Блогера код вставляется в режиме HTML. И выглядит один-в-один как в редакторе:
$path = "d:\temp\"
$files = Get-ChildItem $path
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $false
$excel.DisplayAlerts = $false
$Summary = @()
foreach ($file in $files) {
     #Открываем каждый из полученных файлов
    $excel.Workbooks.Open($file.fullname) | Out-Null
    [int] $Year = "20" +$File.name.substring($file.name.Length - 6,2);
    [int] $Month = $file.name.substring($file.name.Length - 9,2);
    Write-Host "Open file: " $file.FullName "; Year = " $Year "; Month = " $month
    #Получаем перечень с именами листов длиной менее трёх символов - листы с данными по дням имеют имена в два символа
    $Sheets = $excel.worksheets | where {$_.Name.length -lt 3}
    $plan = 0
    $fact = 0
    #Для каждого из полученных листов в файле проводим разбор
    foreach ($Sheet in $Sheets)  {
        [int] $Day = $Sheet.Name
        for ($Col = 7; $Col -le 8; $Col++) {
            For ($Row =14; $Row -le 16; $Row++) {
                if ($sheet.cells.item($Row, $Col).Value2 -eq "Койко/мест") {
                    #Write-host $year $Month $Day "-" $Col ":" $Row  = "YES!"
                    #Write-Host "Day = " $Day "; Fact Value = " $sheet.cells.item($Row, $Col + 2).Value2 "; PlanValue = " $sheet.cells.item($Row + 1, $Col + 2).Value2
                    #$DataDay = New-Object PsObject
                    #$DataDay | Add-Member -MemberType noteproperty -Name Year -Value $Year
                    #$DataDay | Add-Member -MemberType noteproperty -Name Month -Value $Month
                    #$DataDay | Add-Member -MemberType noteproperty -Name Day -Value $Day
                    #$DataDay | Add-Member -MemberType noteproperty -Name FactValue -Value $sheet.cells.item($Row, $Col + 2).Value2
                    #$DataDay | Add-Member -MemberType noteproperty -Name PlanValue -Value $sheet.cells.item($Row + 1, $Col + 2).Value2
                    #$Summary += $DataDay
                    $plan +=$sheet.cells.item($Row + 1, $Col + 2).Value2
                    $fact +=$sheet.cells.item($Row, $Col + 2).Value2
                }
            }
        }
    }
                $DateMonth = New-Object PsObject
                    $DateMonth | Add-Member -MemberType noteproperty -Name Year -Value $Year
                    $DateMonth | Add-Member -MemberType noteproperty -Name Month -Value $Month
                    $DateMonth | Add-Member -MemberType noteproperty -Name FactValue -Value $Fact
                    $DateMOnth | Add-Member -MemberType noteproperty -Name PlanValue -Value $Plan
            $Summary += $DateMonth
}
$Summary | Out-GridView
#$table = @()
#   for ($i=2010; $i -le 2011; $i++) {
#        For ($j = 1; $j -le 12; $j++) {
#            $temp = $summary | where {$_.Month = $j} | where {$_.Year = $i}
#            $Fact = 0
#            $Plan = 0
#            foreach ($t in $temp) {
#                $fact += $t.FactValue
#                $plan += $t.PlanValue
#            }
#
#            $DateMonth = New-Object PsObject
#                    $DataMonth | Add-Member -MemberType noteproperty -Name Year -Value $Year
#                    $DataMonth | Add-Member -MemberType noteproperty -Name Month -Value $Month
#                    $DataMonth | Add-Member -MemberType noteproperty -Name FactValue -Value $Fact
#                    $DataMOnth | Add-Member -MemberType noteproperty -Name PlanValue -Value $Plan
#            $table += $dateMonth
#        }
#
#    }