Repository navigation
Conversation
add_picture wrote any align it was given into hp:pos@horzAlign ("BOGUS",
" RIGHT ", "TOP"), which Hancom reads as LEFT; a non-string failed only after
the image and its paragraph were added. The alignment is now checked first,
in any case, against the schema's horizontal alignments, and anything else is
refused with shape-position-frame before anything is stored.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A negative width or height of a rectangle, ellipse, arc, picture or equation box, or a negative rectangle corner ratio, was written as given; Hancom reads it as 0. Such values, and sizes of 2**31 or more, are now refused with typed errors before any paragraph, run or image is added (shape-size-value, shape-rect-ratio-value). An equation's base_unit outside 1..2**31-1 raises shape-equation-base-unit-value (a ValueError, as before) before its paragraph is added. HwpxOxmlShape.resize refuses a negative size too, and HwpxOxmlParagraph.add_picture builds the picture before adding its run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hancom reads a caption's gap and the gap between columns of the same width as signed 16-bit numbers and a new number as an unsigned one, wrapping anything else (a column gap of 32768 makes the columns overlap; a negative one written as text is read as 0). set_caption's gap outside -32768..32767, a same_gap (or page setup column_gap_mm) outside 0..32767 and a restart number outside 0..65535 are now refused before anything changes (shape-caption-gap-value, page-column-gap-value, page-new-num-value). The caption side check moves to shape_position unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hancom reads a column's width and gap (hp:colSz) as a share of the text width out of 32768 and lays the column out width * text width / 32768 wide, whatever the shares add up to. column_widths were written as given, so widths in HWP units adding up to the text width came out about 1.3 times as wide and ran off the paper. They are now taken as proportions and written as shares adding up to 32768 (column_shares); widths that already add up to 32768 are written unchanged. Negative, non-int, all-zero or malformed pairs are refused before anything changes (page-column-widths-value). The page estimate takes a column's width as its share of 32768 of the text width. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hancom draws a table column at least its cells' left and right margins and 283 wide (1303 in a new table), keeps the narrower width written in the cells and saves the table as wide as it draws the columns. A new table now gives each column at least that floor (a nested table without a width in a narrow cell too), and set_column_widths writes a column below its floor at the floor and widens the table by as much. A new table width that is no int in 0 < width < 2**31 is refused before any paragraph, run or border fill is added (table-width-value). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t keep Hancom keeps a line number's start and step, a section's start numbers and a list's start as 16 bits unsigned and a page border's offsets as 16 bits signed, wrapping anything past them, and reads a gutter type or a page border fill area it does not know as its default. Such values, and the negative sizes, margins, numbers and offsets python-hwpx used to write as 0, are now refused with typed errors before anything changes (page-number-value, page-border-fill-invalid, page-gutter-type-invalid, page-size-value, style-list-start-value, style-run-size-value). A list start of 0 is written as given (Hancom keeps it). Page setup checks its size and margins before changing the page. Settings added to a section that lacked them are created as its own kind of element: a page border fill of a new page type failed with TypeError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
add_equation's base unit check now raises a typed error, so oxml/paragraph.py raises one untyped error fewer. The census lock records 202 untyped raises (paragraph.py 18), as the ratchet's self-test expects the lock to match the tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
new_table_width returns None only when no width is given. Overloads now say so, so the width HwpxOxmlTable.create builds the table with is an int for mypy and pyright. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
바뀐 점
쪽·구역·목록 설정에서 한/글이 그대로 두지 않는 값과, python-hwpx가 음수를 조용히 0으로 쓰던 값을 무엇도 바꾸기 전에 형식 있는 오류로 거부한다. 구역에 없던 설정을 더할 때 나던
TypeError도 고친다.한/글의 동작
lineNumberShape@startNumber)과 간격(@countBy)startNum@page·@pic·@tbl·@equation)hh:numbering@start)@distance)는 32비트로 그대로 둔다.pageBorderFill/offset)은 부호 있는 16비트 수로 읽는다.pagePr@gutterType)은LEFT_ONLYpageBorderFill@fillArea)은PAPER고치기 전
page_type="SOMETIMES")나 시작 번호·줄 번호·격자·보이기 설정을 더하면 내부TypeError로 끝났다. 표준 라이브러리SubElement를 lxml 요소에 썼기 때문이다.코드
oxml/section_format.py_checked,_choice,_check_page_size가 범위와 어휘를 검사한다.set_page_size: 크기는 0 이상 2³¹ 미만,gutter_type은LEFT_ONLY·LEFT_RIGHT·TOP_BOTTOMset_page_margins: 0 이상 2³¹ 미만set_start_numbering: 0~65535set_line_number_shape: 시작·간격은 0~65535, 거리·재시작은 0 이상 2³¹ 미만set_page_border_fill:page_type은BOTH·EVEN·ODD,fill_area는PAPER·PAGE·BORDER, 오프셋은 0~32767_append_child로 만든다(ET.SubElement10곳을 바꿈)._document/layout.pyapply_list_format의start는 0~65535이고, 받은 값을 그대로 쓴다.set_page_setup(doc.page.setup)은 쪽을 바꾸기 전에 크기와 여백을 검사한다.oxml/document_parts.py:ensure_run_style의 글자 크기는 0 이상이어야 한다(음수 거부).page-number-value,page-border-fill-invalid,page-gutter-type-invalid,page-size-value,style-list-start-value,style-run-size-valueerrors.py,docs/error-codes.md, 변경 로그를 고친다.테스트
tests/test_page_and_list_values.py를 더하고, 한/글 저장본 열다섯을 함께 넣는다.page.setup의 음수 여백 포함)TypeError없이 더해지는지고치기 전에는 27판 가운데 25판이 틀렸다.
이 PR은 #415, #416, #417, #418, #419 위에 쌓았다. 앞 PR이 병합되면 그 커밋들은 이 PR의 diff에서 빠진다.
🤖 Generated with Claude Code