mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-13 22:35:16 +03:00
Extract template parameters without -WithText flag
Parameters from [ParamName] placeholders in template text are now always extracted and shown with [tpl] suffix. Numeric-only placeholders like [5] (footnote references in legal forms) are filtered out. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -118,6 +118,22 @@ In BSL:
|
|||||||
Область.Параметры.РасшифровкаТовар = СтрокаТЧ.Номенклатура; // detailParameter
|
Область.Параметры.РасшифровкаТовар = СтрокаТЧ.Номенклатура; // detailParameter
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Template parameters (`[tpl]` suffix)
|
||||||
|
|
||||||
|
Some parameters are embedded in template text: `"Инв № [ИнвентарныйНомер]"`. These are filled via fillType=Template, not fillType=Parameter. The script always extracts them and marks with `[tpl]`:
|
||||||
|
|
||||||
|
```
|
||||||
|
НумерацияЛистов: Номер [tpl], Дата [tpl], НомерЛиста [tpl]
|
||||||
|
```
|
||||||
|
|
||||||
|
In BSL, template parameters are filled the same way as regular ones:
|
||||||
|
```bsl
|
||||||
|
Область.Параметры.Номер = НомерДокумента;
|
||||||
|
Область.Параметры.Дата = ДатаДокумента;
|
||||||
|
```
|
||||||
|
|
||||||
|
Numeric-only placeholders like `[5]`, `[6]` (footnote references in legal forms) are ignored.
|
||||||
|
|
||||||
### Text content (`-WithText`)
|
### Text content (`-WithText`)
|
||||||
|
|
||||||
Shows static text (labels, headers) and template strings with `[Param]` placeholders:
|
Shows static text (labels, headers) and template strings with `[Param]` placeholders:
|
||||||
|
|||||||
@@ -132,14 +132,26 @@ function Get-CellData {
|
|||||||
$results += $entry
|
$results += $entry
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($includeText -and $tl) {
|
if ($tl) {
|
||||||
$content = $tl.SelectSingleNode("v8:item/v8:content", $ns)
|
$content = $tl.SelectSingleNode("v8:item/v8:content", $ns)
|
||||||
if ($content -and $content.InnerText) {
|
if ($content -and $content.InnerText) {
|
||||||
$text = $content.InnerText
|
$text = $content.InnerText
|
||||||
# Detect if this is a Template (has [...] placeholders)
|
$isTemplate = $text -match '\[.+\]'
|
||||||
if ($text -match '\[.+\]') {
|
|
||||||
$results += @{ Kind = "Template"; Value = $text }
|
if ($isTemplate) {
|
||||||
} else {
|
# Always extract parameter names from [Param] placeholders
|
||||||
|
# Skip numeric-only like [5] — these are footnote refs in legal forms
|
||||||
|
foreach ($m in [regex]::Matches($text, '\[([^\]]+)\]')) {
|
||||||
|
$val = $m.Groups[1].Value
|
||||||
|
if ($val -notmatch '^\d+$') {
|
||||||
|
$results += @{ Kind = "TemplateParam"; Value = $val }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Full template text only with -WithText
|
||||||
|
if ($includeText) {
|
||||||
|
$results += @{ Kind = "Template"; Value = $text }
|
||||||
|
}
|
||||||
|
} elseif ($includeText) {
|
||||||
$results += @{ Kind = "Text"; Value = $text }
|
$results += @{ Kind = "Text"; Value = $text }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,8 +187,9 @@ function Get-AreaCellData {
|
|||||||
$params += $c.Value
|
$params += $c.Value
|
||||||
if ($c.Detail) { $details += "$($c.Value)->$($c.Detail)" }
|
if ($c.Detail) { $details += "$($c.Value)->$($c.Detail)" }
|
||||||
}
|
}
|
||||||
"Text" { $texts += $c.Value }
|
"TemplateParam" { $params += "$($c.Value) [tpl]" }
|
||||||
"Template" { $templates += $c.Value }
|
"Text" { $texts += $c.Value }
|
||||||
|
"Template" { $templates += $c.Value }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -229,6 +242,7 @@ foreach ($r in $rowMap.Keys | Sort-Object) {
|
|||||||
$outsideParams += $c.Value
|
$outsideParams += $c.Value
|
||||||
if ($c.Detail) { $outsideDetails += "$($c.Value)->$($c.Detail)" }
|
if ($c.Detail) { $outsideDetails += "$($c.Value)->$($c.Detail)" }
|
||||||
}
|
}
|
||||||
|
"TemplateParam" { $outsideParams += "$($c.Value) [tpl]" }
|
||||||
"Text" { $outsideTexts += $c.Value }
|
"Text" { $outsideTexts += $c.Value }
|
||||||
"Template" { $outsideTemplates += $c.Value }
|
"Template" { $outsideTemplates += $c.Value }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user