feat(skd): preset style=none + детект пустого fingerprint в decompile

Закрывает простую часть категории C: шаблоны где у ячеек appearance
содержит только per-cell атрибуты (МинимальнаяШирина и др.) без font/
borders/colors. Раньше такие шаблоны попадали в TemplateStyleMismatch.

- skd-compile (ps1+py): новый preset 'none' со всеми стилевыми полями
  null/false. Emit-CellAppearance / _emit_cell_appearance пропускают
  Font-элемент когда style.font=null.
- skd-decompile: пустой fingerprint (после отсева per-cell ключей) не
  считается за стиль ячейки; если все non-merge ячейки шаблона имели
  пустой fp — эмитим style="none" вместо sentinel.
- Новый тест template-no-style (round-trip bit-perfect).
- Versions: compile v1.31→v1.32, decompile v0.13→v0.14.

Метрики:
- ERP-сэмпл 30: 32 → 24 sentinel'ов, clean 24→26/30
- Корпус из 40 отчётов целевого класса: 45 → 39 sentinel'ов, 19/40 clean

Остаточные sentinel'ы — реальный custom appearance (нестандартный шрифт/
выравнивание/цвет вне built-in пресетов). Требует расширения DSL под
hashtable-style — отдельная задача.
This commit is contained in:
Nick Shirokov
2026-05-21 18:38:34 +03:00
parent a73517ee07
commit 4bd8f27dec
6 changed files with 211 additions and 23 deletions
@@ -1,4 +1,4 @@
# skd-compile v1.31 — Compile 1C DCS from JSON
# skd-compile v1.32 — Compile 1C DCS from JSON
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$DefinitionFile,
@@ -1412,6 +1412,12 @@ function Emit-ParamValue {
# Built-in style presets
$script:areaStylePresets = @{
none = @{
font = $null; fontSize = $null; bold = $false; italic = $false
hAlign = $null; vAlign = $null; wrap = $false
bgColor = $null; textColor = $null
borderColor = $null; borders = $false
}
data = @{
font = 'Arial'; fontSize = 10; bold = $false; italic = $false
hAlign = $null; vAlign = $null; wrap = $false
@@ -1530,13 +1536,15 @@ function Emit-CellAppearance {
}
X "$ind</dcscor:item>"
}
# Font
$boldStr = if ($style.bold) { "true" } else { "false" }
$italicStr = if ($style.italic) { "true" } else { "false" }
X "$ind<dcscor:item>"
X "$ind`t<dcscor:parameter>Шрифт</dcscor:parameter>"
X "$ind`t<dcscor:value xsi:type=`"v8ui:Font`" faceName=`"$($style.font)`" height=`"$($style.fontSize)`" bold=`"$boldStr`" italic=`"$italicStr`" underline=`"false`" strikeout=`"false`" kind=`"Absolute`" scale=`"100`"/>"
X "$ind</dcscor:item>"
# Font (skip if style has no font configured — for "none" preset)
if ($style.font) {
$boldStr = if ($style.bold) { "true" } else { "false" }
$italicStr = if ($style.italic) { "true" } else { "false" }
X "$ind<dcscor:item>"
X "$ind`t<dcscor:parameter>Шрифт</dcscor:parameter>"
X "$ind`t<dcscor:value xsi:type=`"v8ui:Font`" faceName=`"$($style.font)`" height=`"$($style.fontSize)`" bold=`"$boldStr`" italic=`"$italicStr`" underline=`"false`" strikeout=`"false`" kind=`"Absolute`" scale=`"100`"/>"
X "$ind</dcscor:item>"
}
# Horizontal alignment
if ($style.hAlign) {
X "$ind<dcscor:item>"