Skip to content

fix(styles): write a paragraph margin's hp:default at twice hp:case - #206

Merged
airmang merged 2 commits into
mainfrom
fix/paragraph-margin-default-scale
Sep 26, 2026
Merged

airmang merged 2 commits into
mainfrom
fix/paragraph-margin-default-scale

Conversation

@airmang

@airmang airmang commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

요약

apply_paragraph_format()으로 여백·들여쓰기·문단 간격을 바꿀 때 hp:switch 안의 hp:default에는 hp:case 값의 두 배를 씁니다.

한컴은 문단 여백을 두 번 씁니다. hp:case(HwpUnitChar)에는 HWPUNIT 값을 쓰고, hp:default에는 그 값의 두 배를 씁니다. 새 문서 템플릿과 저장소에 있는 한컴 문서 fixture도 같은 방식으로 쓰여 있습니다. 지금은 두 곳에 같은 값을 쓰기 때문에, hp:case를 모르고 hp:default를 읽는 프로그램에서는 바꾼 여백이 절반으로 보입니다. hp:case를 읽는 한/글에서는 보이는 결과가 달라지지 않습니다.

변경

  • oxml/header_part.py _apply_paragraph_margins(): hp:switch/hp:default 안의 hh:margin에는 요청 값의 두 배를 씁니다. hp:switch 밖에 있는 여백은 준 값을 그대로 씁니다.
  • tests/test_paragraph_margin_default_scale.py: 테스트 8개를 추가했습니다. 이 중 7개는 수정 전에 실패합니다.
    • 왼쪽·오른쪽 여백, 첫 줄 들여쓰기(음수, 내어쓰기), 문단 위·아래 간격에서 hp:default가 hp:case의 두 배가 됩니다.
    • 한컴이 저장한 fixture 두 개(m7_toc_gold/hancom-native-toc-A.hwpx, m3_gongmun_gold/seoul_sihaengmun.hwpx)의 본문 문단 전체에 여백을 주고 저장한 뒤 다시 엽니다. 이때 모든 문단 모양이 그 문서 자신의 표기(hp:default = hp:case × 2)를 따릅니다.
    • hp:switch 밖의 여백은 두 배가 되지 않습니다. 이 테스트는 수정 전에도 통과하는 보호 테스트입니다.
  • 기존 테스트와 설명 중 두 갈래에 같은 값이 들어간다고 본 곳을 고쳤습니다.
    • tests/test_paragraph_format_targets.py: 도우미가 두 갈래의 간격 값을 한 집합으로 모아 값 하나를 기대했습니다. 이제 한/글이 읽는 값(hp:case, 또는 hp:switch 밖의 여백)만 봅니다.
    • probes/dev018_switch_case_default_schema_absence.py: 여백 설정이 두 갈래에 모두 닿는지 보는 탐침이 두 갈래에 같은 값을 기대했습니다. 이제 hp:case에는 준 값이, hp:default에는 그 두 배가 들어가는지 봅니다.
    • docs/owpml-deviations.md의 DEV-018 설명과 oxml/header.py 읽기 모델 주석: 두 갈래가 같은 값이라고 적은 부분을, 여백은 hp:default에 두 배가 든다고 고쳤습니다. 읽기 모델은 전처럼 hp:case를 먼저 읽습니다.
  • CHANGELOG.md에 고침 항목을 추가했습니다.

검증

  • 새 테스트 8개가 통과합니다.
  • 전체 테스트(d606bb0): 3,829개 통과, 14개 건너뜀. 실패 18개는 수정 전 main에서도 이 개발 환경에서 똑같이 실패하는 테스트입니다(심볼릭 링크, 배포 산출물 위생 검사, 줄끝(CRLF)에 기대는 문서 해시 검사처럼 환경에 기대는 것).
  • ruff(E9,F 전체, E4,E7,E9,F 목록), mypy, pyright, scripts/check_typing_generics_scope.py, scripts/error_code_census.py --check, scripts/check_public_hygiene.py가 통과합니다.
  • oxml/header_part.py의 줄 수는 그대로입니다(1,594줄). 같은 파일을 고치는 다른 열린 변경과 합쳐도 소유 파일 상한(1,600줄) 안에 들도록, 직속 hh:margin을 만드는 바로 위 호출을 두 줄로 묶었습니다(a92a6b4, 동작은 같음). 그 뒤 관련 테스트 138개와 위 검사를 다시 돌려 통과했습니다.

🤖 Generated with Claude Code

airmang and others added 2 commits September 27, 2026 06:17
apply_paragraph_format() wrote the same value into both copies of a
margin inside hp:switch. Hancom keeps hp:default at twice the hp:case
value (the new-document template and the Hancom-saved fixtures do too),
so a reader of the default branch saw an edited margin, indent or
paragraph spacing at half its size. A margin outside hp:switch is
written as given.

The DEV-018 probe and the paragraph-format target tests expected one
value in both branches; they now read hp:case (and the probe checks
hp:default at twice it). The DEV-018 note and a read-model comment
said the two copies hold the same value; they now say the margins in
hp:default are doubled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fold the direct hh:margin fallback into two lines so the margin scale
change adds no lines to the owner file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@airmang
airmang merged commit d40a655 into main Sep 26, 2026
13 checks passed
@airmang
airmang deleted the fix/paragraph-margin-default-scale branch September 26, 2026 21:40
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