Comments (5)
Posts are moving to a more pre-processing method. Links, mentions and hashtags will all be parsed at the time you post and stored along side the post. This will mean looking for them only happens once, it will also allow users the ability to de-tag themselves and such in the future.
This is going to take a little work to get all of these processed before hand but at least will only happen the once. The front end will then be able to process the stored data for highlighting which we hope will be quicker as what it needs to highlight will be stored. In the future we could even store a copy of this in the database but caching it is also a good idea. If the post is changed in any way these can then be updated.
The new models for posts I am thinking is such:
{
"_id": "<UUID>",
"reply_to": "<UUID>",
"user_id": "<UUID>",
"username": "username",
"created": 1427189599,
"score": 0,
"body": "Hello world!",
"upload": "<filename>",
"comment_count": 1,
"links": [{
"url": "pjuu.com",
"span": [1, 9]
}],
"mentions": [{
"user_id": "<UUID>",
"username": "username",
"span": [1, 9]
}],
"hashtags": [{
"tag": "hashtag",
"span": [1, 8]
}]
}
This would never happen because there is multiple fields which would not appear at the same time (post vs. reply). Documenting this as an idea.
from pjuu.
This is a harder problem that I first thought. The code in master is not much use as it can match a URL
, mention
or hashtag
on the same string.
It going to have to work like Jinja2's urlize
a bit more. Split the string on spaces then try and match each one to a regex. The first one it matches it will be treat as that.
This will require changing the regex's slightly but should work. I will push changes when I get it sorted.
from pjuu.
This also isn't going to work that well. Will probably take some pointer from Twitter and the twitter-text
repository. I have already refactored out the parsers in to the lib
package. Will push when I get chance.
from pjuu.
This feature is in but it needs some polish. It realistically should have been done as a PR but we now know for another time.
from pjuu.
Related to #64.
Going to close as this will be fixed with that issue as parsing out hashtags is all that is left.
from pjuu.
Related Issues (20)
- Configure from the environment
- Site redesign
- Next/Prev page links always take you to page 1 HOT 1
- Github flagged Jinja2 security issue HOT 2
- Thumbnail size issue HOT 1
- Move Docker builds HOT 5
- Review error handling in storage sub system
- Storage migration HOT 1
- Opening an image from a post causes a new window HOT 3
- pipenv HOT 1
- Refactor & Asyncio
- Alternative languages HOT 8
- Moderator flags can hide posts HOT 6
- Private followers and following lists
- Dashboard more control
- Single Dockerfile HOT 1
- Arm Support
- work with the fediverse HOT 3
- requirements.txt and python version for developing HOT 2
- Site is using an invalid security certificate HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pjuu.