diff --git a/.claude/skills/skd-compile/scripts/skd-compile.ps1 b/.claude/skills/skd-compile/scripts/skd-compile.ps1 index 80f01234..fa64cbcb 100644 --- a/.claude/skills/skd-compile/scripts/skd-compile.ps1 +++ b/.claude/skills/skd-compile/scripts/skd-compile.ps1 @@ -1,4 +1,4 @@ -# skd-compile v1.101 — Compile 1C DCS from JSON +# skd-compile v1.102 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$DefinitionFile, @@ -1651,12 +1651,21 @@ foreach ($stylesFile in $searchPaths) { function Emit-ColorValue { param([string]$color, [string]$indent) - if ($color.StartsWith('style:')) { - $styleName = $color.Substring(6) - X "$indentd8p1:$styleName" - } else { - X "$indent$(Esc-Xml $color)" + # Префиксы style:/web:/win: → соответствующий xmlns + dN:Name + $colorPrefixToUri = @{ + 'style:' = 'http://v8.1c.ru/8.1/data/ui/style' + 'web:' = 'http://v8.1c.ru/8.1/data/ui/colors/web' + 'win:' = 'http://v8.1c.ru/8.1/data/ui/colors/windows' } + foreach ($pfx in $colorPrefixToUri.Keys) { + if ($color.StartsWith($pfx)) { + $name = $color.Substring($pfx.Length) + $uri = $colorPrefixToUri[$pfx] + X "$indentd8p1:$name" + return + } + } + X "$indent$(Esc-Xml $color)" } function Emit-CellAppearance { @@ -2438,6 +2447,8 @@ function Emit-AppearanceValue { if ($keyType) { X "$indent`t$(Esc-Xml $actualVal)" } elseif ($actualVal -match '^(style|web|win):') { + # Внутри префиксы style:/web:/win:/sys: уже объявлены на корне, + # локальный xmlns не нужен — эмитим short form. X "$indent`t$(Esc-Xml $actualVal)" } elseif ($actualVal -eq "true" -or $actualVal -eq "false") { X "$indent`t$actualVal" diff --git a/.claude/skills/skd-compile/scripts/skd-compile.py b/.claude/skills/skd-compile/scripts/skd-compile.py index d3e855fe..8f0dbd93 100644 --- a/.claude/skills/skd-compile/scripts/skd-compile.py +++ b/.claude/skills/skd-compile/scripts/skd-compile.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# skd-compile v1.101 — Compile 1C DCS from JSON +# skd-compile v1.102 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import json @@ -1346,11 +1346,18 @@ def load_user_styles(base_dir, output_path=None): def _emit_color_value(lines, color, indent): - if color.startswith('style:'): - style_name = color[6:] - lines.append(f'{indent}d8p1:{style_name}') - else: - lines.append(f'{indent}{esc_xml(color)}') + # Префиксы style:/web:/win: → соответствующий xmlns + dN:Name + color_prefix_to_uri = { + 'style:': 'http://v8.1c.ru/8.1/data/ui/style', + 'web:': 'http://v8.1c.ru/8.1/data/ui/colors/web', + 'win:': 'http://v8.1c.ru/8.1/data/ui/colors/windows', + } + for pfx, uri in color_prefix_to_uri.items(): + if color.startswith(pfx): + name = color[len(pfx):] + lines.append(f'{indent}d8p1:{name}') + return + lines.append(f'{indent}{esc_xml(color)}') def _emit_cell_appearance(lines, style, width=0, v_merge=False, h_merge=False, min_height=0, extra_items=None): @@ -1992,6 +1999,8 @@ def emit_appearance_value(lines, key, val, indent): if key_type: lines.append(f'{indent}\t{esc_xml(actual_val)}') elif re.match(r'^(style|web|win):', actual_val): + # Внутри префиксы style:/web:/win:/sys: уже объявлены на корне, + # локальный xmlns не нужен — эмитим short form. lines.append(f'{indent}\t{esc_xml(actual_val)}') elif actual_val == 'true' or actual_val == 'false': lines.append(f'{indent}\t{actual_val}') diff --git a/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 b/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 index 8c3f9625..32dc12d5 100644 --- a/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 +++ b/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 @@ -1,4 +1,4 @@ -# skd-decompile v0.85 — Decompile 1C DCS Template.xml to JSON DSL (draft) +# skd-decompile v0.86 — Decompile 1C DCS Template.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -1036,7 +1036,17 @@ function Normalize-Color { param($valNode) if (-not $valNode) { return $null } $txt = $valNode.InnerText - if ($txt -match '^d\d+p\d+:(.+)$') { return 'style:' + $matches[1] } + # Префикс xsi:type или value — резолвим в URI и выбираем DSL-префикс. + if ($txt -match '^([^:]+):(.+)$') { + $pfx = $matches[1] + $name = $matches[2] + $uri = $valNode.GetNamespaceOfPrefix($pfx) + switch ($uri) { + 'http://v8.1c.ru/8.1/data/ui/style' { return 'style:' + $name } + 'http://v8.1c.ru/8.1/data/ui/colors/web' { return 'web:' + $name } + 'http://v8.1c.ru/8.1/data/ui/colors/windows' { return 'win:' + $name } + } + } return $txt }