diff --git a/confluence-mdx/bin/reverse_sync/roundtrip_verifier.py b/confluence-mdx/bin/reverse_sync/roundtrip_verifier.py
index f52a7caf7..ce877b453 100644
--- a/confluence-mdx/bin/reverse_sync/roundtrip_verifier.py
+++ b/confluence-mdx/bin/reverse_sync/roundtrip_verifier.py
@@ -55,6 +55,16 @@ def _normalize_br_space(text: str) -> str:
return re.sub(r' +( )', r'\1', text)
+def _normalize_trailing_blank_lines(text: str) -> str:
+ """텍스트 끝의 빈 줄을 정규화한다.
+
+ Forward converter가 마지막 줄 뒤에 빈 줄을 추가하는 경우가 있으므로,
+ 텍스트 끝의 빈 줄을 모두 제거하고 마지막 줄바꿈 하나만 유지한다.
+ """
+ stripped = text.rstrip('\n')
+ return stripped + '\n' if stripped else text
+
+
def _apply_minimal_normalizations(text: str) -> str:
"""항상 적용하는 최소 정규화 (strict/lenient 모드 공통).
@@ -66,6 +76,10 @@ def _apply_minimal_normalizations(text: str) -> str:
"""
text = _normalize_consecutive_spaces_in_text(text)
text = _normalize_br_space(text)
+ text = _normalize_table_cell_padding(text)
+ text = _strip_first_heading(text)
+ text = text.lstrip('\n')
+ text = _normalize_trailing_blank_lines(text)
return text
@@ -91,17 +105,22 @@ def _replace(m):
def _normalize_table_cell_padding(text: str) -> str:
- """Markdown table 행의 셀 패딩 공백을 정규화한다.
+ """Markdown table 행의 셀 패딩 공백과 구분자 행 대시 수를 정규화한다.
XHTML→MDX forward 변환 시 테이블 셀의 컬럼 폭 계산이 원본 MDX와
- 1~2자 차이날 수 있으므로, 연속 공백을 단일 공백으로 축약한다.
+ 1~N자 차이날 수 있으므로:
+ - 셀 내 연속 공백을 단일 공백으로 축약한다.
+ - 구분자 행(| --- | --- |)의 대시 수를 3개로 정규화한다.
"""
+ _SEP_RE = re.compile(r'^\|[\s\-:|]+\|$')
lines = text.split('\n')
result = []
for line in lines:
stripped = line.strip()
if stripped.startswith('|') and stripped.endswith('|'):
line = re.sub(r' +', ' ', line)
+ if _SEP_RE.match(stripped):
+ line = re.sub(r'-{3,}', '---', line)
result.append(line)
return '\n'.join(result)
@@ -230,8 +249,6 @@ def _apply_normalizations(text: str) -> str:
"""모든 정규화를 순서대로 적용한다."""
text = _normalize_trailing_ws(text)
text = _normalize_dates(text)
- text = _normalize_table_cell_padding(text)
- text = _strip_first_heading(text)
text = _normalize_table_cell_lines(text)
text = _normalize_html_entities_in_code(text)
text = _normalize_inline_code_boundaries(text)
diff --git a/confluence-mdx/tests/reverse-sync/544178422/improved.mdx b/confluence-mdx/tests/reverse-sync/544178422/improved.mdx
index 835229e90..1a0b7f78c 100644
--- a/confluence-mdx/tests/reverse-sync/544178422/improved.mdx
+++ b/confluence-mdx/tests/reverse-sync/544178422/improved.mdx
@@ -144,7 +144,7 @@ Each User 설정의 IP 접근 차단 시 화면
-All User 설정의 IP 접근차단 시 화면
+All User 설정의 IP 접근 차단 시 화면
diff --git a/confluence-mdx/tests/reverse-sync/pages.yaml b/confluence-mdx/tests/reverse-sync/pages.yaml
index 63d53796d..0925c66e6 100644
--- a/confluence-mdx/tests/reverse-sync/pages.yaml
+++ b/confluence-mdx/tests/reverse-sync/pages.yaml
@@ -125,9 +125,10 @@
- Company Management
- Security
description: '이미지 alt 텍스트의 띄어쓰기 교정이 원복됨. 예: IP 접근차단 → IP 접근 차단 (교정) → IP 접근차단 (원복). 추가로 **bold** : 형태의 이중 공백이 단일 공백으로 변환됨.
+ _normalize_consecutive_spaces_in_text, _normalize_trailing_blank_lines으로 해결됨 (PR #907).
'
- expected_status: fail
+ expected_status: pass
failure_type: 11
label: 교정 내용 원복 — 붙여쓰기 (IP 접근 차단→IP 접근차단) + Bold 공백
mdx_path: administrator-manual/general/company-management/security.mdx
@@ -806,10 +807,10 @@
- Identity Providers
- Integrating with AWS SSO (SAML 2.0)
description: '테이블 열 구분자 padding 공백이 변환 후 달라짐. 예: | --------------------- | → | ------------------- | 내용 변경 없이 열 너비(패딩) 정렬만
- 달라짐.
+ 달라짐. _normalize_table_cell_padding(구분자 행 대시 수 정규화)으로 해결됨 (PR #907).
'
- expected_status: fail
+ expected_status: pass
failure_type: 15
label: 테이블 열 너비 padding 변경 (AWS SSO SAML 속성 매핑 표)
mdx_path: administrator-manual/general/system/integrations/identity-providers/integrating-with-aws-sso-saml-20.mdx
@@ -866,9 +867,10 @@
- System
- Maintenance
description: 'Mode 설명 테이블의 열 구분자 padding이 변환 후 달라짐. 내용 변경 없이 열 너비 정렬만 변경됨.
+ _normalize_table_cell_padding(구분자 행 대시 수 정규화)으로 해결됨 (PR #907).
'
- expected_status: fail
+ expected_status: pass
failure_type: 15
label: 테이블 열 너비 padding 변경 (Maintenance Mode 표)
mdx_path: administrator-manual/general/system/maintenance.mdx