mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-30 16:36:56 +03:00
feat(form-decompile,form-compile): tooltip элемента + фикс экранирования текста (кластер ToolTip)
Два дефекта вокруг текста <v8:content>, оба вскрылись на формах с подсказками.
1. ToolTip элемента (484 LOST в корпусе). <ToolTip> — прямой мультиязычный
текст подсказки на элементе (UsualGroup 42150, Popup, Page, InputField,
и почти все типы). Декомпилятор пропускал (как companion), компилятор не
эмитил. Введён общий ключ tooltip (string|{ru,en}), как title:
- декомпилятор: захват в Add-CommonProps;
- компилятор: эмиссия в Emit-Title (сразу после Title) — покрывает все
эмиттеры, зовущие Emit-Title.
Попутно выяснилось, что Emit-Pages/Emit-CommandBar вовсе не звали Emit-Title
(теряли и Title, и ToolTip), а Emit-Label эмитит Title по-своему — во все три
добавлена обработка title/tooltip.
2. Экранирование кавычек. Esc-Xml экранировал " → " в тексте элемента,
но 1С в <v8:content> пишет " литерально (экранирует только & < >).
Это ломало раундтрип любого текста с кавычками. Убрано экранирование " .
Декомпилятор (ps1) + компилятор (ps1+py) + spec (§4.1 tooltip). Покрытие:
input-fields (input+tooltip), pages (pages/page tooltip, page с кавычкой в
тексте — проверяет литеральность) — сертифицировано в 1С 8.3.24. Раундтрип
БанковскиеСчета/Wildberries/АдреснаяКнига: ToolTip и " остаток = 0.
Регресс ps+py 33/33.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
c43041c0b7
commit
22e929ecb3
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# form-compile v1.34 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.36 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import copy
|
||||
@@ -1251,7 +1251,9 @@ def generate_chart_of_accounts_choice_dsl(meta, preset_data):
|
||||
|
||||
|
||||
def esc_xml(s):
|
||||
return s.replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"')
|
||||
# Экранирование ТЕКСТА элемента (<v8:content>, <Value>): только & < > .
|
||||
# Кавычки/апострофы в тексте 1С не экранирует (пишет литерально) — " ломал бы раундтрип.
|
||||
return s.replace('&', '&').replace('<', '<').replace('>', '>')
|
||||
|
||||
|
||||
def emit_ml_items(lines, indent, val):
|
||||
@@ -1354,7 +1356,7 @@ KNOWN_KEYS = {
|
||||
"button", "picture", "picField", "calendar", "cmdBar", "popup",
|
||||
"showInHeader",
|
||||
"radioButtonType", "choiceList", "columnsCount", "checkBoxType", "editMode",
|
||||
"name", "path", "title",
|
||||
"name", "path", "title", "tooltip",
|
||||
"visible", "hidden", "enabled", "disabled", "readOnly", "userVisible",
|
||||
"events", "on", "handlers",
|
||||
"selectionMode", "showCurrentDate", "widthInMonths", "heightInMonths", "showMonthsPanel",
|
||||
@@ -1673,6 +1675,9 @@ def emit_title(lines, el, name, indent, auto=False):
|
||||
emit_mltext(lines, indent, 'Title', el['title'])
|
||||
elif auto and name:
|
||||
emit_mltext(lines, indent, 'Title', title_from_name(name))
|
||||
# ToolTip элемента (всплывающая подсказка) — по схеме сразу после Title.
|
||||
if el.get('tooltip'):
|
||||
emit_mltext(lines, indent, 'ToolTip', el['tooltip'])
|
||||
|
||||
|
||||
_TITLE_LOC_MAP = {'none': 'None', 'left': 'Left', 'right': 'Right', 'top': 'Top', 'bottom': 'Bottom', 'auto': 'Auto'}
|
||||
@@ -2173,6 +2178,8 @@ def emit_label(lines, el, name, eid, indent):
|
||||
lines.append(f'{inner}<Title formatted="{formatted}">')
|
||||
emit_ml_items(lines, f'{inner}\t', label_title)
|
||||
lines.append(f'{inner}</Title>')
|
||||
if el.get('tooltip'):
|
||||
emit_mltext(lines, inner, 'ToolTip', el['tooltip'])
|
||||
|
||||
emit_common_flags(lines, el, inner)
|
||||
|
||||
@@ -2301,6 +2308,8 @@ def emit_pages(lines, el, name, eid, indent):
|
||||
lines.append(f'{indent}<Pages name="{name}" id="{eid}">')
|
||||
inner = f'{indent}\t'
|
||||
|
||||
emit_title(lines, el, name, inner)
|
||||
|
||||
if el.get('pagesRepresentation'):
|
||||
lines.append(f'{inner}<PagesRepresentation>{el["pagesRepresentation"]}</PagesRepresentation>')
|
||||
|
||||
@@ -2535,6 +2544,8 @@ def emit_command_bar(lines, el, name, eid, indent):
|
||||
lines.append(f'{indent}<CommandBar name="{name}" id="{eid}">')
|
||||
inner = f'{indent}\t'
|
||||
|
||||
emit_title(lines, el, name, inner)
|
||||
|
||||
if el.get('autofill') is True:
|
||||
lines.append(f'{inner}<Autofill>true</Autofill>')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user