Skip to content
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

feat: make addition of ToC idempotent #74

Merged
merged 3 commits into from
Aug 11, 2023

Conversation

lukany
Copy link
Contributor

@lukany lukany commented Aug 10, 2023

By design it was possible to add table of contents multiple times.
The rendered report then contained multiple table of contents.
Having a separate argument for table of contents instead of having
it in sections list makes multiple calls of add_table_of_contents()
idempotent — always only one ToC is rendered in the end.

@lukany lukany self-assigned this Aug 10, 2023
@lukany lukany force-pushed the feat/make-toc-add-idempotent branch from 9c6ae29 to c85a86c Compare August 10, 2023 12:35
By design it was possible to add table of contents multiple times.
The rendered report then contained multiple table of contents.
Having a separate argument for table of contents instead of having
it in sections list makes multiple calls of add_table_of_contents()
idempotent — always only one ToC is rendered in the end.
@lukany lukany force-pushed the feat/make-toc-add-idempotent branch from c85a86c to a05f85c Compare August 10, 2023 12:38
@lukany lukany marked this pull request as ready for review August 10, 2023 12:38
Copy link
Collaborator

@mbelak-dtml mbelak-dtml left a comment

Choose a reason for hiding this comment

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

Nice PR! Made me think that TableOfContents should not actually even be an instance of Section, since the show method breaks the inheritance contract anyway (has a different argument). This PR would also make it easier to change in the future.

EDIT: Created an issue to remove the inheritance #79.

Just 1 minor comment (applies to 2 places).

edvart/report_sections/table_of_contents.py Outdated Show resolved Hide resolved
edvart/report_sections/table_of_contents.py Outdated Show resolved Hide resolved
@lukany lukany requested a review from mbelak-dtml August 11, 2023 08:07
@mbelak-dtml mbelak-dtml added this pull request to the merge queue Aug 11, 2023
Merged via the queue into main with commit 726f634 Aug 11, 2023
@mbelak-dtml mbelak-dtml deleted the feat/make-toc-add-idempotent branch August 11, 2023 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants