mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-28 05:59:41 +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,4 +1,4 @@
|
||||
# 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
|
||||
param(
|
||||
[string]$JsonPath,
|
||||
@@ -1515,8 +1515,11 @@ function X {
|
||||
}
|
||||
|
||||
function Esc-Xml {
|
||||
# Экранирование ТЕКСТА элемента (<v8:content>, <Value>): только & < > .
|
||||
# Кавычки/апострофы в тексте экранировать НЕ нужно (1С их не экранирует — пишет литерально);
|
||||
# " ломал бы раундтрип. Кавычки спецсимвольны лишь в значениях атрибутов.
|
||||
param([string]$s)
|
||||
return $s.Replace('&','&').Replace('<','<').Replace('>','>').Replace('"','"')
|
||||
return $s.Replace('&','&').Replace('<','<').Replace('>','>')
|
||||
}
|
||||
|
||||
# --- 4. Multilang helper ---
|
||||
@@ -1956,7 +1959,7 @@ function Emit-Element {
|
||||
# radio-specific
|
||||
"radioButtonType"=1;"choiceList"=1;"columnsCount"=1;"checkBoxType"=1;"editMode"=1
|
||||
# naming & binding
|
||||
"name"=1;"path"=1;"title"=1
|
||||
"name"=1;"path"=1;"title"=1;"tooltip"=1
|
||||
# visibility & state
|
||||
"visible"=1;"hidden"=1;"enabled"=1;"disabled"=1;"readOnly"=1;"userVisible"=1
|
||||
# events ("events" — основной формат; on/handlers — legacy, принимаются ради совместимости)
|
||||
@@ -2091,6 +2094,8 @@ function Emit-Title {
|
||||
} elseif ($auto -and $name) {
|
||||
Emit-MLText -tag "Title" -text (Title-FromName -name $name) -indent $indent
|
||||
}
|
||||
# ToolTip элемента (всплывающая подсказка) — по схеме сразу после Title.
|
||||
if ($el.tooltip) { Emit-MLText -tag "ToolTip" -text $el.tooltip -indent $indent }
|
||||
}
|
||||
|
||||
function Map-TitleLoc {
|
||||
@@ -2525,6 +2530,7 @@ function Emit-Label {
|
||||
Emit-MLItems -val $labelTitle -indent "$inner`t"
|
||||
X "$inner</Title>"
|
||||
}
|
||||
if ($el.tooltip) { Emit-MLText -tag "ToolTip" -text $el.tooltip -indent $inner }
|
||||
|
||||
Emit-CommonFlags -el $el -indent $inner
|
||||
|
||||
@@ -2644,6 +2650,8 @@ function Emit-Pages {
|
||||
X "$indent<Pages name=`"$name`" id=`"$id`">"
|
||||
$inner = "$indent`t"
|
||||
|
||||
Emit-Title -el $el -name $name -indent $inner
|
||||
|
||||
if ($el.pagesRepresentation) {
|
||||
X "$inner<PagesRepresentation>$($el.pagesRepresentation)</PagesRepresentation>"
|
||||
}
|
||||
@@ -2906,6 +2914,8 @@ function Emit-CommandBar {
|
||||
X "$indent<CommandBar name=`"$name`" id=`"$id`">"
|
||||
$inner = "$indent`t"
|
||||
|
||||
Emit-Title -el $el -name $name -indent $inner
|
||||
|
||||
if ($el.autofill -eq $true) { X "$inner<Autofill>true</Autofill>" }
|
||||
|
||||
Emit-CommonFlags -el $el -indent $inner
|
||||
|
||||
Reference in New Issue
Block a user