mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-24 05:31:02 +03:00
feat(form-decompile,form-compile): заголовок реквизита — суппресс-маркер "" + omit авто-вывода (кластер Attribute>Title)
Компилятор для не-main реквизита БЕЗ ключа title додумывал <Title> из имени, хотя платформа реквизит без синонима хранит без <Title>. На корпусе (295609 реквизитов): 22% без <Title> — всем додумывался заголовок (ADDED Attribute>Title = 170 в выборке). Компилятор (ps1+py): эмиссия Title реквизита приведена к логике Emit-Title — нет ключа → авто-вывод (кроме main); title "" → подавить (раньше "" был falsy и уходил в авто-вывод — это и был баг); непустой → как есть. Декомпилятор (ps1): нет <Title> → title:"" (суппресс-маркер); ru-only заголовок, равный авто-выводу из имени → опускаем ключ (компилятор воспроизведёт, 35% = 103908 реквизитов корпуса); иначе → явный. Скопировано точное зеркало Title-FromName для сверки. Регресс: attributes-types.json — реквизит с title:"" (подавление) рядом с авто-выводом + снэпшот. spec §реквизиты обновлён. TOTAL diff lines выборки 2.17: 2255 → 1750 (−505); cascade ADDED 292 → 33. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
2367eaa353
commit
cfce486004
@@ -1,4 +1,4 @@
|
||||
# form-compile v1.61 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.62 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$JsonPath,
|
||||
@@ -3664,9 +3664,13 @@ function Emit-Attributes {
|
||||
X "$indent`t<Attribute name=`"$attrName`" id=`"$attrId`">"
|
||||
$inner = "$indent`t`t"
|
||||
|
||||
$attrTitle = if ($attr.title) { $attr.title } elseif ($attr.main -ne $true) { Title-FromName -name $attrName } else { '' }
|
||||
if ($attrTitle) {
|
||||
Emit-MLText -tag "Title" -text $attrTitle -indent $inner
|
||||
# Title атрибута (зеркало Emit-Title): нет ключа → авто-вывод из имени (кроме main);
|
||||
# title "" → подавить; непустой → эмитить как есть.
|
||||
$hasTitleKey = $null -ne $attr.PSObject.Properties['title']
|
||||
if ($hasTitleKey) {
|
||||
if ($attr.title) { Emit-MLText -tag "Title" -text $attr.title -indent $inner }
|
||||
} elseif ($attr.main -ne $true) {
|
||||
Emit-MLText -tag "Title" -text (Title-FromName -name $attrName) -indent $inner
|
||||
}
|
||||
|
||||
# Type
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# form-compile v1.61 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.62 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import copy
|
||||
@@ -3342,11 +3342,13 @@ def emit_attributes(lines, attrs, indent):
|
||||
lines.append(f'{indent}\t<Attribute name="{attr_name}" id="{attr_id}">')
|
||||
inner = f'{indent}\t\t'
|
||||
|
||||
attr_title = attr.get('title')
|
||||
if not attr_title and attr.get('main') is not True:
|
||||
attr_title = title_from_name(attr_name)
|
||||
if attr_title:
|
||||
emit_mltext(lines, inner, 'Title', attr_title)
|
||||
# Title атрибута (зеркало emit_title): нет ключа → авто-вывод из имени (кроме main);
|
||||
# title "" → подавить; непустой → эмитить как есть.
|
||||
if 'title' in attr:
|
||||
if attr.get('title'):
|
||||
emit_mltext(lines, inner, 'Title', attr['title'])
|
||||
elif attr.get('main') is not True:
|
||||
emit_mltext(lines, inner, 'Title', title_from_name(attr_name))
|
||||
|
||||
# Type
|
||||
if attr.get('type'):
|
||||
|
||||
Reference in New Issue
Block a user