python-hwpx 1.5__tar.gz → 1.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {python-hwpx-1.5/src/python_hwpx.egg-info → python_hwpx-1.8}/PKG-INFO +37 -2
  2. {python-hwpx-1.5 → python_hwpx-1.8}/README.md +2 -0
  3. {python-hwpx-1.5 → python_hwpx-1.8}/pyproject.toml +3 -4
  4. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/oxml/document.py +12 -0
  5. {python-hwpx-1.5 → python_hwpx-1.8/src/python_hwpx.egg-info}/PKG-INFO +37 -2
  6. {python-hwpx-1.5 → python_hwpx-1.8}/tests/test_document_formatting.py +28 -0
  7. {python-hwpx-1.5 → python_hwpx-1.8}/LICENSE +0 -0
  8. {python-hwpx-1.5 → python_hwpx-1.8}/setup.cfg +0 -0
  9. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/__init__.py +0 -0
  10. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/data/Skeleton.hwpx +0 -0
  11. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/document.py +0 -0
  12. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/opc/package.py +0 -0
  13. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/oxml/__init__.py +0 -0
  14. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/oxml/body.py +0 -0
  15. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/oxml/common.py +0 -0
  16. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/oxml/header.py +0 -0
  17. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/oxml/parser.py +0 -0
  18. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/oxml/schema.py +0 -0
  19. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/oxml/utils.py +0 -0
  20. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/package.py +0 -0
  21. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/templates.py +0 -0
  22. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/tools/__init__.py +0 -0
  23. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/tools/_schemas/header.xsd +0 -0
  24. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/tools/_schemas/section.xsd +0 -0
  25. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/tools/object_finder.py +0 -0
  26. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/tools/text_extractor.py +0 -0
  27. {python-hwpx-1.5 → python_hwpx-1.8}/src/hwpx/tools/validator.py +0 -0
  28. {python-hwpx-1.5 → python_hwpx-1.8}/src/python_hwpx.egg-info/SOURCES.txt +0 -0
  29. {python-hwpx-1.5 → python_hwpx-1.8}/src/python_hwpx.egg-info/dependency_links.txt +0 -0
  30. {python-hwpx-1.5 → python_hwpx-1.8}/src/python_hwpx.egg-info/entry_points.txt +0 -0
  31. {python-hwpx-1.5 → python_hwpx-1.8}/src/python_hwpx.egg-info/requires.txt +0 -0
  32. {python-hwpx-1.5 → python_hwpx-1.8}/src/python_hwpx.egg-info/top_level.txt +0 -0
  33. {python-hwpx-1.5 → python_hwpx-1.8}/tests/test_inline_models.py +0 -0
  34. {python-hwpx-1.5 → python_hwpx-1.8}/tests/test_integration_hwpx_compatibility.py +0 -0
  35. {python-hwpx-1.5 → python_hwpx-1.8}/tests/test_memo_and_style_editing.py +0 -0
  36. {python-hwpx-1.5 → python_hwpx-1.8}/tests/test_oxml_parsing.py +0 -0
  37. {python-hwpx-1.5 → python_hwpx-1.8}/tests/test_section_headers.py +0 -0
  38. {python-hwpx-1.5 → python_hwpx-1.8}/tests/test_tables_default_border.py +0 -0
  39. {python-hwpx-1.5 → python_hwpx-1.8}/tests/test_text_extractor_annotations.py +0 -0
@@ -1,9 +1,41 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: python-hwpx
3
- Version: 1.5
3
+ Version: 1.8
4
4
  Summary: Hancom HWPX 패키지를 로드하고 편집하기 위한 Python 유틸리티 모음
5
5
  Author: python-hwpx Maintainers
6
6
  License: Non-Commercial License
7
+
8
+ Copyright (c) 2024 python-hwpx Maintainers
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to use,
12
+ copy, modify, merge, publish, distribute, and sublicense the Software only for
13
+ non-commercial purposes, subject to the following conditions:
14
+
15
+ 1. Non-Commercial Use Only. The Software may be used, copied, modified,
16
+ merged, published, distributed, and sublicensed only for non-commercial
17
+ purposes. "Non-Commercial" means use that is not primarily intended for or
18
+ directed toward commercial advantage, monetary compensation, or any form of
19
+ direct or indirect commercial exploitation.
20
+
21
+ 2. Attribution. The above copyright notice and this permission notice shall be
22
+ included in all copies or substantial portions of the Software.
23
+
24
+ 3. No Warranty of Commercial Support. The maintainers are not obligated to
25
+ provide commercial support, maintenance, or updates.
26
+
27
+ THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ SOFTWARE.
34
+
35
+ If you require permissions to use this Software for commercial purposes,
36
+ please contact the copyright holders to negotiate an alternative licensing
37
+ arrangement.
38
+
7
39
  Project-URL: Homepage, https://github.com/airmang/python-hwpx
8
40
  Project-URL: Documentation, https://github.com/airmang/python-hwpx/tree/main/docs
9
41
  Project-URL: Issues, https://github.com/airmang/python-hwpx/issues
@@ -27,6 +59,7 @@ Requires-Dist: twine>=4.0; extra == "dev"
27
59
  Requires-Dist: pytest>=7.4; extra == "dev"
28
60
  Provides-Extra: test
29
61
  Requires-Dist: pytest>=7.4; extra == "test"
62
+ Dynamic: license-file
30
63
 
31
64
  # python-hwpx
32
65
 
@@ -93,6 +126,8 @@ document.save("output/example.hwpx")
93
126
 
94
127
  `HwpxDocument.add_table()`은 문서에 정의된 테두리 채우기가 없으면 헤더 참조 목록에 "기본 실선" `borderFill`을 만들어 표와 모든 셀에 참조를 연결합니다.
95
128
 
129
+ 표 셀 텍스트를 편집하는 `table.set_cell_text()`는 기존 단락에 남아 있는 `lineSegArray`와 같은 줄 배치 캐시를 제거하여 한/글이 문서를 다시 열 때 줄바꿈을 새로 계산하도록 합니다.
130
+
96
131
  더 많은 실전 패턴은 [빠른 시작](docs/quickstart.md)과 [사용 가이드](docs/usage.md)의 "빠른 예제 모음"에서 확인할 수 있습니다.
97
132
 
98
133
  ## 문서
@@ -63,6 +63,8 @@ document.save("output/example.hwpx")
63
63
 
64
64
  `HwpxDocument.add_table()`은 문서에 정의된 테두리 채우기가 없으면 헤더 참조 목록에 "기본 실선" `borderFill`을 만들어 표와 모든 셀에 참조를 연결합니다.
65
65
 
66
+ 표 셀 텍스트를 편집하는 `table.set_cell_text()`는 기존 단락에 남아 있는 `lineSegArray`와 같은 줄 배치 캐시를 제거하여 한/글이 문서를 다시 열 때 줄바꿈을 새로 계산하도록 합니다.
67
+
66
68
  더 많은 실전 패턴은 [빠른 시작](docs/quickstart.md)과 [사용 가이드](docs/usage.md)의 "빠른 예제 모음"에서 확인할 수 있습니다.
67
69
 
68
70
  ## 문서
@@ -1,13 +1,13 @@
1
1
  [build-system]
2
- requires = ["setuptools<69", "wheel"]
2
+ requires = ["setuptools", "wheel"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-hwpx"
7
- version = "1.5"
7
+ version = "1.8"
8
8
  description = "Hancom HWPX 패키지를 로드하고 편집하기 위한 Python 유틸리티 모음"
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
- license = { text = "Non-Commercial License" }
10
+ license = { file = "LICENSE" }
11
11
  requires-python = ">=3.10"
12
12
  authors = [
13
13
  { name = "python-hwpx Maintainers" },
@@ -49,7 +49,6 @@ hwpx-validate = "hwpx.tools.validator:main"
49
49
  [tool.setuptools]
50
50
  package-dir = { "" = "src" }
51
51
  include-package-data = true
52
- license-files = ["LICENSE"]
53
52
 
54
53
  [tool.setuptools.packages.find]
55
54
  where = ["src"]
@@ -119,6 +119,17 @@ def _create_paragraph_element(
119
119
  return paragraph
120
120
 
121
121
 
122
+ _LAYOUT_CACHE_ELEMENT_NAMES = {"linesegarray"}
123
+
124
+
125
+ def _clear_paragraph_layout_cache(paragraph: ET.Element) -> None:
126
+ """Remove cached layout metadata such as ``<hp:lineSegArray>``."""
127
+
128
+ for child in list(paragraph):
129
+ if _element_local_name(child).lower() in _LAYOUT_CACHE_ELEMENT_NAMES:
130
+ paragraph.remove(child)
131
+
132
+
122
133
  def _element_local_name(node: ET.Element) -> str:
123
134
  tag = node.tag
124
135
  if "}" in tag:
@@ -1501,6 +1512,7 @@ class HwpxOxmlTableCell:
1501
1512
  paragraph = sublist.find(f"{_HP}p")
1502
1513
  if paragraph is None:
1503
1514
  paragraph = ET.SubElement(sublist, f"{_HP}p", _default_cell_paragraph_attributes())
1515
+ _clear_paragraph_layout_cache(paragraph)
1504
1516
  run = paragraph.find(f"{_HP}run")
1505
1517
  if run is None:
1506
1518
  run = ET.SubElement(paragraph, f"{_HP}run", {"charPrIDRef": "0"})
@@ -1,9 +1,41 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: python-hwpx
3
- Version: 1.5
3
+ Version: 1.8
4
4
  Summary: Hancom HWPX 패키지를 로드하고 편집하기 위한 Python 유틸리티 모음
5
5
  Author: python-hwpx Maintainers
6
6
  License: Non-Commercial License
7
+
8
+ Copyright (c) 2024 python-hwpx Maintainers
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to use,
12
+ copy, modify, merge, publish, distribute, and sublicense the Software only for
13
+ non-commercial purposes, subject to the following conditions:
14
+
15
+ 1. Non-Commercial Use Only. The Software may be used, copied, modified,
16
+ merged, published, distributed, and sublicensed only for non-commercial
17
+ purposes. "Non-Commercial" means use that is not primarily intended for or
18
+ directed toward commercial advantage, monetary compensation, or any form of
19
+ direct or indirect commercial exploitation.
20
+
21
+ 2. Attribution. The above copyright notice and this permission notice shall be
22
+ included in all copies or substantial portions of the Software.
23
+
24
+ 3. No Warranty of Commercial Support. The maintainers are not obligated to
25
+ provide commercial support, maintenance, or updates.
26
+
27
+ THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ SOFTWARE.
34
+
35
+ If you require permissions to use this Software for commercial purposes,
36
+ please contact the copyright holders to negotiate an alternative licensing
37
+ arrangement.
38
+
7
39
  Project-URL: Homepage, https://github.com/airmang/python-hwpx
8
40
  Project-URL: Documentation, https://github.com/airmang/python-hwpx/tree/main/docs
9
41
  Project-URL: Issues, https://github.com/airmang/python-hwpx/issues
@@ -27,6 +59,7 @@ Requires-Dist: twine>=4.0; extra == "dev"
27
59
  Requires-Dist: pytest>=7.4; extra == "dev"
28
60
  Provides-Extra: test
29
61
  Requires-Dist: pytest>=7.4; extra == "test"
62
+ Dynamic: license-file
30
63
 
31
64
  # python-hwpx
32
65
 
@@ -93,6 +126,8 @@ document.save("output/example.hwpx")
93
126
 
94
127
  `HwpxDocument.add_table()`은 문서에 정의된 테두리 채우기가 없으면 헤더 참조 목록에 "기본 실선" `borderFill`을 만들어 표와 모든 셀에 참조를 연결합니다.
95
128
 
129
+ 표 셀 텍스트를 편집하는 `table.set_cell_text()`는 기존 단락에 남아 있는 `lineSegArray`와 같은 줄 배치 캐시를 제거하여 한/글이 문서를 다시 열 때 줄바꿈을 새로 계산하도록 합니다.
130
+
96
131
  더 많은 실전 패턴은 [빠른 시작](docs/quickstart.md)과 [사용 가이드](docs/usage.md)의 "빠른 예제 모음"에서 확인할 수 있습니다.
97
132
 
98
133
  ## 문서
@@ -295,6 +295,34 @@ def test_document_add_table_creates_table_structure() -> None:
295
295
  assert section.dirty is True
296
296
 
297
297
 
298
+ def test_table_set_cell_text_removes_layout_cache() -> None:
299
+ section_element = ET.Element(f"{HS}sec")
300
+ section = HwpxOxmlSection("section0.xml", section_element)
301
+ manifest = ET.Element("manifest")
302
+ root = HwpxOxmlDocument(manifest, [section], [])
303
+ document = HwpxDocument(cast(HwpxPackage, object()), root)
304
+
305
+ table = document.add_table(1, 1, section=section)
306
+ cell = table.cell(0, 0)
307
+ sublist = cell.element.find(f"{HP}subList")
308
+ assert sublist is not None
309
+ paragraph = sublist.find(f"{HP}p")
310
+ assert paragraph is not None
311
+ ET.SubElement(paragraph, f"{HP}lineSegArray")
312
+ ET.SubElement(paragraph, f"{HP}linesegarray")
313
+ assert paragraph.find(f"{HP}lineSegArray") is not None
314
+ assert paragraph.find(f"{HP}linesegarray") is not None
315
+ text_element = paragraph.find(f".//{HP}t")
316
+ assert text_element is not None
317
+ text_element.text = "Cached"
318
+
319
+ table.set_cell_text(0, 0, "Updated")
320
+
321
+ assert table.cell(0, 0).text == "Updated"
322
+ assert paragraph.find(f"{HP}lineSegArray") is None
323
+ assert paragraph.find(f"{HP}linesegarray") is None
324
+
325
+
298
326
  def test_table_merge_cells_updates_spans_and_structure() -> None:
299
327
  section_element = ET.Element(f"{HS}sec")
300
328
  section = HwpxOxmlSection("section0.xml", section_element)
File without changes
File without changes
File without changes