diff --git a/.claude/skills/skd-edit/scripts/skd-edit.ps1 b/.claude/skills/skd-edit/scripts/skd-edit.ps1 index 773f2970..f4b1d3da 100644 --- a/.claude/skills/skd-edit/scripts/skd-edit.ps1 +++ b/.claude/skills/skd-edit/scripts/skd-edit.ps1 @@ -1,4 +1,4 @@ -# skd-edit v1.21 — Atomic 1C DCS editor +# skd-edit v1.22 — Atomic 1C DCS editor # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -50,7 +50,7 @@ $resolvedPath = (Resolve-Path $TemplatePath).Path function Esc-Xml { param([string]$s) - return $s.Replace('&','&').Replace('<','<').Replace('>','>').Replace('"','"') + return $s.Replace('&','&').Replace('<','<').Replace('>','>') } function Resolve-QueryValue { @@ -3563,19 +3563,11 @@ if ($script:RawRootOpening) { $content = [regex]::Replace($content, ']*>', { param($m) $script:RawRootOpening }) } -# (2) re-escape `"` to " inside / text content (1C-style). -# Scope is anchored to those tag names so xsi:type="..." attribute quotes are untouched. -$content = [regex]::Replace( - $content, - '(<(?:\w+:)?(?:query|expression)\b[^>]*>)([\s\S]*?)()', - { param($m) $m.Groups[1].Value + $m.Groups[2].Value.Replace('"', '"') + $m.Groups[3].Value } -) - -# (3) normalize self-closing tags: `.NET XmlDocument` adds a space before `/>` +# (2) normalize self-closing tags: `.NET XmlDocument` adds a space before `/>` # (``) but 1C-Designer writes ``. Strip the space. $content = [regex]::Replace($content, '(?<=\S) />', '/>') -# (4) normalize line endings to match source — operations may mix LF (from new +# (3) normalize line endings to match source — operations may mix LF (from new # fragments) with whatever the source used (CRLF on Windows, LF on Linux/git). if ($script:LineEnding -eq "`r`n") { $content = $content -replace '(?', '>').replace('"', '"') + return s.replace('&', '&').replace('<', '<').replace('>', '>') def resolve_query_value(val, base_dir): @@ -2946,16 +2946,9 @@ xml_bytes = xml_bytes.replace(b"", b' opening tag — lxml collapses # multi-line xmlns into one line. -# (2) re-escape `"` to " inside / text content; scope anchored -# to those tag names so xsi:type="..." attribute quotes are untouched. xml_text = xml_bytes.decode("utf-8") if raw_root_opening: xml_text = re.sub(r"]*>", lambda m: raw_root_opening, xml_text, count=1, flags=re.DOTALL) -xml_text = re.sub( - r"(<(?:\w+:)?(?:query|expression)\b[^>]*>)([\s\S]*?)()", - lambda m: m.group(1) + m.group(2).replace('"', '"') + m.group(3), - xml_text, -) # Normalize self-closing tags: lxml writes `` already (no space), but be # defensive — strip any space before `/>` so PS and PY ports stay byte-equivalent. xml_text = re.sub(r"(?<=\S) />", "/>", xml_text) diff --git a/tests/skills/cases/skd-edit/preserve-entities-modify-parameter-title.json b/tests/skills/cases/skd-edit/preserve-entities-modify-parameter-title.json deleted file mode 100644 index 44d1ebd5..00000000 --- a/tests/skills/cases/skd-edit/preserve-entities-modify-parameter-title.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "modify-parameter title сохраняет " и многострочный xmlns в неизменённых местах", - "setup": "fixture:roundtrip-base", - "params": { - "templatePath": "Template.xml", - "operation": "modify-parameter", - "value": "Период [Новый период]" - }, - "idempotent": true -} diff --git a/tests/skills/cases/skd-edit/snapshots/add-calculated-field-restrict/Template.xml b/tests/skills/cases/skd-edit/snapshots/add-calculated-field-restrict/Template.xml index 55d1f03a..77398aaf 100644 --- a/tests/skills/cases/skd-edit/snapshots/add-calculated-field-restrict/Template.xml +++ b/tests/skills/cases/skd-edit/snapshots/add-calculated-field-restrict/Template.xml @@ -42,7 +42,7 @@ Служебное - "" + "" true true diff --git a/tests/skills/cases/skd-edit/snapshots/preserve-entities-modify-parameter-title/Template.xml b/tests/skills/cases/skd-edit/snapshots/preserve-entities-modify-parameter-title/Template.xml deleted file mode 100644 index db2743fe..00000000 --- a/tests/skills/cases/skd-edit/snapshots/preserve-entities-modify-parameter-title/Template.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - ИсточникДанных1 - Local - - - DS - - П - П - - - Имя - Имя - - ИсточникДанных1 - ВЫБРАТЬ - 1 КАК П, - "literal" КАК Имя - - - Период - - <v8:item> - <v8:lang>ru</v8:lang> - <v8:content>Новый период</v8:content> - </v8:item> - - - xs:dateTime - - DateTime - - - - - Основной - - - ru - Основной - - - - - - - - - - - - - - - -