Skip to content

confluence-mdx: emitter가 width 있는 ac:image에 ac:custom-width 속성을 추가합니다#947

Merged
jk-kim0 merged 2 commits intomainfrom
fix/emitter-ac-custom-width
Mar 26, 2026
Merged

confluence-mdx: emitter가 width 있는 ac:image에 ac:custom-width 속성을 추가합니다#947
jk-kim0 merged 2 commits intomainfrom
fix/emitter-ac-custom-width

Conversation

@jk-kim0
Copy link
Copy Markdown
Contributor

@jk-kim0 jk-kim0 commented Mar 26, 2026

Summary

  • emitter의 _figure_attrs_to_ac_image, _emit_figure 두 경로에서 ac:width 설정 시 ac:custom-width="true" 속성을 함께 추가합니다
  • FC(converter/core.py)는 ac:custom-width="true"가 있어야 ac:width를 MDX width=로 변환합니다 — 이 속성이 없으면 roundtrip 시 width가 손실됩니다

Test plan

  • pytest tests/test_mdx_to_storage/test_emitter.py — 54/54 pass
  • pytest tests/ --ignore=tests/test_unused_attachments.py — 871/871 pass
  • make test-reverse-sync — 42/42 pass

…을 추가합니다

FC(converter/core.py)는 ac:custom-width="true"가 있어야 ac:width를 MDX width=로
변환합니다. 이 속성이 없으면 roundtrip 시 width가 손실됩니다.

_figure_attrs_to_ac_image, _emit_figure 두 경로 모두 수정합니다.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Atlas <atlas@jk.agent>
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
querypie-docs Ready Ready Preview, Comment Mar 26, 2026 5:13am

Request Review

jk-kim0 added a commit that referenced this pull request Mar 26, 2026
…ecar reconstruction으로 전환합니다 (#946)

## Description

Phase 5 Axis 1: `containing` 전략과 `paired delete+add` 경로에서 **anchor 재구성이
필요한 경우**를 `_build_replace_fragment_patch()` + sidecar reconstruction으로
전환합니다. 그 외 경로는 Confluence 전용 inline markup 보존을 위해
`transfer_text_changes`를 유지합니다.

### Scope

이 PR은 **containing 전략**과 **paired delete+add** 경로만 변경합니다. direct 전략,
list 전략, table 전략, xhtml_patcher의 패치 적용 로직은 변경하지 않습니다.

### 주요 변경사항

**patch_builder.py — containing 전략 경로 분기**
- **anchor 필요 시** (`sidecar_block_requires_reconstruction`):
`_build_replace_fragment_patch` 사용 (emit + reconstruct)
- **clean container / sidecar miss / child-of-parent**:
`transfer_text_changes` 사용 (원본 XHTML inline markup 보존)
- preserved anchor list: `transfer_text_changes` 유지 (Phase 5 Axis 1 미완,
별도 PR 예정)

**patch_builder.py — paired delete+add 경로**
- anchor reconstruction 필요 → `_build_replace_fragment_patch`
- sidecar 없는 preserved anchor markup → `rewrite_on_stored_template`
- parameter-bearing container sidecar (`<ac:parameter>` 있음) →
`_build_replace_fragment_patch` (per-child 재구성으로 parameter 보존 + body 변경
+ inline styling 보존)
- clean container sidecar / sidecar 없음 + anchor 없음 →
`transfer_text_changes`

**reconstructors.py — `reconstruct_container_fragment` clean container
경로**
- paragraph merge (emitted < stored): stored body를 template으로 텍스트 재배분
- children 수 불일치: outer wrapper만 적용
- children 수 일치: per-child 재구성 loop으로 fall-through (inline styling 보존)

**patch_builder.py — `_accumulate_text_change` 헬퍼**
- `_text_change_patches` 누적 패턴을 함수로 추출 (containing + preserved anchor
list 공용)

### 이 PR에서 제외된 변경 (별도 PR)
- ~~emitter `ac:custom-width="true"` 속성 추가~~ → **PR #947**에서 별도 처리

### 수정된 버그
- `568918170`: clean callout의 `<em><span
style="color:...">Deleted</span></em>` 보존
- `544379140`: paired delete+add에서 `<span style="color:...">` inline
styling 보존
- `544178422`: Q&A callout 두 줄 → 단락 병합 문제 (clean container 경로)

### Known limitations (이 PR scope 밖, main에서도 동일)
- **modified + direct 전략 + parameter-bearing macro**:
`<details>`(expand) 등 `<ac:parameter>`가 있는 macro의 modified 변경이 direct
전략으로 분기될 때, `xhtml_patcher`의 `element.get_text()` vs `old_plain_text`
비교에서 공백 불일치(`TITLEOld text.` vs `TITLE Old text.`)로 body 변경이 silent
no-op가 됨. 이것은 `xhtml_patcher`의 기존 한계이며 별도 수정 필요.

## Added/updated tests?
- [x] Yes
- `test_reverse_sync_reconstruct_container.py`: clean callout text-level
패치, 구조 변경 보호
- `test_reverse_sync_patch_builder.py`: containing 다중 변경 누적, paired
delete+add inline styling 보존, parameter 보존+body update,
parameter-bearing body inline styling 보존
  - `test_reverse_sync_cli.py`: containing 전략 변경 반영
  - `expected.reverse-sync.patched.xhtml` fixtures 갱신
- `make test-xhtml-diff`: 15/15, `make test-reverse-sync`: 42/42,
`pytest`: 877/877

## Additional notes
- Phase 5 Axis 2 (preserved anchor list `transfer_text_changes` 제거)는 별도
PR 예정
- `transfer_text_changes`는 3개 경로에서 유지됨:
1. containing clean container / sidecar miss (Confluence inline markup
보존)
  2. containing child-of-parent (부모 구조 파괴 방지)
  3. preserved anchor list (multi-item caption 재배치 버그 회피)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@jk-kim0 jk-kim0 merged commit 495b108 into main Mar 26, 2026
7 checks passed
@jk-kim0 jk-kim0 deleted the fix/emitter-ac-custom-width branch March 26, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant