-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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 splitRE template func #2061
Comments
Hmm... I think we should think hard before we add more regexp stuff. This is needed to patch shortcomings of Hugo, and it opens up to fairly ineffective pipelines of
We should solve this properly, I believe there are other issues floating around about getting the different content sections. |
The reason why I planned to implement both template funcs was to improve the results of the search index. I know that regexp are a bad (and perhaps slow) approach to solve the problem. But the template limit my possibilities. Maybe you new an alternative way to achieve this. |
This is the alternative: russross/blackfriday#166 Hugo's speed is one of its main selling points, and is the reason why I spent three hours implementing a emoji parser instead of using an existing slow, memory-consuming and buggy one. It adds up. This function would maybe be fine when used "within reason", but then it ends up in your themes and it becomes the new Hugo benchmark. |
Regexp is a great thing. But in this case it is the wrong choice. |
As I stated I know that regexp are not my first tool of choice in this case. That why I asked for better alternatives and I share your thoughts. The linked Blackfriday issue would solve a lot of problems. But the project doesn't seems to be very active (I do not want to blame anyone - it's just an observation). |
I would need this now... I need to split a string that may end with Unix or Windows newlines, and by far this would be the easiest way to do it I can think of. |
(I will use |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
splitRE
would work analogous to #2048. Users pass the regular expression, content that should be splitted and an optional third parameter to limit the matches. A slice of strings would be returned.It's implementation would upon
regexp
'ssplit
function.The text was updated successfully, but these errors were encountered: