mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-09-18 07:35:52 +03:00
feat(skd-compile): use=false wrapper в outputParameters
outputParameters item тоже может иметь <dcscor:use>false</dcscor:use>
(например — отключённый «Заголовок» в варианте). Emit-OutputParameters
теперь распознаёт wrapper {value, use: false} и эмитит <dcscor:use>
в начале item, как уже делал Emit-AppearanceValue.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
29a9fbe950
commit
8009a8150f
@@ -1,4 +1,4 @@
|
|||||||
# skd-compile v1.59 — Compile 1C DCS from JSON
|
# skd-compile v1.60 — 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,
|
||||||
@@ -2314,6 +2314,15 @@ function Emit-OutputParameters {
|
|||||||
foreach ($prop in $params.PSObject.Properties) {
|
foreach ($prop in $params.PSObject.Properties) {
|
||||||
$key = $prop.Name
|
$key = $prop.Name
|
||||||
$rawVal = $prop.Value
|
$rawVal = $prop.Value
|
||||||
|
# Распознаём wrapper {use: false, value: ...} (отличаем от multilang dict)
|
||||||
|
$useWrapper = $false
|
||||||
|
if ($rawVal -is [PSCustomObject] -and $rawVal.PSObject.Properties['use'] -and $rawVal.use -eq $false -and $rawVal.PSObject.Properties['value']) {
|
||||||
|
$useWrapper = $true
|
||||||
|
$rawVal = $rawVal.value
|
||||||
|
} elseif (($rawVal -is [hashtable] -or $rawVal -is [System.Collections.IDictionary]) -and $rawVal.Contains('use') -and $rawVal['use'] -eq $false -and $rawVal.Contains('value')) {
|
||||||
|
$useWrapper = $true
|
||||||
|
$rawVal = $rawVal['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, ...})
|
# Auto-promote to mltext if value is a multilang dict ({ru, en, ...})
|
||||||
@@ -2322,6 +2331,7 @@ function Emit-OutputParameters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
X "$indent`t<dcscor:item xsi:type=`"dcsset:SettingsParameterValue`">"
|
X "$indent`t<dcscor:item xsi:type=`"dcsset:SettingsParameterValue`">"
|
||||||
|
if ($useWrapper) { X "$indent`t`t<dcscor:use>false</dcscor:use>" }
|
||||||
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 $rawVal -indent "$indent`t`t"
|
Emit-MLText -tag "dcscor:value" -text $rawVal -indent "$indent`t`t"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# skd-compile v1.59 — Compile 1C DCS from JSON
|
# skd-compile v1.60 — 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
|
||||||
@@ -1931,12 +1931,19 @@ 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():
|
||||||
|
# Распознаём wrapper {use: false, value: ...} — отличаем от multilang dict
|
||||||
|
use_wrapper = False
|
||||||
|
if isinstance(val, dict) and val.get('use') is False and 'value' in val:
|
||||||
|
use_wrapper = True
|
||||||
|
val = val['value']
|
||||||
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, ...})
|
# Auto-promote to mltext if value is a multilang dict ({ru, en, ...})
|
||||||
if isinstance(val, dict):
|
if isinstance(val, dict):
|
||||||
ptype = 'mltext'
|
ptype = 'mltext'
|
||||||
|
|
||||||
lines.append(f'{indent}\t<dcscor:item xsi:type="dcsset:SettingsParameterValue">')
|
lines.append(f'{indent}\t<dcscor:item xsi:type="dcsset:SettingsParameterValue">')
|
||||||
|
if use_wrapper:
|
||||||
|
lines.append(f'{indent}\t\t<dcscor:use>false</dcscor:use>')
|
||||||
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)
|
emit_mltext(lines, f'{indent}\t\t', 'dcscor:value', val)
|
||||||
|
|||||||
Reference in New Issue
Block a user