Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions confluence-mdx/bin/reverse_sync/legacy_xhtml_patcher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Offline diagnostic용 lenient raw XHTML patch compatibility API."""

from typing import Dict, List

from reverse_sync.xhtml_patch_engine import patch_xhtml_engine


def patch_xhtml(
xhtml: str,
patches: List[Dict[str, str]],
) -> str:
"""Legacy raw patch를 적용하고 unresolved operation은 건너뜁니다.

이 API는 offline diagnostic과 regression fixture 호환 전용입니다.
publish candidate 생성에는 ``apply_validated_patches()``를 사용해야 합니다.
"""
return patch_xhtml_engine(xhtml, patches, strict=False)
2 changes: 1 addition & 1 deletion confluence-mdx/bin/reverse_sync/patch_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ def _build_list_item_merge_patch(
"""
from bs4 import BeautifulSoup
from reverse_sync.reconstructors import _find_list_item_by_path
from reverse_sync.xhtml_patcher import _apply_text_changes
from reverse_sync.xhtml_patch_engine import _apply_text_changes

removed_paths = _find_removed_blank_item_paths(old_content, new_content)
if not removed_paths:
Expand Down
8 changes: 5 additions & 3 deletions confluence-mdx/bin/reverse_sync/preserving_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

from reverse_sync.models import sha256_text
from reverse_sync.sidecar import RoundtripSidecar
from reverse_sync.xhtml_patcher import XhtmlPatchError, patch_xhtml
from reverse_sync.xhtml_patcher import (
XhtmlPatchError,
apply_validated_patches,
)

if TYPE_CHECKING:
from reverse_sync.operations import PatchPlan
Expand Down Expand Up @@ -112,10 +115,9 @@ def patch_xhtml_preserving(
local_patches = fragment_patches.get(position)
if local_patches:
try:
rendered = patch_xhtml(
rendered = apply_validated_patches(
block.xhtml_fragment,
local_patches,
strict=True,
)
except XhtmlPatchError as exc:
raise PatchApplicationError(str(exc)) from exc
Expand Down
Loading
Loading