mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-30 16:36:56 +03:00
feat(skd-compile): parameters — title и presentation как синонимы
- parameter принимает presentation как синоним title (1C UI показывает подпись параметра как "Представление" — модель по аналогии пишет presentation) - availableValues[] принимает title как синоним presentation (обратная ошибка: модель пишет title по аналогии с самим параметром) Обе формы пишутся в один и тот же XML-узел. Версии: skd-compile v1.13 → v1.14. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
1cea9e794e
commit
1b46eb4d85
@@ -1,4 +1,4 @@
|
||||
# skd-compile v1.13 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.14 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$DefinitionFile,
|
||||
@@ -931,12 +931,15 @@ function Emit-SingleParam {
|
||||
X "`t<parameter>"
|
||||
X "`t`t<name>$(Esc-Xml $parsed.name)</name>"
|
||||
|
||||
# Title (from parsed first, then from object form)
|
||||
# Title (from parsed first, then from object form; accept `presentation` as
|
||||
# a synonym — 1C UI labels a parameter's caption "Представление").
|
||||
$title = ""
|
||||
if ($parsed.title) {
|
||||
$title = "$($parsed.title)"
|
||||
} elseif ($p -isnot [string] -and $p.title) {
|
||||
$title = "$($p.title)"
|
||||
} elseif ($p -isnot [string] -and $p.presentation) {
|
||||
$title = "$($p.presentation)"
|
||||
}
|
||||
if ($title) {
|
||||
Emit-MLText -tag "title" -text $title -indent "`t`t"
|
||||
@@ -988,11 +991,13 @@ function Emit-SingleParam {
|
||||
}
|
||||
X "`t`t<availableValue>"
|
||||
X "`t`t`t<value xsi:type=`"$avType`">$(Esc-Xml $avVal)</value>"
|
||||
if ($av.presentation) {
|
||||
# `title` accepted as synonym of `presentation` — both map to the same UI label.
|
||||
$avPres = if ($av.presentation) { "$($av.presentation)" } elseif ($av.title) { "$($av.title)" } else { "" }
|
||||
if ($avPres) {
|
||||
X "`t`t`t<presentation xsi:type=`"v8:LocalStringType`">"
|
||||
X "`t`t`t`t<v8:item>"
|
||||
X "`t`t`t`t`t<v8:lang>ru</v8:lang>"
|
||||
X "`t`t`t`t`t<v8:content>$(Esc-Xml "$($av.presentation)")</v8:content>"
|
||||
X "`t`t`t`t`t<v8:content>$(Esc-Xml $avPres)</v8:content>"
|
||||
X "`t`t`t`t</v8:item>"
|
||||
X "`t`t`t</presentation>"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# skd-compile v1.13 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.14 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import json
|
||||
@@ -802,12 +802,15 @@ def emit_single_param(lines, p, parsed):
|
||||
lines.append('\t<parameter>')
|
||||
lines.append(f'\t\t<name>{esc_xml(parsed["name"])}</name>')
|
||||
|
||||
# Title (from parsed first, then from object form)
|
||||
# Title (from parsed first, then from object form; accept `presentation` as
|
||||
# a synonym — 1C UI labels a parameter's caption "Представление").
|
||||
title = ''
|
||||
if parsed.get('title'):
|
||||
title = str(parsed['title'])
|
||||
elif p is not None and not isinstance(p, str) and p.get('title'):
|
||||
title = str(p['title'])
|
||||
elif p is not None and not isinstance(p, str) and p.get('presentation'):
|
||||
title = str(p['presentation'])
|
||||
if title:
|
||||
emit_mltext(lines, '\t\t', 'title', title)
|
||||
|
||||
@@ -852,11 +855,13 @@ def emit_single_param(lines, p, parsed):
|
||||
av_type = 'dcscor:DesignTimeValue'
|
||||
lines.append('\t\t<availableValue>')
|
||||
lines.append(f'\t\t\t<value xsi:type="{av_type}">{esc_xml(av_val)}</value>')
|
||||
if av.get('presentation'):
|
||||
# `title` accepted as synonym of `presentation` — both map to the same UI label.
|
||||
av_pres = str(av.get('presentation') or av.get('title') or '')
|
||||
if av_pres:
|
||||
lines.append('\t\t\t<presentation xsi:type="v8:LocalStringType">')
|
||||
lines.append('\t\t\t\t<v8:item>')
|
||||
lines.append('\t\t\t\t\t<v8:lang>ru</v8:lang>')
|
||||
lines.append(f'\t\t\t\t\t<v8:content>{esc_xml(str(av["presentation"]))}</v8:content>')
|
||||
lines.append(f'\t\t\t\t\t<v8:content>{esc_xml(av_pres)}</v8:content>')
|
||||
lines.append('\t\t\t\t</v8:item>')
|
||||
lines.append('\t\t\t</presentation>')
|
||||
lines.append('\t\t</availableValue>')
|
||||
|
||||
Reference in New Issue
Block a user