mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-01 17:27:45 +03:00
fix(skd-compile): не эмитить пустую <dcsat:appearance/> для cells без атрибутов
Cells со style "none" (без цветов/шрифтов/границ) и без width/merge получали пустой блок <dcsat:appearance></dcsat:appearance>. Оригинал платформы для таких cells appearance не пишет вовсе. Добавлен ранний return в Emit-CellAppearance если все атрибуты пустые. PS + Py синхронизированы. Sample30 total: 794 → 782 строки.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# skd-compile v1.93 — Compile 1C DCS from JSON
|
# skd-compile v1.94 — Compile 1C DCS from JSON
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[string]$DefinitionFile,
|
[string]$DefinitionFile,
|
||||||
@@ -1628,6 +1628,13 @@ function Emit-ColorValue {
|
|||||||
function Emit-CellAppearance {
|
function Emit-CellAppearance {
|
||||||
param($style, [double]$width = 0, [bool]$vMerge = $false, [bool]$hMerge = $false, [double]$minHeight = 0, $extraItems = @())
|
param($style, [double]$width = 0, [bool]$vMerge = $false, [bool]$hMerge = $false, [double]$minHeight = 0, $extraItems = @())
|
||||||
$ind = "`t`t`t`t`t`t"
|
$ind = "`t`t`t`t`t`t"
|
||||||
|
# Если ничего внутри appearance не будет — не эмитим блок вовсе
|
||||||
|
# (оригинал платформы для cells без атрибутов не пишет <appearance></appearance>).
|
||||||
|
$hasContent = $style.bgColor -or $style.textColor -or $style.borders -or $style.font -or `
|
||||||
|
$style.hAlign -or $style.vAlign -or $style.wrap -or `
|
||||||
|
($width -gt 0) -or ($minHeight -gt 0) -or $vMerge -or $hMerge -or `
|
||||||
|
($extraItems -and @($extraItems).Count -gt 0)
|
||||||
|
if (-not $hasContent) { return }
|
||||||
X "`t`t`t`t`t<dcsat:appearance>"
|
X "`t`t`t`t`t<dcsat:appearance>"
|
||||||
# Background color
|
# Background color
|
||||||
if ($style.bgColor) {
|
if ($style.bgColor) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# skd-compile v1.93 — Compile 1C DCS from JSON
|
# skd-compile v1.94 — Compile 1C DCS from JSON
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
@@ -1336,6 +1336,16 @@ def _emit_color_value(lines, color, indent):
|
|||||||
|
|
||||||
def _emit_cell_appearance(lines, style, width=0, v_merge=False, h_merge=False, min_height=0, extra_items=None):
|
def _emit_cell_appearance(lines, style, width=0, v_merge=False, h_merge=False, min_height=0, extra_items=None):
|
||||||
ind = '\t\t\t\t\t\t'
|
ind = '\t\t\t\t\t\t'
|
||||||
|
# Если ничего внутри appearance не будет — не эмитим блок вовсе
|
||||||
|
# (оригинал платформы для cells без атрибутов не пишет <appearance></appearance>).
|
||||||
|
has_content = bool(
|
||||||
|
style.get('bgColor') or style.get('textColor') or style.get('borders') or
|
||||||
|
style.get('font') or style.get('hAlign') or style.get('vAlign') or style.get('wrap') or
|
||||||
|
(width > 0) or (min_height > 0) or v_merge or h_merge or
|
||||||
|
(extra_items and len(extra_items) > 0)
|
||||||
|
)
|
||||||
|
if not has_content:
|
||||||
|
return
|
||||||
lines.append('\t\t\t\t\t<dcsat:appearance>')
|
lines.append('\t\t\t\t\t<dcsat:appearance>')
|
||||||
# Background color
|
# Background color
|
||||||
if style.get('bgColor'):
|
if style.get('bgColor'):
|
||||||
|
|||||||
Reference in New Issue
Block a user