From 2d0835ba17001d37ed999c46ee3d3e07411082f4 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Wed, 11 Feb 2026 19:39:07 +0300 Subject: [PATCH] Fix XML formatting in batch insert and after clear operations Two bugs caused tag concatenation (e.g. ` --- .claude/skills/skd-edit/scripts/skd-edit.ps1 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.claude/skills/skd-edit/scripts/skd-edit.ps1 b/.claude/skills/skd-edit/scripts/skd-edit.ps1 index 1229e9b5..33628046 100644 --- a/.claude/skills/skd-edit/scripts/skd-edit.ps1 +++ b/.claude/skills/skd-edit/scripts/skd-edit.ps1 @@ -961,7 +961,7 @@ function Insert-BeforeElement($container, $newNode, $refNode, $childIndent) { $trailing = $container.LastChild if ($trailing -and ($trailing.NodeType -eq 'Whitespace' -or $trailing.NodeType -eq 'SignificantWhitespace')) { $container.InsertBefore($ws, $trailing) | Out-Null - $container.InsertBefore($newNode, $ws) | Out-Null + $container.InsertBefore($newNode, $trailing) | Out-Null } else { $container.AppendChild($ws) | Out-Null $container.AppendChild($newNode) | Out-Null @@ -1223,12 +1223,16 @@ function Get-DataSetName($dsNode) { } function Get-ContainerChildIndent($container) { - $ci = Get-ChildIndent $container - if (-not $container.HasChildNodes) { - $settingsIndent = Get-ChildIndent $container.ParentNode - $ci = $settingsIndent + "`t" + $hasElements = $false + foreach ($ch in $container.ChildNodes) { + if ($ch.NodeType -eq 'Element') { $hasElements = $true; break } + } + if ($hasElements) { + return Get-ChildIndent $container + } else { + $parentIndent = Get-ChildIndent $container.ParentNode + return $parentIndent + "`t" } - return $ci } # --- 6. Load XML ---