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 automatic hashtag parsing from note-like posts #57

Merged
merged 12 commits into from
Jun 4, 2015

Conversation

LanaCoyote
Copy link
Contributor

This adds the function util.parse_hashtags which accepts a string, looks for any hashtags in it (a pound sign followed by at least two alphanumunderscoric characters), and returns a tuple of the string with the hashtags linking to "tags/<hashtag>" and a list of the tags parsed out. The parsed tags are automatically added to the post's tag list when saved (admin.py line 281).

Added because it's an easy and twitter-like way to add tags to a post.

The edit/delete links on the venues screen didn't have the proper
namespaces attached, so I added them
Adding a hashtag (#whatever) to a note-like article will replace it with
a link and add the parsed tag to the post's tags automatically.


def parse_hashtags(s):
# TODO: do this better
Copy link
Owner

Choose a reason for hiding this comment

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

maybe pull out bs4_sub() into a top level function and use it here too?

@kylewm
Copy link
Owner

kylewm commented Jun 4, 2015

This is great, I've been meaning to do something like it for a very long time. And thanks a lot for the test cases!

@LanaCoyote
Copy link
Contributor Author

I'll add test cases for URLs and large strings now

@LanaCoyote
Copy link
Contributor Author

Problem: twitter doesn't like it. #hashtag gets converted to /tag/<hashtag> in syndication

Otherwise they'll be replaced in syndication by /tags/hashtag
kylewm added a commit that referenced this pull request Jun 4, 2015
Add automatic hashtag parsing from note-like posts
@kylewm kylewm merged commit 4482535 into kylewm:master Jun 4, 2015
@kylewm
Copy link
Owner

kylewm commented Jun 4, 2015

thanks again!

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.

None yet

2 participants