From 1a79e845988979a0196cacb090803bd5d652b37f Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 8 Feb 2026 16:11:54 +0300 Subject: [PATCH] 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 --- .claude/skills/mxl-info/SKILL.md | 83 +++++++++++++++----- .claude/skills/mxl-info/scripts/mxl-info.ps1 | 60 ++++++++++++-- 2 files changed, 120 insertions(+), 23 deletions(-) diff --git a/.claude/skills/mxl-info/SKILL.md b/.claude/skills/mxl-info/SKILL.md index 82a777e3..724300b8 100644 --- a/.claude/skills/mxl-info/SKILL.md +++ b/.claude/skills/mxl-info/SKILL.md @@ -54,42 +54,89 @@ Additional flags: ... -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 --- Заголовок Rows rows 1-4 (1 params) + Поставщик Rows rows 5-6 (1 params) Строка Rows rows 14-14 (8 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: "№", "Товар", "Ед. изм.", "Кол-во", "Цена", "Сумма" Строка: - 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 -- **Before writing fill code**: run `/mxl-info` to understand the template structure, then write BSL code based on area names and parameter lists -- **With `-WithText`**: when you need context about what labels/headers surround the parameters +- **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 — column headers, labels next to parameters, template patterns - **With `-Format json`**: when you need structured data for programmatic processing - **For existing templates**: analyze uploaded or configuration templates without reading raw XML diff --git a/.claude/skills/mxl-info/scripts/mxl-info.ps1 b/.claude/skills/mxl-info/scripts/mxl-info.ps1 index 6b954901..46aa4e6c 100644 --- a/.claude/skills/mxl-info/scripts/mxl-info.ps1 +++ b/.claude/skills/mxl-info/scripts/mxl-info.ps1 @@ -157,6 +157,7 @@ function Get-AreaCellData { ) $params = @() + $details = @() $texts = @() $templates = @() @@ -170,7 +171,10 @@ function Get-AreaCellData { $cells = Get-CellData -rowNode $rowMap[$r] -ns $ns -includeText $includeText foreach ($c in $cells) { switch ($c.Kind) { - "Parameter" { $params += $c.Value } + "Parameter" { + $params += $c.Value + if ($c.Detail) { $details += "$($c.Value)->$($c.Detail)" } + } "Text" { $texts += $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 $areaData = @() $coveredRows = @{} @@ -190,6 +199,7 @@ foreach ($area in $namedAreas) { $areaData += @{ Area = $area Params = $data.Params + Details = $data.Details Texts = $data.Texts Templates = $data.Templates } @@ -206,6 +216,7 @@ foreach ($area in $namedAreas) { # Find parameters outside named areas $outsideParams = @() +$outsideDetails = @() $outsideTexts = @() $outsideTemplates = @() @@ -214,7 +225,10 @@ foreach ($r in $rowMap.Keys | Sort-Object) { $cells = Get-CellData -rowNode $rowMap[$r] -ns $nsMgr -includeText $WithText foreach ($c in $cells) { switch ($c.Kind) { - "Parameter" { $outsideParams += $c.Value } + "Parameter" { + $outsideParams += $c.Value + if ($c.Detail) { $outsideDetails += "$($c.Value)->$($c.Detail)" } + } "Text" { $outsideTexts += $c.Value } "Template" { $outsideTemplates += $c.Value } } @@ -300,7 +314,10 @@ $lines += " Rows: $docHeight, Columns: $defaultColCount" if ($columnSets.Count -eq 0) { $lines += " Column sets: 1 (default only)" } 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 += "" @@ -319,7 +336,11 @@ foreach ($ad in $areaData) { $colsInfo = "" 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)" @@ -333,6 +354,26 @@ foreach ($nd in $namedDrawings) { $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 $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) { $paramStr = Truncate-List -items $ad.Params -max $MaxParams $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) { $paramStr = Truncate-List -items $outsideParams -max $MaxParams $lines += " (outside areas): $paramStr" + if ($outsideDetails.Count -gt 0) { + $detailStr = Truncate-List -items $outsideDetails -max $MaxParams + $lines += " detail: $detailStr" + } } }