GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(core): add neutral source, heading and trailing-text policy seams by airmang · Pull Request #625 · airmang/python-hwpx

feat(core): add neutral source, heading and trailing-text policy seams #625

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.

Sign up for GitHub

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
airmang merged 6 commits into main from feat/additive-migration-seams
Oct 30, 2026
+713 −16
Merged

feat(core): add neutral source, heading and trailing-text policy seams #625

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit Hold shift + click to select a range
113da7d
feat(core): expose neutral paragraph, heading and trailing-text seams
airmang Oct 30, 2026
11004f6
Merge commit 'd452b00eb03e01912556cd30a09c3776f0eaa6b6' into feat/add…
airmang Oct 30, 2026
952103f
fix(core): use structured seam errors and classify the new format owner
airmang Oct 30, 2026
23f9b4f
fix(table-patch): isolate nested metadata and refuse unsafe parent fills
airmang Oct 30, 2026
daebdcc
Merge remote-tracking branch 'refs/remotes/origin/main' into fix/nest…
airmang Oct 30, 2026
cc59240
Merge commit 'daebdcc34922c1022af67de755a747fce57fcf76' into feat/add…
airmang Oct 30, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
fix(core): use structured seam errors and classify the new format owner
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@airmang
airmang committed Oct 30, 2026
commit 952103f230f71aba151fc8a7edcaef28c78de5f6

There are no files selected for viewing

3 changes: 2 additions & 1 deletion 3 src/hwpx/_trailing_table_text.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from lxml import etree

from .errors import HwpxValueError
from .opc.xml_utils import _XML_MARKUP, parse_xml
from .oxml.namespaces import tag_in_family, tag_local_name

Expand Down Expand Up @@ -36,7 +37,7 @@ def _element_spans(source: bytes, root: etree._Element) -> dict[etree._Element,
if not token.endswith(b"/>"):
stack.append(element)
if stack or next(elements, None) is not None:
raise ValueError("could not bind paragraph XML to source bytes")
raise HwpxValueError("could not bind paragraph XML to source bytes", context={"operation": "strip_trailing_table_text"})
return spans


Expand Down
4 changes: 2 additions & 2 deletions 4 src/hwpx/table_patch.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from pathlib import Path
from typing import Any, Callable, Iterable, Mapping, Sequence

from .errors import HwpxError
from .errors import HwpxError, HwpxTypeError
from .oxml.table_sizes import COLUMN_FLOOR_EXTRA, effective_cell_margin_source
from .opc.security import guard_zip_file, read_member, read_zip_members
from .mutation_report import MutationReport, project_byte_splice
Expand Down Expand Up @@ -2624,7 +2624,7 @@ def strip_trailing_table_text(
their bytes. Selection errors propagate before any output is published.
"""
if not callable(predicate):
raise TypeError("predicate must be callable")
raise HwpxTypeError("predicate must be callable", context={"argument": "predicate"})
return _strip_trailing_table_text(source, predicate=predicate, output_path=output_path, legacy=False)


Expand Down
3 changes: 2 additions & 1 deletion 3 src/hwpx/tools/markdown_export.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from typing import Union

from ..document import HwpxDocument
from ..errors import HwpxTypeError
from ..oxml._document_primitives import _text_element_content
from ..oxml.hyperlink_form import hyperlink_target
from ..oxml.namespaces import tag_local_name
Expand Down Expand Up @@ -571,7 +572,7 @@ def export_markdown(
"""
detector = _detect_heading if heading_detector is None else heading_detector
if not callable(detector):
raise TypeError("heading_detector must be callable or None")
raise HwpxTypeError("heading_detector must be callable or None", context={"argument": "heading_detector"})
doc = _export_resolve_doc(source)
mapping = _build_image_map(doc, Path(image_dir) if image_dir else None, image_ref_prefix)
notes: list[tuple] = []
Expand Down
14 changes: 14 additions & 0 deletions 14 tests/test_migration_seams.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,17 @@ def test_heading_callback_reaches_namespace_and_ingest_without_extension() -> No
assert "### injected" in document.text.markdown(rich=True, **options)
result = DocumentIngestor.default().convert(BytesIO(document.to_bytes()), markdown_options=options)
assert "### injected" in result.markdown and "# Ⅰ." not in result.markdown


@pytest.mark.parametrize("argument", ["heading_detector", "predicate"])
def test_invalid_callbacks_raise_structured_type_errors_before_io(argument) -> None:
from hwpx.errors import HwpxTypeError
from hwpx.table_patch import strip_trailing_table_text

with pytest.raises(HwpxTypeError) as found:
if argument == "heading_detector":
export_markdown(b"not a package", heading_detector=42)
else:
strip_trailing_table_text(b"not a package", predicate=42)
assert found.value.code == "hwpx-type-error"
assert found.value.context == {"argument": argument}
3 changes: 2 additions & 1 deletion 3 tests/test_product_boundary.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ def test_real_tree_gate_runs_from_a_gitless_source_copy(tmp_path: Path) -> None:
# +1: row and column insertion and deletion and cell splits on the table object model
# (oxml/table_structure.py), outside table.py because that owner file sits at its 1600-line cap.
# +1: the experimental line layout cache writer (layout/line_cache.py).
assert report["classifiedFiles"] == 183
# +1: QName-aware trailing-table-text byte spans; caller owns selection policy.
assert report["classifiedFiles"] == 184


def test_gitless_cli_reproduces_literal_dynamic_import_failure_without_mutating_source(
Expand Down
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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.