mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-09-05 09:40:52 +03:00
feat(form-decompile,form-compile): единая ML-text форма для заголовков декораций (Label/Picture) — переиспользование Resolve-MLFormatted
Заголовок декорации — formatted-aware текст (как extendedTooltip). Раньше LabelDecoration
нёс formatted отдельным sibling-ключом, PictureDecoration терял атрибут formatted вовсе
(эмитил голый <Title> через generic Emit-Title). Теперь оба идут через общий
Emit-DecorationTitle → Resolve-MLFormatted (та же единая ML-text форма, что у extendedTooltip):
- title декорации: строка (formatted авто-детектится по разметке) / {ru,en} / {text, formatted}.
- атрибут <Title formatted="…"> эмитится ВСЕГДА (специфика декораций); для обычных элементов
Emit-Title остаётся без formatted (formatted — только у декораций, подтверждено корпусом:
LabelDecoration 6568 + PictureDecoration 2, прочие 0).
- back-compat: sibling-ключ formatted принимается как override авто-детекта; компилятор-вывод
LabelDecoration не изменился.
Декомпилятор (v0.27): декорации захватывают title через Get-MLFormattedValue (гибрид);
sibling formatted больше не выводится (форматированные обычно становятся просто строкой
с markup внутри). Компилятор (ps1+py v1.45): Emit-DecorationTitle для Label+Picture.
Валидация: LabelDecoration formatted round-trip CLEAN; PictureDecoration Title-formatted
закрыт (29→0); регресс 33/33 ps+py; py==ps1; harness 8202→8144. Spec обновлён.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
684cd17d5f
commit
b147e491ee
@@ -1,4 +1,4 @@
|
||||
# form-compile v1.44 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.45 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$JsonPath,
|
||||
@@ -2950,23 +2950,31 @@ function Emit-Radio {
|
||||
X "$indent</RadioButtonField>"
|
||||
}
|
||||
|
||||
# Заголовок декорации (Label/Picture): formatted-aware <Title> через единую ML-text форму
|
||||
# (reuse Resolve-MLFormatted, как у extendedTooltip). Атрибут formatted эмитится ВСЕГДА
|
||||
# (специфика декораций). Sibling-ключ `formatted` — back-compat override авто-детекта.
|
||||
function Emit-DecorationTitle {
|
||||
param($el, [string]$name, [string]$indent, [switch]$auto)
|
||||
$hasKey = $null -ne $el.PSObject.Properties['title']
|
||||
$titleVal = if ($hasKey) { $el.title } elseif ($auto -and $name) { Title-FromName -name $name } else { $null }
|
||||
if ($titleVal) {
|
||||
$r = Resolve-MLFormatted $titleVal
|
||||
$fmt = if ($null -ne $el.PSObject.Properties['formatted']) { [bool]$el.formatted } else { $r.formatted }
|
||||
X "$indent<Title formatted=`"$(if ($fmt) { 'true' } else { 'false' })`">"
|
||||
Emit-MLItems -val $r.text -indent "$indent`t"
|
||||
X "$indent</Title>"
|
||||
}
|
||||
if ($el.tooltip) { Emit-MLText -tag "ToolTip" -text $el.tooltip -indent $indent }
|
||||
if ($el.tooltipRepresentation) { X "$indent<ToolTipRepresentation>$($el.tooltipRepresentation)</ToolTipRepresentation>" }
|
||||
}
|
||||
|
||||
function Emit-Label {
|
||||
param($el, [string]$name, [int]$id, [string]$indent)
|
||||
|
||||
X "$indent<LabelDecoration name=`"$name`" id=`"$id`">"
|
||||
$inner = "$indent`t"
|
||||
|
||||
$hasTitleKey = $null -ne $el.PSObject.Properties['title']
|
||||
$labelTitle = if ($hasTitleKey) { $el.title } else { Title-FromName -name $name }
|
||||
if ($labelTitle) {
|
||||
# formatted — независимое свойство (НЕ выводится из hyperlink): ссылка может быть не-форматированной и наоборот.
|
||||
$formatted = if ($el.formatted -eq $true) { "true" } else { "false" }
|
||||
X "$inner<Title formatted=`"$formatted`">"
|
||||
Emit-MLItems -val $labelTitle -indent "$inner`t"
|
||||
X "$inner</Title>"
|
||||
}
|
||||
if ($el.tooltip) { Emit-MLText -tag "ToolTip" -text $el.tooltip -indent $inner }
|
||||
if ($el.tooltipRepresentation) { X "$inner<ToolTipRepresentation>$($el.tooltipRepresentation)</ToolTipRepresentation>" }
|
||||
Emit-DecorationTitle -el $el -name $name -indent $inner -auto
|
||||
|
||||
Emit-CommonFlags -el $el -indent $inner
|
||||
|
||||
@@ -3297,7 +3305,7 @@ function Emit-PictureDecoration {
|
||||
X "$indent<PictureDecoration name=`"$name`" id=`"$id`">"
|
||||
$inner = "$indent`t"
|
||||
|
||||
Emit-Title -el $el -name $name -indent $inner
|
||||
Emit-DecorationTitle -el $el -name $name -indent $inner
|
||||
Emit-CommonFlags -el $el -indent $inner
|
||||
|
||||
if ($el.picture -or $el.src) {
|
||||
|
||||
Reference in New Issue
Block a user