Skip to content

Keep TableAnnotation type when lines are merged - #572

Open
FedyaBadyilo wants to merge 2 commits into
ispras:developfrom
FedyaBadyilo:fix/shift-annotations-keep-tables
Open

FedyaBadyilo wants to merge 2 commits into
ispras:developfrom
FedyaBadyilo:fix/shift-annotations-keep-tables

Conversation

@FedyaBadyilo

Copy link
Copy Markdown

Summary

  • __shift_annotations now copies table and attachment marks as TableAnnotation / AttachAnnotation instead of a generic Annotation.
  • Several tables on a glued line all stay in the tree: AnnotationMerger no longer drops all but the first.

Closes #571

Test plan

  • python -m unittest tests.unit_tests.test_misc_tree_node
  • flake8 .

@FedyaBadyilo
FedyaBadyilo changed the base branch from master to develop August 22, 2026 09:40
@NastyBoget
NastyBoget self-requested a review September 14, 2026 07:32

table_anns = [ann for ann in node.annotations if ann.name == TableAnnotation.name]
self.assertEqual(2, len(table_anns))
self.assertTrue(all(isinstance(ann, TableAnnotation) for ann in table_anns))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Аналогично #570 эта строка не нужна


new_annotations = []
for annotation in line.annotations:
new_annotation = Annotation(start=annotation.start + text_length, end=annotation.end + text_length, name=annotation.name, value=annotation.value)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Аналогично #570 нужно передать annotation.is_mergeable при создании new_annotation вместо использования конкретных типов классов аннотаций

@NastyBoget NastyBoget added the bug Something isn't working label Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

При склейке строк из нескольких таблиц в дереве остаётся только первая

2 participants