mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-10 16:14:54 +03:00
fix(skd-compile): multilang в outputParameters value
Emit-OutputParameters принудительно использовал str(value), теряя
multilang dict {ru, en} → эмитил как "@{ru=...; en=...}". Теперь
auto-promote ptype=mltext если значение — PSCustomObject/dict.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# skd-compile v1.36 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.37 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$DefinitionFile,
|
||||
@@ -2135,16 +2135,20 @@ function Emit-OutputParameters {
|
||||
X "$indent<dcsset:outputParameters>"
|
||||
foreach ($prop in $params.PSObject.Properties) {
|
||||
$key = $prop.Name
|
||||
$val = "$($prop.Value)"
|
||||
$rawVal = $prop.Value
|
||||
$ptype = $script:outputParamTypes[$key]
|
||||
if (-not $ptype) { $ptype = "xs:string" }
|
||||
# Auto-promote to mltext if value is a multilang dict ({ru, en, ...})
|
||||
if ($rawVal -is [System.Management.Automation.PSCustomObject] -or $rawVal -is [hashtable] -or $rawVal -is [System.Collections.IDictionary]) {
|
||||
$ptype = "mltext"
|
||||
}
|
||||
|
||||
X "$indent`t<dcscor:item xsi:type=`"dcsset:SettingsParameterValue`">"
|
||||
X "$indent`t`t<dcscor:parameter>$(Esc-Xml $key)</dcscor:parameter>"
|
||||
if ($ptype -eq "mltext") {
|
||||
Emit-MLText -tag "dcscor:value" -text $val -indent "$indent`t`t"
|
||||
Emit-MLText -tag "dcscor:value" -text $rawVal -indent "$indent`t`t"
|
||||
} else {
|
||||
X "$indent`t`t<dcscor:value xsi:type=`"$ptype`">$(Esc-Xml $val)</dcscor:value>"
|
||||
X "$indent`t`t<dcscor:value xsi:type=`"$ptype`">$(Esc-Xml "$rawVal")</dcscor:value>"
|
||||
}
|
||||
X "$indent`t</dcscor:item>"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# skd-compile v1.36 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.37 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import json
|
||||
@@ -1776,15 +1776,17 @@ def emit_output_parameters(lines, params, indent):
|
||||
|
||||
lines.append(f'{indent}<dcsset:outputParameters>')
|
||||
for key, val in params.items():
|
||||
val_str = str(val)
|
||||
ptype = OUTPUT_PARAM_TYPES.get(key, 'xs:string')
|
||||
# Auto-promote to mltext if value is a multilang dict ({ru, en, ...})
|
||||
if isinstance(val, dict):
|
||||
ptype = 'mltext'
|
||||
|
||||
lines.append(f'{indent}\t<dcscor:item xsi:type="dcsset:SettingsParameterValue">')
|
||||
lines.append(f'{indent}\t\t<dcscor:parameter>{esc_xml(key)}</dcscor:parameter>')
|
||||
if ptype == 'mltext':
|
||||
emit_mltext(lines, f'{indent}\t\t', 'dcscor:value', val_str)
|
||||
emit_mltext(lines, f'{indent}\t\t', 'dcscor:value', val)
|
||||
else:
|
||||
lines.append(f'{indent}\t\t<dcscor:value xsi:type="{ptype}">{esc_xml(val_str)}</dcscor:value>')
|
||||
lines.append(f'{indent}\t\t<dcscor:value xsi:type="{ptype}">{esc_xml(str(val))}</dcscor:value>')
|
||||
lines.append(f'{indent}\t</dcscor:item>')
|
||||
lines.append(f'{indent}</dcsset:outputParameters>')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user