-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
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 |
There was a problem hiding this comment.
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?
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! |
I'll add test cases for URLs and large strings now |
This looks wayy more manageable than my old string splicer
Problem: twitter doesn't like it. #hashtag gets converted to /tag/<hashtag> in syndication |
Otherwise they'll be replaced in syndication by /tags/hashtag
Add automatic hashtag parsing from note-like posts
thanks again! |
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.