diff --git a/pyproject.toml b/pyproject.toml index 7226d50..30e4c87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ no_implicit_reexport = true [project] name = "upset-alttxt" -version = "0.4.4" +version = "0.4.5" description = "Generates alt text for UpSet plots" readme = "README.md" requires-python = ">=3.8" diff --git a/src/alttxt/generator.py b/src/alttxt/generator.py index 5fb948d..4c6d2c7 100644 --- a/src/alttxt/generator.py +++ b/src/alttxt/generator.py @@ -90,19 +90,22 @@ def text(self) -> str: trend_analysis = self.descriptions["level_3"]["trend_analysis"] text_desc += trend_analysis text_desc += " " - if self.structured: # Helper function to replace periods with newlines and bullet points def add_bullet_points(text: str) -> str: - # Add a bullet point to the first sentence - text = text.strip() - text = "* " + text + # add bullet point to the first sentence + text = "* " + text.strip() parts = text.split('. ') + if len(parts) > 1: - return '.\n* '.join(parts[:-1]) + '. ' + parts[-1] - return text + # add \n* to each part except the last one, and only add * to the first one + p = parts[0] + ".\n* " + ("\n* ".join(parts[1:])) + print(p) + return p + else: + return text # Construct the dictionary for markdown content data_to_write_as_md = {