mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-20 01:20:59 +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:
co-authored by
Claude Opus 4.7
parent
c3a8a9c874
commit
501abd9fac
@@ -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
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[string]$DefinitionFile,
|
[string]$DefinitionFile,
|
||||||
@@ -2135,16 +2135,20 @@ function Emit-OutputParameters {
|
|||||||
X "$indent<dcsset:outputParameters>"
|
X "$indent<dcsset:outputParameters>"
|
||||||
foreach ($prop in $params.PSObject.Properties) {
|
foreach ($prop in $params.PSObject.Properties) {
|
||||||
$key = $prop.Name
|
$key = $prop.Name
|
||||||
$val = "$($prop.Value)"
|
$rawVal = $prop.Value
|
||||||
$ptype = $script:outputParamTypes[$key]
|
$ptype = $script:outputParamTypes[$key]
|
||||||
if (-not $ptype) { $ptype = "xs:string" }
|
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<dcscor:item xsi:type=`"dcsset:SettingsParameterValue`">"
|
||||||
X "$indent`t`t<dcscor:parameter>$(Esc-Xml $key)</dcscor:parameter>"
|
X "$indent`t`t<dcscor:parameter>$(Esc-Xml $key)</dcscor:parameter>"
|
||||||
if ($ptype -eq "mltext") {
|
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 {
|
} 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>"
|
X "$indent`t</dcscor:item>"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/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
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
@@ -1776,15 +1776,17 @@ def emit_output_parameters(lines, params, indent):
|
|||||||
|
|
||||||
lines.append(f'{indent}<dcsset:outputParameters>')
|
lines.append(f'{indent}<dcsset:outputParameters>')
|
||||||
for key, val in params.items():
|
for key, val in params.items():
|
||||||
val_str = str(val)
|
|
||||||
ptype = OUTPUT_PARAM_TYPES.get(key, 'xs:string')
|
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<dcscor:item xsi:type="dcsset:SettingsParameterValue">')
|
||||||
lines.append(f'{indent}\t\t<dcscor:parameter>{esc_xml(key)}</dcscor:parameter>')
|
lines.append(f'{indent}\t\t<dcscor:parameter>{esc_xml(key)}</dcscor:parameter>')
|
||||||
if ptype == 'mltext':
|
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:
|
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}\t</dcscor:item>')
|
||||||
lines.append(f'{indent}</dcsset:outputParameters>')
|
lines.append(f'{indent}</dcsset:outputParameters>')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user