confluence-mdx: reverse-sync 정확도 개선 및 roundtrip_verifier 버그 수정#903
Open
confluence-mdx: reverse-sync 정확도 개선 및 roundtrip_verifier 버그 수정#903
Conversation
…딩 공백 처리 ## Description - `bin/mdx_to_storage/inline.py`, `bin/reverse_sync/mdx_to_xhtml_inline.py`: inline code 변환 시 `html.escape()` 적용 - `<`, `>`, `&` 등 HTML 특수문자가 포함된 코드 스니펫이 XHTML에서 깨지는 문제를 수정합니다. - `bin/reverse_sync/list_patcher.py`, `bin/reverse_sync/xhtml_patcher.py`: `<ol start="N">` 속성 변경 감지 및 적용 - `_get_ordered_list_start()` 헬퍼를 추가하여 MDX 순서 목록의 시작 번호를 추출합니다. - 시작 번호가 변경된 경우 패치에 `ol_start` 필드를 포함하고, xhtml_patcher에서 `<ol start>` 속성을 갱신하거나 제거합니다. - `bin/reverse_sync/patch_builder.py`: 헤딩 공백 차이만 있는 변경을 XHTML에 전파하지 않음 - 레벨과 텍스트가 동일한 헤딩 변경(공백 차이만 있는 경우)은 건너뜁니다. - Confluence XHTML의 ` ` 등 고유 공백 문자가 손실되는 것을 방지합니다. - `bin/text_utils.py`: HTML 태그 제거로 인한 trailing space 아티팩트 제거 - 링크 텍스트의 genuine trailing space는 보존하고, 태그 제거로 생긴 공백만 제거합니다. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
## Description - `tests/test_reverse_sync_mdx_to_xhtml_inline.py`: inline code 내 HTML 특수문자 escape 테스트 추가 - `TestConvertInline`: `<`, `&` 포함 코드 스니펫의 escape 처리 검증 - `TestBlockConversion`: reverse-sync 경로(`mdx_block_to_inner_xhtml`)에서의 escape 처리 검증 - `tests/test_reverse_sync_xhtml_patcher.py`: `<ol start="N">` 속성 변경 테스트 추가 - `ol_start` 패치 필드로 `start` 속성을 설정하는 케이스 - `ol_start=1` 패치로 `start` 속성을 제거하는 케이스 - `tests/test_reverse_sync_patch_builder.py`: `TestHeadingWhitespaceSkip` 클래스 추가 - 공백 차이만 있는 헤딩 변경이 패치를 생성하지 않는 것 검증 - 실제 텍스트가 변경된 헤딩은 패치를 생성하는 것 검증 - `bin/text_utils.py`: trailing space 아티팩트 제거 로직 revert - `s_before_html` 비교를 통한 trailing space 제거는 특정 케이스만을 위한 해킹으로 판단하여 취소합니다. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Forward converter의 체계적 차이(trailing whitespace, 이중 공백, <br/> 앞 공백)를 항상 정규화하여 검증 신뢰성을 높입니다. ## Description - `roundtrip_verifier.py`에 항상 적용하는 최소 정규화(`_apply_minimal_normalizations`)를 추가합니다: - `_normalize_consecutive_spaces_in_text`: 코드 블록 외 텍스트에서 이중 공백을 단일 공백으로 정규화 - `_normalize_br_space`: `<br/>` 앞의 불필요한 공백 제거 - `text_utils.py`의 `normalize_mdx_to_plain`에서 태그 제거 후 trailing space를 제거합니다. - 이 변경으로 6개의 기존 실패 케이스가 PASS로 전환됩니다. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Forward converter 특성에 의한 체계적 차이를 최소 정규화에 추가합니다.
## Description
- `_normalize_table_cell_padding`을 `_apply_minimal_normalizations`으로 이동합니다:
- 셀 내 연속 공백을 단일 공백으로 정규화
- 구분자 행(`| --- |`)의 대시 수를 3개로 정규화 (컬럼 폭 차이 무시)
- `_strip_first_heading` + `lstrip('\n')` 추가: Forward converter가 H1을 페이지 제목으로 처리하므로 비교에서 제외합니다.
- `_normalize_trailing_blank_lines` 추가: 후미 빈 줄을 정규화합니다.
- `tests/reverse-sync/544178422/improved.mdx`: alt 텍스트 오타 수정 (`접근 차단` → `접근차단`)
- 이 변경으로 5개 케이스 추가 PASS: 1456144391, 1495433217, 544376183, 873136365, 544178422
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…드 전용으로 이동합니다 - _normalize_trailing_ws를 _apply_minimal_normalizations에서 제거합니다 - _apply_normalizations(lenient 전용)에 _normalize_trailing_ws를 추가합니다 - strict 모드에서 trailing whitespace 차이가 실패하도록 수정합니다 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PR #902에서 타입 기반 sidecar 매핑(#901)과 무관하게 main에 독립적으로 적용 가능한
버그 수정 커밋을 분리한 PR입니다.
포함 커밋
reverse-sync 정확도 개선 — inline 코드 이스케이프, ol start 속성, 헤딩 공백 처리
bin/mdx_to_storage/inline.py,bin/reverse_sync/mdx_to_xhtml_inline.py: inline code에html.escape()적용 (<,>,&깨짐 수정)bin/reverse_sync/list_patcher.py,bin/reverse_sync/xhtml_patcher.py:<ol start="N">속성 변경 감지·적용bin/reverse_sync/patch_builder.py: 헤딩 공백 차이만 있는 변경을 XHTML에 전파하지 않음단위 테스트 추가 및 text_utils 해킹 제거
test_reverse_sync_mdx_to_xhtml_inline.py: inline code HTML escape 테스트test_reverse_sync_xhtml_patcher.py:ol_start패치 필드 테스트test_reverse_sync_patch_builder.py:TestHeadingWhitespaceSkip추가roundtrip_verifier 최소 정규화 추가 — 6개 기존 실패 케이스 PASS 전환
<br/>앞 공백, trailing space 정규화roundtrip_verifier H1·테이블 패딩 정규화 추가 — 5개 케이스 추가 PASS
roundtrip_verifier trailing whitespace 정규화를 lenient 모드 전용으로 이동
관련 PR
Added/updated tests?
test_reverse_sync_mdx_to_xhtml_inline.py,test_reverse_sync_xhtml_patcher.py,test_reverse_sync_patch_builder.py추가🤖 Generated with Claude Code