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 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-02-08 18:22:13 +03:00
co-authored by Claude Opus 4.6
parent 2771424c71
commit 2f260ddb7f
2 changed files with 46 additions and 23 deletions
+4 -1
View File
@@ -127,6 +127,8 @@ powershell.exe -NoProfile -File .claude/skills/mxl-compile/scripts/mxl-compile.p
| `size` | `10` | Размер | | `size` | `10` | Размер |
| `bold` | `false` | Жирный | | `bold` | `false` | Жирный |
| `italic` | `false` | Курсив | | `italic` | `false` | Курсив |
| `underline` | `false` | Подчёркнутый |
| `strikeout` | `false` | Зачёркнутый |
Шрифт `"default"` используется когда стиль не указывает шрифт явно. Шрифт `"default"` используется когда стиль не указывает шрифт явно.
@@ -137,7 +139,8 @@ powershell.exe -NoProfile -File .claude/skills/mxl-compile/scripts/mxl-compile.p
| `font` | `"default"` | Ссылка на имя шрифта | | `font` | `"default"` | Ссылка на имя шрифта |
| `align` | — | `left`, `center`, `right` | | `align` | — | `left`, `center`, `right` |
| `valign` | — | `top`, `center` | | `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` | Перенос текста | | `wrap` | `false` | Перенос текста |
### Области (`areas[]`) ### Области (`areas[]`)
@@ -42,14 +42,18 @@ function Add-Font {
$size = if ($fontDef.size) { [int]$fontDef.size } else { 10 } $size = if ($fontDef.size) { [int]$fontDef.size } else { 10 }
$bold = if ($fontDef.bold -eq $true) { "true" } else { "false" } $bold = if ($fontDef.bold -eq $true) { "true" } else { "false" }
$italic = if ($fontDef.italic -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 $idx = $script:fontEntries.Count
$script:fontMap[$name] = $idx $script:fontMap[$name] = $idx
$script:fontEntries += @{ $script:fontEntries += @{
Face = $face Face = $face
Size = $size Size = $size
Bold = $bold Bold = $bold
Italic = $italic Italic = $italic
Underline = $underline
Strikeout = $strikeout
} }
} }
@@ -70,21 +74,31 @@ if (-not $hasDefault) {
# --- 3. Determine line palette --- # --- 3. Determine line palette ---
$hasBorders = $false $hasThinBorders = $false
$hasThickBorders = $false
# Scan styles for border usage # Scan styles for border usage
if ($def.styles) { if ($def.styles) {
foreach ($prop in $def.styles.PSObject.Properties) { foreach ($prop in $def.styles.PSObject.Properties) {
if ($prop.Value.border -and $prop.Value.border -ne "none") { $s = $prop.Value
$hasBorders = $true if ($s.border -and $s.border -ne "none") {
break if ($s.borderWidth -eq "thick") {
$hasThickBorders = $true
} else {
$hasThinBorders = $true
}
} }
} }
} }
$solidLineIndex = -1 $thinLineIndex = -1
if ($hasBorders) { $thickLineIndex = -1
$solidLineIndex = 0 $lineCount = 0
if ($hasThinBorders) {
$thinLineIndex = $lineCount; $lineCount++
}
if ($hasThickBorders) {
$thickLineIndex = $lineCount; $lineCount++
} }
# --- 4. Parse column width specs --- # --- 4. Parse column width specs ---
@@ -136,15 +150,16 @@ function Resolve-Style {
} }
# Borders # Borders
if ($style.border) { if ($style.border -and $style.border -ne "none") {
switch ($style.border) { $lineIdx = if ($style.borderWidth -eq "thick") { $thickLineIndex } else { $thinLineIndex }
"all" { foreach ($side in ($style.border -split ',')) {
$lb = $solidLineIndex; $tb = $solidLineIndex switch ($side.Trim()) {
$rb = $solidLineIndex; $bb = $solidLineIndex "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 # 7h. Line palette
if ($hasBorders) { if ($hasThinBorders) {
X "`t<line width=`"1`" gap=`"false`">" X "`t<line width=`"1`" gap=`"false`">"
X "`t`t<v8ui:style xsi:type=`"v8ui:SpreadsheetDocumentCellLineType`">Solid</v8ui:style>" X "`t`t<v8ui:style xsi:type=`"v8ui:SpreadsheetDocumentCellLineType`">Solid</v8ui:style>"
X "`t</line>" X "`t</line>"
} }
if ($hasThickBorders) {
X "`t<line width=`"2`" gap=`"false`">"
X "`t`t<v8ui:style xsi:type=`"v8ui:SpreadsheetDocumentCellLineType`">Solid</v8ui:style>"
X "`t</line>"
}
# 7i. Font palette # 7i. Font palette
foreach ($fe in $fontEntries) { foreach ($fe in $fontEntries) {
X "`t<font faceName=`"$($fe.Face)`" height=`"$($fe.Size)`" bold=`"$($fe.Bold)`" italic=`"$($fe.Italic)`" underline=`"false`" strikeout=`"false`" kind=`"Absolute`" scale=`"100`"/>" X "`t<font faceName=`"$($fe.Face)`" height=`"$($fe.Size)`" bold=`"$($fe.Bold)`" italic=`"$($fe.Italic)`" underline=`"$($fe.Underline)`" strikeout=`"$($fe.Strikeout)`" kind=`"Absolute`" scale=`"100`"/>"
} }
# 7j. Format palette # 7j. Format palette
@@ -589,5 +609,5 @@ $enc = New-Object System.Text.UTF8Encoding($true)
Write-Host "[OK] Compiled: $OutputPath" Write-Host "[OK] Compiled: $OutputPath"
Write-Host " Areas: $($namedItems.Count), Rows: $totalRowCount, Columns: $totalColumns" 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)" Write-Host " Merges: $($merges.Count)"