Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Andrew/sanitize title - #340

#340
Merged
ayjayt merged 7 commits into
masterplotly/Kaleido:masterfrom
andrew/sanitize-titleplotly/Kaleido:andrew/sanitize-titleCopy head branch name to clipboard
Jun 3, 2025
Merged

Andrew/sanitize title#340
ayjayt merged 7 commits into
masterplotly/Kaleido:masterfrom
andrew/sanitize-titleplotly/Kaleido:andrew/sanitize-titleCopy head branch name to clipboard

Conversation

@ayjayt

@ayjayt ayjayt commented Jun 3, 2025

Copy link
Copy Markdown
Collaborator

Add regex to sanitize title

@ayjayt
ayjayt requested a review from emilykl June 3, 2025 16:54
)
prefix = fig.get("layout", {}).get("title", {}).get("text", "fig")
prefix = re.sub(r"[ \-]", "_", prefix)
prefix = re.sub(r"[^a-zA-Z0-9_]", "", prefix)

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.

nit: Maybe add a final step here that if the resulting prefix is an empty string, set it to "fig", e.g.:

prefix = prefix or "fig"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yeah that's fine, so in the case where they have a title like "####"

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.

Yeah exactly, in case the title is ONLY special characters

@emilykl emilykl left a comment

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.

Looks good @ayjayt 👍

@ayjayt
ayjayt merged commit eb21c13 into master Jun 3, 2025
@ayjayt
ayjayt deleted the andrew/sanitize-title branch June 3, 2025 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.