diff --git a/.claude/skills/skd-compile/scripts/skd-compile.ps1 b/.claude/skills/skd-compile/scripts/skd-compile.ps1 index 9f8e98b1..adea798f 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.65 — Compile 1C DCS from JSON +# skd-compile v1.66 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$DefinitionFile, @@ -2200,9 +2200,30 @@ function Emit-AppearanceValue { if ($useWrapper) { X "$indent`tfalse" } X "$indent`t$(Esc-Xml $key)" - # Multilang dict ({"ru": "...", "en": "..."}) → LocalStringType независимо от ключа. - $isMultilang = ($innerVal -is [hashtable]) -or ($innerVal -is [System.Collections.IDictionary]) -or ($innerVal -is [PSCustomObject]) - if ($isMultilang) { + # Font dict ({@type: "Font", ref, faceName, height, bold, ...}) → + $isFontDict = $false + if ($innerVal -is [PSCustomObject]) { + $tProp = $innerVal.PSObject.Properties['@type'] + if ($tProp -and "$($tProp.Value)" -eq 'Font') { $isFontDict = $true } + } elseif ($innerVal -is [System.Collections.IDictionary]) { + if ($innerVal.Contains('@type') -and "$($innerVal['@type'])" -eq 'Font') { $isFontDict = $true } + } + $isDict = ($innerVal -is [hashtable]) -or ($innerVal -is [System.Collections.IDictionary]) -or ($innerVal -is [PSCustomObject]) + if ($isFontDict) { + $attrParts = @() + foreach ($attrName in @('ref','faceName','height','bold','italic','underline','strikeout','kind','scale')) { + $av = $null + if ($innerVal -is [PSCustomObject]) { + $ap = $innerVal.PSObject.Properties[$attrName] + if ($ap) { $av = $ap.Value } + } else { + if ($innerVal.Contains($attrName)) { $av = $innerVal[$attrName] } + } + if ($null -ne $av) { $attrParts += "$attrName=`"$(Esc-Xml "$av")`"" } + } + X "$indent`t" + } elseif ($isDict) { + # Multilang dict ({"ru": "...", "en": "..."}) → LocalStringType независимо от ключа. Emit-MLText -tag "dcscor:value" -text $innerVal -indent "$indent`t" } else { $actualVal = "$innerVal" diff --git a/.claude/skills/skd-compile/scripts/skd-compile.py b/.claude/skills/skd-compile/scripts/skd-compile.py index cc3c58e0..f4f28f11 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.65 — Compile 1C DCS from JSON +# skd-compile v1.66 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import json @@ -1835,8 +1835,14 @@ def emit_appearance_value(lines, key, val, indent): lines.append(f'{indent}\tfalse') lines.append(f'{indent}\t{esc_xml(key)}') - # Multilang dict ({"ru": "...", "en": "..."}) \u2192 LocalStringType \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u043a\u043b\u044e\u0447\u0430. - if isinstance(inner_val, dict): + # Font dict ({@type: "Font", ref, faceName, height, bold, ...}) \u2192 + if isinstance(inner_val, dict) and inner_val.get('@type') == 'Font': + attr_parts = [] + for attr_name in ('ref', 'faceName', 'height', 'bold', 'italic', 'underline', 'strikeout', 'kind', 'scale'): + if attr_name in inner_val: + attr_parts.append(f'{attr_name}="{esc_xml(str(inner_val[attr_name]))}"') + lines.append(f'{indent}\t') + elif isinstance(inner_val, dict): emit_mltext(lines, f'{indent}\t', 'dcscor:value', inner_val) else: actual_val = str(inner_val) if inner_val is not None else '' diff --git a/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 b/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 index 0a3fc80a..bbb1d48e 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.49 — Decompile 1C DCS Template.xml to JSON DSL (draft) +# skd-decompile v0.50 — Decompile 1C DCS Template.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -431,6 +431,18 @@ function Get-RestrictionTokens { } # → hashtable {param: value} +function Get-FontValue { + param($valNode) + # Шрифт: + # Сохраняем все атрибуты как объект {@type:Font, ...}, чтобы compile мог восстановить bit-perfect. + $f = [ordered]@{ '@type' = 'Font' } + foreach ($attrName in @('ref','faceName','height','bold','italic','underline','strikeout','kind','scale')) { + $a = $valNode.Attributes[$attrName] + if ($null -ne $a) { $f[$attrName] = $a.Value } + } + return $f +} + function Get-AppearanceDict { param($appNode) if (-not $appNode) { return $null } @@ -440,10 +452,12 @@ function Get-AppearanceDict { $p = Get-Text $it "dcscor:parameter" $valNode = $it.SelectSingleNode("dcscor:value", $ns) if (-not $p -or -not $valNode) { continue } - # Value can be xs:string, v8ui:HorizontalAlign, v8:LocalStringType, etc. + # Value can be xs:string, v8ui:HorizontalAlign, v8:LocalStringType, v8ui:Font, etc. $valType = Get-LocalXsiType $valNode if ($valType -eq 'LocalStringType') { $rawVal = Get-MLText $valNode + } elseif ($valType -eq 'Font') { + $rawVal = Get-FontValue $valNode } else { $rawVal = $valNode.InnerText } @@ -1570,9 +1584,18 @@ function Get-SettingsAppearance { if (-not $pName -or -not $val) { continue } $valType = Get-LocalXsiType $val if ($valType -eq 'LocalStringType') { - $dict[$pName] = Get-MLText $val + $rawVal = Get-MLText $val + } elseif ($valType -eq 'Font') { + $rawVal = Get-FontValue $val } else { - $dict[$pName] = $val.InnerText + $rawVal = $val.InnerText + } + # wrapper {use:false, value} как в Get-AppearanceDict + $useV = Get-Text $it "dcscor:use" + if ($useV -eq 'false') { + $dict[$pName] = [ordered]@{ value = $rawVal; use = $false } + } else { + $dict[$pName] = $rawVal } } return $dict