fix(form-decompile,form-compile): formatted у LabelDecoration независим от hyperlink (кластер formatted)

Компилятор выводил <Title formatted="…"> из hyperlink (formatted = hyperlink),
но это неверно: атрибут formatted НЕЗАВИСИМ. По корпусу acc+erp:
- 9080 label'ов: hyperlink есть, formatted=false (компилятор давал true);
- 6545: formatted=true без hyperlink (компилятор давал false).
Итого ~15625 расхождений.

Введён отдельный ключ formatted (bool, выводится при true):
- декомпилятор: захват атрибута <Title formatted> у LabelDecoration (независимо
  от <Hyperlink>);
- компилятор Emit-Label: formatted из ключа, не из hyperlink.

Декомпилятор (ps1) + компилятор (ps1+py) + spec (label.formatted). Снэпшот
events обновлён: label с hyperlink:true теперь даёт formatted="false" (фиксирует
развязку) — сертифицирован в 1С 8.3.24. Регресс ps+py 33/33.

Остаток <Title formatted> в раундтрипе принадлежит ExtendedTooltip-с-контентом
и PictureDecoration — отдельные кластеры (в BACKLOG).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-06-05 16:35:11 +03:00
parent 908af27bf0
commit 6857ad5060
5 changed files with 14 additions and 8 deletions
@@ -1,4 +1,4 @@
# form-compile v1.37 — Compile 1C managed form from JSON or object metadata
# form-compile v1.38 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$JsonPath,
@@ -1974,7 +1974,7 @@ function Emit-Element {
"spinButton"=1;"dropListButton"=1;"markIncomplete"=1;"skipOnInput"=1;"inputHint"=1
"textEdit"=1
# label/hyperlink
"hyperlink"=1
"hyperlink"=1;"formatted"=1
# group-specific
"showTitle"=1;"united"=1;"collapsed"=1
# hierarchy
@@ -2527,7 +2527,8 @@ function Emit-Label {
$hasTitleKey = $null -ne $el.PSObject.Properties['title']
$labelTitle = if ($hasTitleKey) { $el.title } else { Title-FromName -name $name }
if ($labelTitle) {
$formatted = if ($el.hyperlink -eq $true) { "true" } else { "false" }
# 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>"
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# form-compile v1.37 — Compile 1C managed form from JSON or object metadata
# form-compile v1.38 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import copy
@@ -1367,7 +1367,7 @@ KNOWN_KEYS = {
"multiLine", "passwordMode", "choiceButton", "clearButton",
"spinButton", "dropListButton", "markIncomplete", "skipOnInput", "inputHint",
"textEdit",
"hyperlink",
"hyperlink", "formatted",
"showTitle", "united", "collapsed",
"children", "columns",
"changeRowSet", "changeRowOrder", "header", "footer",
@@ -2177,7 +2177,8 @@ def emit_label(lines, el, name, eid, indent):
label_title = el['title'] if 'title' in el else title_from_name(name)
if label_title:
formatted = 'true' if el.get('hyperlink') is True else 'false'
# formatted — независимое свойство (НЕ выводится из hyperlink).
formatted = 'true' if el.get('formatted') is True else 'false'
lines.append(f'{inner}<Title formatted="{formatted}">')
emit_ml_items(lines, f'{inner}\t', label_title)
lines.append(f'{inner}</Title>')
@@ -1,4 +1,4 @@
# form-decompile v0.17 — Decompile 1C managed Form.xml to JSON DSL (draft)
# form-decompile v0.18 — Decompile 1C managed Form.xml to JSON DSL (draft)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
param(
@@ -399,6 +399,9 @@ function Decompile-Element {
$obj[$key] = $name
Add-CommonProps $obj $node $name
if ((Get-Child $node 'Hyperlink') -eq 'true') { $obj['hyperlink'] = $true }
# formatted — атрибут <Title formatted="…">, НЕЗАВИСИМ от hyperlink (true → ключ, false → опускаем)
$tiNode = $node.SelectSingleNode("lf:Title", $ns)
if ($tiNode -and $tiNode.GetAttribute('formatted') -eq 'true') { $obj['formatted'] = $true }
}
'LabelField' {
$obj[$key] = $name
+1
View File
@@ -276,6 +276,7 @@
|----------|-----|----------|
| `title` | string | Текст надписи |
| `hyperlink` | bool | Режим гиперссылки |
| `formatted` | bool | Форматированный текст (`<Title formatted="true">`). **Независим от `hyperlink`** — выводится только при `true` |
| `width` | int | Ширина |
| `height` | int | Высота |
| `autoMaxWidth` | bool | Автомаксимальная ширина |
@@ -31,7 +31,7 @@
</Events>
</InputField>
<LabelDecoration name="Подсказка" id="7">
<Title formatted="true">
<Title formatted="false">
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Нажмите для перехода</v8:content>