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

urlpreview: menu bars returned from preview API are ugly, can be fixed with a regexp #36

Open
ajkessel opened this issue Jun 10, 2024 · 0 comments

Comments

@ajkessel
Copy link
Contributor

ajkessel commented Jun 10, 2024

The synapse previewer often returns an ugly og.description, where several options from a menu bar are shown each on one line, making for an overlong preview. The attached patch fixes that with a simple regexp.
fix_menu_previews.patch

description = re.sub(r'([\w\s]{2,25})(\s*<br\s*/>\s*)+',r'\1 | ',format_description(og.get('description', None)))

Screenshots:

Before Patch

before patch applied

After Patch

after patch applied

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

No branches or pull requests

1 participant