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

Add permalink metadata to message object #205

Merged
merged 2 commits into from
Jan 1, 2025

Conversation

volker-fr
Copy link
Contributor

@volker-fr volker-fr commented Dec 28, 2024

Add permalink option to message object. It's not used in this PR since I do not want to commit a modified template.

While its currently not used by templates/util.html, it can be used when providing your own template. Example has been added to the existing template.

@volker-fr volker-fr force-pushed the add-permalink branch 2 times, most recently from 7dc9b2e to b134458 Compare January 1, 2025 00:38
@volker-fr
Copy link
Contributor Author

@hfaran This PR should now also be ready. When using templates, the new option can be used. This way the current default output doesn't need to be modified.

@@ -19,7 +19,7 @@ class SlackFormatter(object):
# Class-level constants for precompilation of frequently-reused regular expressions
# URL detection relies on http://stackoverflow.com/a/1547940/1798683
_LINK_PAT = re.compile(r"<(https|http|mailto):[A-Za-z0-9_\.\-\/\?\,\=\#\:\@]+\|[^>]+>")
_MENTION_PAT = re.compile(r"<((?:#C|@[UB])\w+)(?:\|([A-Za-z0-9.-_]+))?>")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a bugfix for slackdump. Slackdump channels are "<#C....|> without any character after the pipe.

If nothing is behind the pipe symbol, the existing logic will fall back looking up the proper channel name.

@hfaran hfaran merged commit 8caff34 into hfaran:master Jan 1, 2025
2 checks passed
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