mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-12 17:04:57 +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
|
||||
```
|
||||
|
||||
### 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`)
|
||||
|
||||
Shows static text (labels, headers) and template strings with `[Param]` placeholders:
|
||||
|
||||
@@ -132,14 +132,26 @@ function Get-CellData {
|
||||
$results += $entry
|
||||
}
|
||||
|
||||
if ($includeText -and $tl) {
|
||||
if ($tl) {
|
||||
$content = $tl.SelectSingleNode("v8:item/v8:content", $ns)
|
||||
if ($content -and $content.InnerText) {
|
||||
$text = $content.InnerText
|
||||
# Detect if this is a Template (has [...] placeholders)
|
||||
if ($text -match '\[.+\]') {
|
||||
$results += @{ Kind = "Template"; Value = $text }
|
||||
} else {
|
||||
$isTemplate = $text -match '\[.+\]'
|
||||
|
||||
if ($isTemplate) {
|
||||
# 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 }
|
||||
}
|
||||
}
|
||||
@@ -175,8 +187,9 @@ function Get-AreaCellData {
|
||||
$params += $c.Value
|
||||
if ($c.Detail) { $details += "$($c.Value)->$($c.Detail)" }
|
||||
}
|
||||
"Text" { $texts += $c.Value }
|
||||
"Template" { $templates += $c.Value }
|
||||
"TemplateParam" { $params += "$($c.Value) [tpl]" }
|
||||
"Text" { $texts += $c.Value }
|
||||
"Template" { $templates += $c.Value }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,6 +242,7 @@ foreach ($r in $rowMap.Keys | Sort-Object) {
|
||||
$outsideParams += $c.Value
|
||||
if ($c.Detail) { $outsideDetails += "$($c.Value)->$($c.Detail)" }
|
||||
}
|
||||
"TemplateParam" { $outsideParams += "$($c.Value) [tpl]" }
|
||||
"Text" { $outsideTexts += $c.Value }
|
||||
"Template" { $outsideTemplates += $c.Value }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user