Skip to content

feat: add parameter to choose of which pages export the doctags #290

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.

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docling_core/types/doc/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -3885,6 +3885,7 @@ def export_to_doctags( # noqa: C901
add_table_cell_location: bool = False,
add_table_cell_text: bool = True,
minified: bool = False,
pages: Optional[list[int]] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's make it a set since the underlying parameter is also a set.

Suggested change
pages: Optional[list[int]] = None,
pages: Optional[set[int]] = None,

) -> str:
r"""Exports the document content to a DocumentToken format.

Expand All @@ -3903,6 +3904,7 @@ def export_to_doctags( # noqa: C901
:param # table specific flagsadd_table_cell_location: bool
:param add_table_cell_text: bool: (Default value = True)
:param minified: bool: (Default value = False)
:param pages: list[int]: (Default value = None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
:param pages: list[int]: (Default value = None)
:param pages: set[int]: (Default value = None)

:returns: The content of the document formatted as a DocTags string.
:rtype: str
"""
Expand All @@ -3927,6 +3929,7 @@ def export_to_doctags( # noqa: C901
add_page_break=add_page_index,
add_table_cell_location=add_table_cell_location,
add_table_cell_text=add_table_cell_text,
pages=pages,
mode=(
DocTagsParams.Mode.MINIFIED
if minified
Expand Down