mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-28 23:51:03 +03:00
Improve mxl-info output and document how to read it
Script improvements: - Sort areas by position (top-to-bottom) instead of alphabetically - Extract detailParameter (drill-down links) - Show column set sizes in header and per-area [colset 20cols] - Detect Rows+Columns intersections with GetArea hint SKILL.md: add "Reading the Output" section explaining area order, column sets, intersections, detailParameter, and text content. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
76a0dd80be
commit
1a79e84598
@@ -54,42 +54,89 @@ Additional flags:
|
|||||||
... -Offset 150 # pagination: skip first 150 lines
|
... -Offset 150 # pagination: skip first 150 lines
|
||||||
```
|
```
|
||||||
|
|
||||||
## Output (text mode)
|
## Reading the Output
|
||||||
|
|
||||||
|
### Areas — sorted top-to-bottom
|
||||||
|
|
||||||
|
Areas are listed in document order (by row position), not alphabetically. This matches the order you'll use in fill code — output areas from top to bottom.
|
||||||
|
|
||||||
```
|
```
|
||||||
=== TemplName ===
|
|
||||||
Rows: 40, Columns: 33
|
|
||||||
Column sets: 1 (default only)
|
|
||||||
|
|
||||||
--- Named areas ---
|
--- Named areas ---
|
||||||
Заголовок Rows rows 1-4 (1 params)
|
Заголовок Rows rows 1-4 (1 params)
|
||||||
|
Поставщик Rows rows 5-6 (1 params)
|
||||||
Строка Rows rows 14-14 (8 params)
|
Строка Rows rows 14-14 (8 params)
|
||||||
Итого Rows rows 16-17 (1 params)
|
Итого Rows rows 16-17 (1 params)
|
||||||
|
|
||||||
--- Parameters by area ---
|
|
||||||
Заголовок: ТекстЗаголовка
|
|
||||||
Строка: НомерСтроки, Товар, Количество, Цена, Сумма, ... (+3)
|
|
||||||
Итого: Всего
|
|
||||||
|
|
||||||
--- Stats ---
|
|
||||||
Merges: 43
|
|
||||||
Drawings: 0
|
|
||||||
```
|
```
|
||||||
|
|
||||||
With `-WithText`, adds a section showing static text (labels, headers) and template strings:
|
Area types:
|
||||||
|
- **Rows** — horizontal area (row range). Use: `Макет.ПолучитьОбласть("Имя")`
|
||||||
|
- **Columns** — vertical area (column range). Use: `Макет.ПолучитьОбласть("Имя")`
|
||||||
|
- **Rectangle** — fixed area (rows + cols). Typically uses a separate column set.
|
||||||
|
- **Drawing** — named picture/barcode.
|
||||||
|
|
||||||
|
### Column sets
|
||||||
|
|
||||||
|
When template has multiple column sets, sizes are shown in header and per-area:
|
||||||
|
|
||||||
|
```
|
||||||
|
Column sets: 7 (default=19 cols + 6 additional)
|
||||||
|
f01e015f...: 17 cols
|
||||||
|
0adf41ed...: 4 cols
|
||||||
|
...
|
||||||
|
Подвал Rows rows 30-34 (5 params) [colset 14cols]
|
||||||
|
НумерацияЛистов Rows rows 59-59 (0 params) [colset 4cols]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Intersections
|
||||||
|
|
||||||
|
When both Rows and Columns areas exist (labels, price tags), the script lists intersection pairs:
|
||||||
|
|
||||||
|
```
|
||||||
|
--- Intersections (use with GetArea) ---
|
||||||
|
ВысотаЭтикетки|ШиринаЭтикетки
|
||||||
|
```
|
||||||
|
|
||||||
|
Use in BSL: `Макет.ПолучитьОбласть("ВысотаЭтикетки|ШиринаЭтикетки")`
|
||||||
|
|
||||||
|
### Parameters and detailParameter
|
||||||
|
|
||||||
|
Parameters are listed per area. If a parameter has a `detailParameter` (drill-down link), it's shown below:
|
||||||
|
|
||||||
|
```
|
||||||
|
--- Parameters by area ---
|
||||||
|
Поставщик: ПредставлениеПоставщика
|
||||||
|
detail: ПредставлениеПоставщика->Поставщик
|
||||||
|
Строка: НомерСтроки, Товар, Количество, Цена, Сумма, ... (+3)
|
||||||
|
detail: Товар->Номенклатура
|
||||||
|
```
|
||||||
|
|
||||||
|
This means: parameter `Товар` shows the value, and clicking it opens `Номенклатура` (the detail object).
|
||||||
|
|
||||||
|
In BSL:
|
||||||
|
```bsl
|
||||||
|
Область.Параметры.Товар = СтрокаТЧ.Номенклатура;
|
||||||
|
Область.Параметры.РасшифровкаТовар = СтрокаТЧ.Номенклатура; // detailParameter
|
||||||
|
```
|
||||||
|
|
||||||
|
### Text content (`-WithText`)
|
||||||
|
|
||||||
|
Shows static text (labels, headers) and template strings with `[Param]` placeholders:
|
||||||
|
|
||||||
```
|
```
|
||||||
--- Text content ---
|
--- Text content ---
|
||||||
ШапкаТаблицы:
|
ШапкаТаблицы:
|
||||||
Text: "№", "Товар", "Ед. изм.", "Кол-во", "Цена", "Сумма"
|
Text: "№", "Товар", "Ед. изм.", "Кол-во", "Цена", "Сумма"
|
||||||
Строка:
|
Строка:
|
||||||
Templates: "[НомерСтроки]", "[Товар] ([Артикул])"
|
Templates: "Инв № [ИнвентарныйНомер]"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Text** — static labels (fillType=Text). Useful to understand column meaning.
|
||||||
|
- **Templates** — text with `[ParamName]` substitutions (fillType=Template). The param inside `[]` is filled programmatically.
|
||||||
|
|
||||||
## When to Use
|
## When to Use
|
||||||
|
|
||||||
- **Before writing fill code**: run `/mxl-info` to understand the template structure, then write BSL code based on area names and parameter lists
|
- **Before writing fill code**: run `/mxl-info` to understand area names and parameter lists, then write BSL output code following the top-to-bottom area order
|
||||||
- **With `-WithText`**: when you need context about what labels/headers surround the parameters
|
- **With `-WithText`**: when you need context — column headers, labels next to parameters, template patterns
|
||||||
- **With `-Format json`**: when you need structured data for programmatic processing
|
- **With `-Format json`**: when you need structured data for programmatic processing
|
||||||
- **For existing templates**: analyze uploaded or configuration templates without reading raw XML
|
- **For existing templates**: analyze uploaded or configuration templates without reading raw XML
|
||||||
|
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ function Get-AreaCellData {
|
|||||||
)
|
)
|
||||||
|
|
||||||
$params = @()
|
$params = @()
|
||||||
|
$details = @()
|
||||||
$texts = @()
|
$texts = @()
|
||||||
$templates = @()
|
$templates = @()
|
||||||
|
|
||||||
@@ -170,7 +171,10 @@ function Get-AreaCellData {
|
|||||||
$cells = Get-CellData -rowNode $rowMap[$r] -ns $ns -includeText $includeText
|
$cells = Get-CellData -rowNode $rowMap[$r] -ns $ns -includeText $includeText
|
||||||
foreach ($c in $cells) {
|
foreach ($c in $cells) {
|
||||||
switch ($c.Kind) {
|
switch ($c.Kind) {
|
||||||
"Parameter" { $params += $c.Value }
|
"Parameter" {
|
||||||
|
$params += $c.Value
|
||||||
|
if ($c.Detail) { $details += "$($c.Value)->$($c.Detail)" }
|
||||||
|
}
|
||||||
"Text" { $texts += $c.Value }
|
"Text" { $texts += $c.Value }
|
||||||
"Template" { $templates += $c.Value }
|
"Template" { $templates += $c.Value }
|
||||||
}
|
}
|
||||||
@@ -178,9 +182,14 @@ function Get-AreaCellData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return @{ Params = $params; Texts = $texts; Templates = $templates }
|
return @{ Params = $params; Details = $details; Texts = $texts; Templates = $templates }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Sort areas by position: Rows by beginRow, Columns by beginCol, Rectangle by beginRow
|
||||||
|
$namedAreas = $namedAreas | Sort-Object {
|
||||||
|
if ($_.AreaType -eq "Columns") { $_.BeginCol } else { $_.BeginRow }
|
||||||
|
}, { $_.Name }
|
||||||
|
|
||||||
# Collect data for each area
|
# Collect data for each area
|
||||||
$areaData = @()
|
$areaData = @()
|
||||||
$coveredRows = @{}
|
$coveredRows = @{}
|
||||||
@@ -190,6 +199,7 @@ foreach ($area in $namedAreas) {
|
|||||||
$areaData += @{
|
$areaData += @{
|
||||||
Area = $area
|
Area = $area
|
||||||
Params = $data.Params
|
Params = $data.Params
|
||||||
|
Details = $data.Details
|
||||||
Texts = $data.Texts
|
Texts = $data.Texts
|
||||||
Templates = $data.Templates
|
Templates = $data.Templates
|
||||||
}
|
}
|
||||||
@@ -206,6 +216,7 @@ foreach ($area in $namedAreas) {
|
|||||||
|
|
||||||
# Find parameters outside named areas
|
# Find parameters outside named areas
|
||||||
$outsideParams = @()
|
$outsideParams = @()
|
||||||
|
$outsideDetails = @()
|
||||||
$outsideTexts = @()
|
$outsideTexts = @()
|
||||||
$outsideTemplates = @()
|
$outsideTemplates = @()
|
||||||
|
|
||||||
@@ -214,7 +225,10 @@ foreach ($r in $rowMap.Keys | Sort-Object) {
|
|||||||
$cells = Get-CellData -rowNode $rowMap[$r] -ns $nsMgr -includeText $WithText
|
$cells = Get-CellData -rowNode $rowMap[$r] -ns $nsMgr -includeText $WithText
|
||||||
foreach ($c in $cells) {
|
foreach ($c in $cells) {
|
||||||
switch ($c.Kind) {
|
switch ($c.Kind) {
|
||||||
"Parameter" { $outsideParams += $c.Value }
|
"Parameter" {
|
||||||
|
$outsideParams += $c.Value
|
||||||
|
if ($c.Detail) { $outsideDetails += "$($c.Value)->$($c.Detail)" }
|
||||||
|
}
|
||||||
"Text" { $outsideTexts += $c.Value }
|
"Text" { $outsideTexts += $c.Value }
|
||||||
"Template" { $outsideTemplates += $c.Value }
|
"Template" { $outsideTemplates += $c.Value }
|
||||||
}
|
}
|
||||||
@@ -300,7 +314,10 @@ $lines += " Rows: $docHeight, Columns: $defaultColCount"
|
|||||||
if ($columnSets.Count -eq 0) {
|
if ($columnSets.Count -eq 0) {
|
||||||
$lines += " Column sets: 1 (default only)"
|
$lines += " Column sets: 1 (default only)"
|
||||||
} else {
|
} else {
|
||||||
$lines += " Column sets: $($columnSets.Count + 1) (default + $($columnSets.Count) additional)"
|
$lines += " Column sets: $($columnSets.Count + 1) (default=$defaultColCount cols + $($columnSets.Count) additional)"
|
||||||
|
foreach ($cs in $columnSets) {
|
||||||
|
$lines += " $($cs.Id.Substring(0,8))...: $($cs.Size) cols"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$lines += ""
|
$lines += ""
|
||||||
@@ -319,7 +336,11 @@ foreach ($ad in $areaData) {
|
|||||||
|
|
||||||
$colsInfo = ""
|
$colsInfo = ""
|
||||||
if ($a.ColumnsID) {
|
if ($a.ColumnsID) {
|
||||||
$colsInfo = " [colset]"
|
$csSize = ""
|
||||||
|
foreach ($cs in $columnSets) {
|
||||||
|
if ($cs.Id -eq $a.ColumnsID) { $csSize = " $($cs.Size)cols"; break }
|
||||||
|
}
|
||||||
|
$colsInfo = " [colset$csSize]"
|
||||||
}
|
}
|
||||||
|
|
||||||
$paramInfo = "($paramCount params)"
|
$paramInfo = "($paramCount params)"
|
||||||
@@ -333,6 +354,26 @@ foreach ($nd in $namedDrawings) {
|
|||||||
$lines += " $nameStr Drawing drawingID=$($nd.DrawingID)"
|
$lines += " $nameStr Drawing drawingID=$($nd.DrawingID)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Detect intersection pairs (Rows + Columns areas that overlap)
|
||||||
|
$rowsAreas = $areaData | Where-Object { $_.Area.AreaType -eq "Rows" }
|
||||||
|
$colsAreas = $areaData | Where-Object { $_.Area.AreaType -eq "Columns" }
|
||||||
|
$intersections = @()
|
||||||
|
if ($rowsAreas -and $colsAreas) {
|
||||||
|
foreach ($ra in $rowsAreas) {
|
||||||
|
foreach ($ca in $colsAreas) {
|
||||||
|
$intersections += "$($ra.Area.Name)|$($ca.Area.Name)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($intersections.Count -gt 0) {
|
||||||
|
$lines += ""
|
||||||
|
$lines += "--- Intersections (use with GetArea) ---"
|
||||||
|
foreach ($pair in $intersections) {
|
||||||
|
$lines += " $pair"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Parameters by area
|
# Parameters by area
|
||||||
$hasParams = ($areaData | Where-Object { $_.Params.Count -gt 0 }) -or ($outsideParams.Count -gt 0)
|
$hasParams = ($areaData | Where-Object { $_.Params.Count -gt 0 }) -or ($outsideParams.Count -gt 0)
|
||||||
|
|
||||||
@@ -343,11 +384,20 @@ if ($hasParams) {
|
|||||||
if ($ad.Params.Count -gt 0) {
|
if ($ad.Params.Count -gt 0) {
|
||||||
$paramStr = Truncate-List -items $ad.Params -max $MaxParams
|
$paramStr = Truncate-List -items $ad.Params -max $MaxParams
|
||||||
$lines += " $($ad.Area.Name): $paramStr"
|
$lines += " $($ad.Area.Name): $paramStr"
|
||||||
|
# Show detailParameters if any
|
||||||
|
if ($ad.Details.Count -gt 0) {
|
||||||
|
$detailStr = Truncate-List -items $ad.Details -max $MaxParams
|
||||||
|
$lines += " detail: $detailStr"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($outsideParams.Count -gt 0) {
|
if ($outsideParams.Count -gt 0) {
|
||||||
$paramStr = Truncate-List -items $outsideParams -max $MaxParams
|
$paramStr = Truncate-List -items $outsideParams -max $MaxParams
|
||||||
$lines += " (outside areas): $paramStr"
|
$lines += " (outside areas): $paramStr"
|
||||||
|
if ($outsideDetails.Count -gt 0) {
|
||||||
|
$detailStr = Truncate-List -items $outsideDetails -max $MaxParams
|
||||||
|
$lines += " detail: $detailStr"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user