mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-19 17:19:42 +03:00
Add relative column width support ("Nx" syntax) to mxl-compile
Allows specifying column widths as multiplier of defaultWidth (e.g. "2x", "0.5x") alongside absolute values. Makes template generation from images easier — model specifies proportions instead of exact pixel values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -123,7 +123,12 @@ function Parse-ColumnSpec {
|
|||||||
$colWidthMap = @{}
|
$colWidthMap = @{}
|
||||||
if ($def.columnWidths) {
|
if ($def.columnWidths) {
|
||||||
foreach ($prop in $def.columnWidths.PSObject.Properties) {
|
foreach ($prop in $def.columnWidths.PSObject.Properties) {
|
||||||
$width = [int]$prop.Value
|
$val = "$($prop.Value)"
|
||||||
|
if ($val -match '^([0-9.]+)x$') {
|
||||||
|
$width = [int][math]::Round([double]$Matches[1] * $defaultWidth)
|
||||||
|
} else {
|
||||||
|
$width = [int]$val
|
||||||
|
}
|
||||||
$columns = Parse-ColumnSpec $prop.Name
|
$columns = Parse-ColumnSpec $prop.Name
|
||||||
foreach ($c in $columns) {
|
foreach ($c in $columns) {
|
||||||
$colWidthMap[$c] = $width
|
$colWidthMap[$c] = $width
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
|------|:-----:|-----------|----------|
|
|------|:-----:|-----------|----------|
|
||||||
| `columns` | да | — | Количество колонок |
|
| `columns` | да | — | Количество колонок |
|
||||||
| `defaultWidth` | нет | 10 | Ширина колонок по умолчанию |
|
| `defaultWidth` | нет | 10 | Ширина колонок по умолчанию |
|
||||||
| `columnWidths` | нет | `{}` | Ширины колонок. Ключи 1-based: `"1"`, `"3-14"`, `"5,7,9"` |
|
| `columnWidths` | нет | `{}` | Ширины колонок. Ключи 1-based: `"1"`, `"3-14"`, `"5,7,9"`. Значения: число (абсолют) или `"Nx"` (множитель от defaultWidth, напр. `"2x"`, `"0.5x"`) |
|
||||||
| `fonts` | нет | — | Именованные шрифты (если не задано, создаётся Arial 10) |
|
| `fonts` | нет | — | Именованные шрифты (если не задано, создаётся Arial 10) |
|
||||||
| `styles` | нет | `{}` | Именованные стили |
|
| `styles` | нет | `{}` | Именованные стили |
|
||||||
| `areas` | да | — | Массив именованных областей (порядок = порядок в документе) |
|
| `areas` | да | — | Массив именованных областей (порядок = порядок в документе) |
|
||||||
|
|||||||
Reference in New Issue
Block a user