diff --git a/.claude/skills/skd-compile/scripts/skd-compile.ps1 b/.claude/skills/skd-compile/scripts/skd-compile.ps1 index f1201d0b..37ed248e 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.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" X "`t`t$(Esc-Xml $parsed.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" X "`t`t`t$(Esc-Xml $avVal)" - 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" X "`t`t`t`t" X "`t`t`t`t`tru" - X "`t`t`t`t`t$(Esc-Xml "$($av.presentation)")" + X "`t`t`t`t`t$(Esc-Xml $avPres)" X "`t`t`t`t" X "`t`t`t" } diff --git a/.claude/skills/skd-compile/scripts/skd-compile.py b/.claude/skills/skd-compile/scripts/skd-compile.py index 3d9add72..26d2cf68 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.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') lines.append(f'\t\t{esc_xml(parsed["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') lines.append(f'\t\t\t{esc_xml(av_val)}') - 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') lines.append('\t\t\t\t') lines.append('\t\t\t\t\tru') - lines.append(f'\t\t\t\t\t{esc_xml(str(av["presentation"]))}') + lines.append(f'\t\t\t\t\t{esc_xml(av_pres)}') lines.append('\t\t\t\t') lines.append('\t\t\t') lines.append('\t\t') diff --git a/tests/skills/cases/skd-compile/parameter-title-presentation-synonyms.json b/tests/skills/cases/skd-compile/parameter-title-presentation-synonyms.json new file mode 100644 index 00000000..9407e6a0 --- /dev/null +++ b/tests/skills/cases/skd-compile/parameter-title-presentation-synonyms.json @@ -0,0 +1,27 @@ +{ + "name": "Parameter.presentation и availableValue.title — синонимы", + "params": { "outputPath": "Template.xml" }, + "input": { + "dataSets": [{ + "name": "Основной", + "query": "ВЫБРАТЬ Т.Сумма ИЗ Регистр КАК Т", + "fields": ["Сумма: decimal(15,2)"] + }], + "parameters": [ + { + "name": "ПорядокОкругления", + "presentation": "Округление", + "type": "EnumRef.Округления", + "value": "Перечисление.Округления.Окр1_00", + "availableValues": [ + { "value": "Перечисление.Округления.Окр1_00", "title": "руб. коп" }, + { "value": "Перечисление.Округления.Окр1", "presentation": "руб." } + ] + } + ] + }, + "validatePath": "Template.xml", + "expect": { + "files": ["Template.xml"] + } +} diff --git a/tests/skills/cases/skd-compile/snapshots/parameter-title-presentation-synonyms/Template.xml b/tests/skills/cases/skd-compile/snapshots/parameter-title-presentation-synonyms/Template.xml new file mode 100644 index 00000000..4f2ce774 --- /dev/null +++ b/tests/skills/cases/skd-compile/snapshots/parameter-title-presentation-synonyms/Template.xml @@ -0,0 +1,83 @@ + + + + ИсточникДанных1 + Local + + + Основной + + Сумма + Сумма + + xs:decimal + + 15 + 2 + Any + + + + ИсточникДанных1 + ВЫБРАТЬ Т.Сумма ИЗ Регистр КАК Т + + + ПорядокОкругления + + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Округление</v8:content> + </v8:item> + + + d5p1:EnumRef.Округления + + Перечисление.Округления.Окр1_00 + + Перечисление.Округления.Окр1_00 + + + ru + руб. коп + + + + + Перечисление.Округления.Окр1 + + + ru + руб. + + + + + + Основной + + + ru + Основной + + + + + + + + + + + + + + + +