-
Notifications
You must be signed in to change notification settings - Fork 1
feat(confluence-mdx): page.v1.yaml을 활용한 정확한 pageId 기반 링크 생성 #578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+212
−63
Conversation
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
## Description - page.v1.yaml의 body.view HTML을 파싱하여 링크 텍스트 → pageId 매핑을 생성하는 `build_link_mapping` 함수 추가 - `<ac:link><ri:page>` 처리 로직에서 링크 매핑을 조회하여 정확한 pageId 기반 Confluence URL 생성 - 외부 Confluence 링크(변환 범위 외 페이지)에 대해 space overview URL 대신 특정 페이지 URL 생성 - pageId 있음: `https://querypie.atlassian.net/wiki/spaces/{space_key}/pages/{page_id}` - pageId 없음 + space_key 있음: `https://querypie.atlassian.net/wiki/spaces/{space_key}/overview` (기존 동작 유지) - 둘 다 없음: `#link-error` (기존 동작 유지) ### Background #576에서 구현한 외부 링크 처리는 space overview URL만 생성했습니다. page.xhtml에는 pageId가 포함되지 않지만, page.v1.yaml의 body.view HTML에는 `data-linked-resource-id` 속성으로 pageId가 포함되어 있어 이를 활용합니다. ### Test Results 테스트 케이스 1844969501: - ✓ QueryPie Architecture → pages/400064797 - ✓ Advanced Environment Setup → pages/887947577 - ✓ Advanced Integration Guide → pages/841449834 - ✓ 릴리스 버전 별 문서 → pages/841351486 - ✓ Troubleshooting → pages/920486841 ## Related tickets & links - #577 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
## Description - 외부 링크 URL 생성 로직을 `resolve_external_link` 함수로 추출하여 코드 간결성 향상 - `convert_recursively` 메서드의 복잡도 감소 (18줄 → 3줄) - 링크 생성 로직의 재사용성 및 테스트 용이성 개선 ### Changes - `resolve_external_link(link_text, space_key, target_title)` 함수 추가 - pageId 조회 및 URL 생성 로직 캡슐화 - 명확한 fallback 전략 (pageId → space overview → error link) - `convert_recursively`에서 외부 링크 처리 부분 간소화 ### Benefits - 코드 가독성 향상 - 단일 책임 원칙 적용 - 유지보수 용이성 증가 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
keIIy-kim
approved these changes
Jan 29, 2026
Contributor
keIIy-kim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
## Description - SingleLineParser 클래스에 `convert_ac_link` 메서드 추가 - `convert_recursively` 메서드의 ac:link 처리 블록을 독립적인 메서드로 추출 - 코드 복잡도 감소 및 가독성 향상 (54줄 → 3줄) ### Changes - `convert_ac_link(node: Tag) -> str` 메서드 추가 - ac:link 노드를 markdown 링크 형식으로 변환 - 내부 링크, 외부 링크, space 링크 처리 로직 캡슐화 - anchor fragment 처리 포함 - `convert_recursively`에서 ac:link 처리 부분 간소화 ### Benefits - **관심사 분리**: ac:link 처리 로직이 독립적인 메서드로 관리됨 - **코드 가독성**: convert_recursively 메서드가 더욱 간결하고 이해하기 쉬워짐 - **유지보수성**: ac:link 관련 수정 시 한 곳만 변경 - **테스트 용이성**: 메서드 단위 테스트 작성 가능 ### Test Results - ✅ 테스트 케이스 1844969501 검증 완료 (출력 동일) - ✅ pytest 전체 테스트 통과 (55 passed) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
## Description - `convert_ac_link` 메서드의 docstring에 6가지 링크 유형별 상세 예시 추가 - 각 유형별로 입력 XHTML과 출력 Markdown을 명확하게 문서화 ### 추가된 예시 1. **Internal Page Link**: pages.yaml에 있는 페이지 → 상대 경로 2. **External Page Link with pageId**: page.v1.yaml에서 pageId 조회 성공 → 정확한 페이지 URL 3. **External Page Link without pageId**: pageId 조회 실패 → space overview URL 4. **Space Link**: ri:space 태그 → space overview URL 5. **Link with Anchor Fragment**: anchor 속성 포함 → fragment 추가 6. **Error Case**: space key 없음 → #link-error ### Benefits - 코드 사용자가 각 링크 유형의 변환 결과를 명확하게 이해 가능 - 유지보수 시 예상 동작을 쉽게 파악 - 새로운 개발자의 온보딩 용이성 향상 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
page.v1.yaml의 body.view HTML을 활용하여 외부 Confluence 링크에 대해 정확한 pageId 기반 URL을 생성합니다. 또한 코드 구조 개선을 통해 유지보수성과 가독성을 향상시켰습니다.
Description
기능 구현
build_link_mapping()함수 추가<ac:link><ri:page>처리 로직에서 링크 매핑을 조회하여 정확한 pageId 기반 Confluence URL 생성https://querypie.atlassian.net/wiki/spaces/{space_key}/pages/{page_id}https://querypie.atlassian.net/wiki/spaces/{space_key}/overview(기존 동작 유지)#link-error(기존 동작 유지)코드 구조 개선 (리팩토링)
외부 링크 처리 함수 분리:
resolve_external_link(link_text, space_key, target_title)함수로 추출convert_recursively메서드 복잡도 감소 (18줄 → 3줄)ac:link 변환 메서드 분리:
SingleLineParser.convert_ac_link(node)메서드로 추출convert_recursively메서드 복잡도 감소 (54줄 → 3줄)문서화
convert_ac_link메서드의 docstring에 6가지 링크 유형별 상세 예시 추가[User Guide](../../user-guide)[QueryPie Architecture](https://querypie.atlassian.net/wiki/spaces/QCP/pages/400064797)[Unknown Page](https://querypie.atlassian.net/wiki/spaces/QCP/overview)[Confluence Space](https://querypie.atlassian.net/wiki/spaces/QCP/overview)[My Dashboard | section-name](../../my-dashboard#section-name)[Missing Page](#link-error)Background
#576에서 구현한 외부 링크 처리는 space overview URL만 생성했습니다.
page.xhtml에는 pageId가 포함되지 않지만, page.v1.yaml의 body.view HTML에는
data-linked-resource-id속성으로 pageId가 포함되어 있어 이를 활용합니다.Implementation Details
build_link_mapping()함수가 page.v1.yaml의 body.view HTML을 파싱GLOBAL_LINK_MAPPING에 링크 텍스트 → pageId 딕셔너리 저장resolve_external_link()함수가 링크 텍스트로 pageId 조회Code Quality Improvements
Test plan
Related tickets & links
🤖 Generated with Claude Code