-
Notifications
You must be signed in to change notification settings - Fork 0
Add granular control for individual service chapter visibility #243
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
base: master
Are you sure you want to change the base?
Changes from all commits
3fa0b4d
f7eb7d9
ddabe0e
50aad66
99cc033
6c68cdf
21e83ad
eed7c60
d65b586
2e743e7
0c2968e
5d2a344
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,12 +56,14 @@ def __init__( | |
| print_empty_chapters: bool = True, | ||
| user_defined_labels: Optional[list[str]] = None, | ||
| used_record_numbers: Optional[list[int | str]] = None, | ||
| hidden_chapters: Optional[list[str]] = None, | ||
| ): | ||
| super().__init__(sort_ascending, print_empty_chapters) | ||
|
|
||
| self.user_defined_labels = user_defined_labels if user_defined_labels is not None else [] | ||
| self.sort_ascending = sort_ascending | ||
| self.used_record_numbers: list[int | str] = used_record_numbers if used_record_numbers is not None else [] | ||
| self.hidden_chapters: list[str] = hidden_chapters if hidden_chapters is not None else [] | ||
|
|
||
| self.chapters = { | ||
| CLOSED_ISSUES_WITHOUT_PULL_REQUESTS: Chapter( | ||
|
|
@@ -293,3 +295,25 @@ def duplicity_allowed() -> bool: | |
| @return: True if duplicity is allowed, False otherwise. | ||
| """ | ||
| return ActionInputs.get_duplicity_scope() in (DuplicityScopeEnum.SERVICE, DuplicityScopeEnum.BOTH) | ||
|
|
||
| def to_string(self) -> str: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method has much more logic than just to_string. I do suggest something like serialize_chapters.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method override parent method to_string to keep the expected contract. |
||
| """ | ||
| Converts the chapters to a string, excluding hidden chapters. | ||
|
|
||
| @return: The chapters as a string. | ||
| """ | ||
| result = "" | ||
| for chapter in self.chapters.values(): | ||
| # Skip chapters that are in the hidden list | ||
| if chapter.title in self.hidden_chapters: | ||
| logger.debug("Skipping hidden service chapter: %s", chapter.title) | ||
| continue | ||
|
|
||
| chapter_string = chapter.to_string( | ||
| sort_ascending=self.sort_ascending, print_empty_chapters=self.print_empty_chapters | ||
| ) | ||
| if chapter_string: | ||
| result += chapter_string + "\n\n" | ||
|
|
||
| # Note: strip is required to remove leading newline chars when empty chapters are not printed option | ||
| return result.strip() | ||
Uh oh!
There was an error while loading. Please reload this page.