From 2f260ddb7f4fa721b40fad1bbf695f5c3817c72d Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 8 Feb 2026 18:22:13 +0300 Subject: [PATCH] Add underline/strikeout fonts, individual borders, thick lines - Fonts: underline and strikeout fields (default false) - Borders: individual sides (left, right), comma combos ("top,bottom") - Lines: borderWidth "thick" generates width=2 line entry - SKILL.md updated with new fields Co-Authored-By: Claude Opus 4.6 --- .claude/skills/mxl-compile/SKILL.md | 5 +- .../mxl-compile/scripts/mxl-compile.ps1 | 64 ++++++++++++------- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/.claude/skills/mxl-compile/SKILL.md b/.claude/skills/mxl-compile/SKILL.md index 6e98ac38..70972934 100644 --- a/.claude/skills/mxl-compile/SKILL.md +++ b/.claude/skills/mxl-compile/SKILL.md @@ -127,6 +127,8 @@ powershell.exe -NoProfile -File .claude/skills/mxl-compile/scripts/mxl-compile.p | `size` | `10` | Размер | | `bold` | `false` | Жирный | | `italic` | `false` | Курсив | +| `underline` | `false` | Подчёркнутый | +| `strikeout` | `false` | Зачёркнутый | Шрифт `"default"` используется когда стиль не указывает шрифт явно. @@ -137,7 +139,8 @@ powershell.exe -NoProfile -File .claude/skills/mxl-compile/scripts/mxl-compile.p | `font` | `"default"` | Ссылка на имя шрифта | | `align` | — | `left`, `center`, `right` | | `valign` | — | `top`, `center` | -| `border` | — | `none`, `all`, `bottom`, `top` | +| `border` | — | Стороны рамки: `all`, `top`, `bottom`, `left`, `right`, `none`. Через запятую: `"top,bottom"` | +| `borderWidth` | `"thin"` | Толщина рамки: `thin` (1px) или `thick` (2px) | | `wrap` | `false` | Перенос текста | ### Области (`areas[]`) diff --git a/.claude/skills/mxl-compile/scripts/mxl-compile.ps1 b/.claude/skills/mxl-compile/scripts/mxl-compile.ps1 index 445917e8..b05377b5 100644 --- a/.claude/skills/mxl-compile/scripts/mxl-compile.ps1 +++ b/.claude/skills/mxl-compile/scripts/mxl-compile.ps1 @@ -42,14 +42,18 @@ function Add-Font { $size = if ($fontDef.size) { [int]$fontDef.size } else { 10 } $bold = if ($fontDef.bold -eq $true) { "true" } else { "false" } $italic = if ($fontDef.italic -eq $true) { "true" } else { "false" } + $underline = if ($fontDef.underline -eq $true) { "true" } else { "false" } + $strikeout = if ($fontDef.strikeout -eq $true) { "true" } else { "false" } $idx = $script:fontEntries.Count $script:fontMap[$name] = $idx $script:fontEntries += @{ - Face = $face - Size = $size - Bold = $bold - Italic = $italic + Face = $face + Size = $size + Bold = $bold + Italic = $italic + Underline = $underline + Strikeout = $strikeout } } @@ -70,21 +74,31 @@ if (-not $hasDefault) { # --- 3. Determine line palette --- -$hasBorders = $false +$hasThinBorders = $false +$hasThickBorders = $false # Scan styles for border usage if ($def.styles) { foreach ($prop in $def.styles.PSObject.Properties) { - if ($prop.Value.border -and $prop.Value.border -ne "none") { - $hasBorders = $true - break + $s = $prop.Value + if ($s.border -and $s.border -ne "none") { + if ($s.borderWidth -eq "thick") { + $hasThickBorders = $true + } else { + $hasThinBorders = $true + } } } } -$solidLineIndex = -1 -if ($hasBorders) { - $solidLineIndex = 0 +$thinLineIndex = -1 +$thickLineIndex = -1 +$lineCount = 0 +if ($hasThinBorders) { + $thinLineIndex = $lineCount; $lineCount++ +} +if ($hasThickBorders) { + $thickLineIndex = $lineCount; $lineCount++ } # --- 4. Parse column width specs --- @@ -136,15 +150,16 @@ function Resolve-Style { } # Borders - if ($style.border) { - switch ($style.border) { - "all" { - $lb = $solidLineIndex; $tb = $solidLineIndex - $rb = $solidLineIndex; $bb = $solidLineIndex + if ($style.border -and $style.border -ne "none") { + $lineIdx = if ($style.borderWidth -eq "thick") { $thickLineIndex } else { $thinLineIndex } + foreach ($side in ($style.border -split ',')) { + switch ($side.Trim()) { + "all" { $lb = $lineIdx; $tb = $lineIdx; $rb = $lineIdx; $bb = $lineIdx } + "left" { $lb = $lineIdx } + "top" { $tb = $lineIdx } + "right" { $rb = $lineIdx } + "bottom" { $bb = $lineIdx } } - "bottom" { $bb = $solidLineIndex } - "top" { $tb = $solidLineIndex } - "none" { } } } @@ -524,15 +539,20 @@ foreach ($ni in $namedItems) { } # 7h. Line palette -if ($hasBorders) { +if ($hasThinBorders) { X "`t" X "`t`tSolid" X "`t" } +if ($hasThickBorders) { + X "`t" + X "`t`tSolid" + X "`t" +} # 7i. Font palette foreach ($fe in $fontEntries) { - X "`t" + X "`t" } # 7j. Format palette @@ -589,5 +609,5 @@ $enc = New-Object System.Text.UTF8Encoding($true) Write-Host "[OK] Compiled: $OutputPath" Write-Host " Areas: $($namedItems.Count), Rows: $totalRowCount, Columns: $totalColumns" -Write-Host " Fonts: $($fontEntries.Count), Lines: $(if ($hasBorders) { 1 } else { 0 }), Formats: $($formatRegistry.Count)" +Write-Host " Fonts: $($fontEntries.Count), Lines: $lineCount, Formats: $($formatRegistry.Count)" Write-Host " Merges: $($merges.Count)"