mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-24 21:51:02 +03:00
Improve /meta-info: Russian translations, sorting, Constants/Reports support
- Translate cfg:Characteristic.X → Характеристика.X (in both v8:Type and v8:TypeSet) - Translate drill-down values to Russian: Indexing, Use, FillValue - Translate truncation message to Russian - Add Constant type display and Report MainDCS/forms/templates in overview - Add DataProcessor forms/templates/commands in overview mode - Sort attributes ref-first (references before primitives) in overview/full Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
92dc00e152
commit
bd30e48dae
@@ -142,6 +142,8 @@ function Format-Type($typeNode) {
|
|||||||
$raw = $t.InnerText
|
$raw = $t.InnerText
|
||||||
if ($raw -match '^cfg:DefinedType\.(.+)$') {
|
if ($raw -match '^cfg:DefinedType\.(.+)$') {
|
||||||
$types += "ОпределяемыйТип.$($Matches[1])"
|
$types += "ОпределяемыйТип.$($Matches[1])"
|
||||||
|
} elseif ($raw -match '^cfg:Characteristic\.(.+)$') {
|
||||||
|
$types += "Характеристика.$($Matches[1])"
|
||||||
} else {
|
} else {
|
||||||
$types += $raw
|
$types += $raw
|
||||||
}
|
}
|
||||||
@@ -194,6 +196,10 @@ function Format-SingleType([string]$raw, $parentNode) {
|
|||||||
if ($raw -match '^cfg:EnumRef\.(.+)$') {
|
if ($raw -match '^cfg:EnumRef\.(.+)$') {
|
||||||
return "ПеречислениеСсылка.$($Matches[1])"
|
return "ПеречислениеСсылка.$($Matches[1])"
|
||||||
}
|
}
|
||||||
|
# cfg:Characteristic.Xxx
|
||||||
|
if ($raw -match '^cfg:Characteristic\.(.+)$') {
|
||||||
|
return "Характеристика.$($Matches[1])"
|
||||||
|
}
|
||||||
# cfg:DefinedType.Xxx
|
# cfg:DefinedType.Xxx
|
||||||
if ($raw -match '^cfg:DefinedType\.(.+)$') {
|
if ($raw -match '^cfg:DefinedType\.(.+)$') {
|
||||||
return "ОпределяемыйТип.$($Matches[1])"
|
return "ОпределяемыйТип.$($Matches[1])"
|
||||||
@@ -287,6 +293,20 @@ function Get-SimpleChildren($parentNode, [string]$tag) {
|
|||||||
return $result
|
return $result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Sort-AttrsRefFirst($attrs) {
|
||||||
|
$refs = @()
|
||||||
|
$prims = @()
|
||||||
|
foreach ($a in $attrs) {
|
||||||
|
$t = $a.Type
|
||||||
|
if ($t -match 'Ссылка\.' -or $t -match 'Характеристика\.' -or $t -match 'ОпределяемыйТип\.' -or $t -match 'ПланСчетовСсылка' -or $t -match 'ПВХСсылка' -or $t -match 'ПВРСсылка') {
|
||||||
|
$refs += $a
|
||||||
|
} else {
|
||||||
|
$prims += $a
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return @($refs) + @($prims)
|
||||||
|
}
|
||||||
|
|
||||||
function Decline-Cols([int]$n) {
|
function Decline-Cols([int]$n) {
|
||||||
$m = $n % 10
|
$m = $n % 10
|
||||||
$h = $n % 100
|
$h = $n % 100
|
||||||
@@ -326,14 +346,29 @@ if ($Name -and $childObjs) {
|
|||||||
$fc = $ap.SelectSingleNode("md:FillChecking", $ns)
|
$fc = $ap.SelectSingleNode("md:FillChecking", $ns)
|
||||||
Out " Обязательный: $(if ($fc -and $fc.InnerText -eq 'ShowError') { 'да' } else { 'нет' })"
|
Out " Обязательный: $(if ($fc -and $fc.InnerText -eq 'ShowError') { 'да' } else { 'нет' })"
|
||||||
$idx = $ap.SelectSingleNode("md:Indexing", $ns)
|
$idx = $ap.SelectSingleNode("md:Indexing", $ns)
|
||||||
Out " Индексирование: $(if ($idx) { $idx.InnerText } else { 'нет' })"
|
$idxRu = if (-not $idx -or $idx.InnerText -eq 'DontIndex') { 'нет' }
|
||||||
|
elseif ($idx.InnerText -eq 'Index') { 'Индекс' }
|
||||||
|
elseif ($idx.InnerText -eq 'IndexWithAdditionalOrder') { 'Индекс с доп. упорядочиванием' }
|
||||||
|
else { $idx.InnerText }
|
||||||
|
Out " Индексирование: $idxRu"
|
||||||
$ml = $ap.SelectSingleNode("md:MultiLine", $ns)
|
$ml = $ap.SelectSingleNode("md:MultiLine", $ns)
|
||||||
if ($ml -and $ml.InnerText -eq "true") { Out " Многострочный: да" }
|
if ($ml -and $ml.InnerText -eq "true") { Out " Многострочный: да" }
|
||||||
$use = $ap.SelectSingleNode("md:Use", $ns)
|
$use = $ap.SelectSingleNode("md:Use", $ns)
|
||||||
if ($use -and $use.InnerText -ne "ForItem") { Out " Использование: $($use.InnerText)" }
|
if ($use -and $use.InnerText -ne "ForItem") {
|
||||||
|
$useRu = switch ($use.InnerText) {
|
||||||
|
"ForFolder" { "для папок" }
|
||||||
|
"ForFolderAndItem" { "для папок и элементов" }
|
||||||
|
default { $use.InnerText }
|
||||||
|
}
|
||||||
|
Out " Использование: $useRu"
|
||||||
|
}
|
||||||
$fv = $ap.SelectSingleNode("md:FillValue", $ns)
|
$fv = $ap.SelectSingleNode("md:FillValue", $ns)
|
||||||
if ($fv -and -not ($fv.GetAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance") -eq "true") -and $fv.InnerText) {
|
if ($fv -and -not ($fv.GetAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance") -eq "true") -and $fv.InnerText) {
|
||||||
Out " Значение заполнения: $($fv.InnerText)"
|
$fvText = $fv.InnerText
|
||||||
|
if ($fvText -match '\.EmptyRef$') { $fvText = "Пустая ссылка" }
|
||||||
|
elseif ($fvText -eq "false") { $fvText = "Ложь" }
|
||||||
|
elseif ($fvText -eq "true") { $fvText = "Истина" }
|
||||||
|
Out " Значение заполнения: $fvText"
|
||||||
} else {
|
} else {
|
||||||
Out " Значение заполнения: —"
|
Out " Значение заполнения: —"
|
||||||
}
|
}
|
||||||
@@ -525,6 +560,22 @@ if (-not $drillDone) {
|
|||||||
if ($parts.Count -gt 0) { Out ($parts -join " | ") }
|
if ($parts.Count -gt 0) { Out ($parts -join " | ") }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Constant-specific: show type
|
||||||
|
if ($mdType -eq "Constant") {
|
||||||
|
$typeStr = Format-Type $props.SelectSingleNode("md:Type", $ns)
|
||||||
|
if ($typeStr) { Out "Тип: $typeStr" }
|
||||||
|
}
|
||||||
|
|
||||||
|
# Report-specific: MainDataCompositionSchema
|
||||||
|
if ($mdType -eq "Report") {
|
||||||
|
$mainDCS = $props.SelectSingleNode("md:MainDataCompositionSchema", $ns)
|
||||||
|
if ($mainDCS -and $mainDCS.InnerText) {
|
||||||
|
$dcsName = $mainDCS.InnerText
|
||||||
|
if ($dcsName -match '\.Template\.(.+)$') { $dcsName = $Matches[1] }
|
||||||
|
Out "Основная СКД: $dcsName"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# --- Enum values ---
|
# --- Enum values ---
|
||||||
if ($mdType -eq "Enum" -and $childObjs) {
|
if ($mdType -eq "Enum" -and $childObjs) {
|
||||||
$vals = @()
|
$vals = @()
|
||||||
@@ -574,8 +625,9 @@ if (-not $drillDone) {
|
|||||||
if ($attrs.Count -gt 0) {
|
if ($attrs.Count -gt 0) {
|
||||||
Out ""
|
Out ""
|
||||||
Out "Реквизиты ($($attrs.Count)):"
|
Out "Реквизиты ($($attrs.Count)):"
|
||||||
$ml = Get-MaxNameLen $attrs
|
$sorted = Sort-AttrsRefFirst $attrs
|
||||||
foreach ($a in $attrs) { Out (Format-AttrLine $a $ml) }
|
$ml = Get-MaxNameLen $sorted
|
||||||
|
foreach ($a in $sorted) { Out (Format-AttrLine $a $ml) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,8 +640,9 @@ if (-not $drillDone) {
|
|||||||
Out ""
|
Out ""
|
||||||
Out "ТЧ $($ts.Name) ($($ts.ColCount) $(Decline-Cols $ts.ColCount)):"
|
Out "ТЧ $($ts.Name) ($($ts.ColCount) $(Decline-Cols $ts.ColCount)):"
|
||||||
if ($ts.ColCount -gt 0) {
|
if ($ts.ColCount -gt 0) {
|
||||||
$ml = Get-MaxNameLen $ts.Columns
|
$sortedCols = Sort-AttrsRefFirst $ts.Columns
|
||||||
foreach ($c in $ts.Columns) { Out (Format-AttrLine $c $ml) }
|
$ml = Get-MaxNameLen $sortedCols
|
||||||
|
foreach ($c in $sortedCols) { Out (Format-AttrLine $c $ml) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -601,6 +654,16 @@ if (-not $drillDone) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Forms/Templates/Commands in overview for Reports & DataProcessors
|
||||||
|
if ($Mode -eq "overview" -and $childObjs -and ($mdType -eq "Report" -or $mdType -eq "DataProcessor")) {
|
||||||
|
$forms = @(Get-SimpleChildren $childObjs "Form")
|
||||||
|
if ($forms.Count -gt 0) { Out "Формы: $($forms -join ', ')" }
|
||||||
|
$templates = @(Get-SimpleChildren $childObjs "Template")
|
||||||
|
if ($templates.Count -gt 0) { Out "Макеты: $($templates -join ', ')" }
|
||||||
|
$commands = @(Get-SimpleChildren $childObjs "Command")
|
||||||
|
if ($commands.Count -gt 0) { Out "Команды: $($commands -join ', ')" }
|
||||||
|
}
|
||||||
|
|
||||||
# --- Full mode: additional sections ---
|
# --- Full mode: additional sections ---
|
||||||
if ($Mode -eq "full" -and $childObjs) {
|
if ($Mode -eq "full" -and $childObjs) {
|
||||||
# Register records (documents)
|
# Register records (documents)
|
||||||
@@ -670,7 +733,7 @@ if ($Limit -gt 0 -and $outLines.Count -gt $Limit) {
|
|||||||
$shown = $outLines[0..($Limit - 1)]
|
$shown = $outLines[0..($Limit - 1)]
|
||||||
$remaining = $totalLines - $Offset - $Limit
|
$remaining = $totalLines - $Offset - $Limit
|
||||||
$shown += ""
|
$shown += ""
|
||||||
$shown += "[TRUNCATED] Shown $Limit of $totalLines lines. Use -Offset $($Offset + $Limit) to continue."
|
$shown += "[ОБРЕЗАНО] Показано $Limit из $totalLines строк. Используйте -Offset $($Offset + $Limit) для продолжения."
|
||||||
$outLines = $shown
|
$outLines = $shown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user