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

Support for common python string functions #134

Open
flexferrum opened this issue Sep 5, 2019 · 10 comments
Open

Support for common python string functions #134

flexferrum opened this issue Sep 5, 2019 · 10 comments
Assignees
Labels
enhancement New feature or request hacktoberfest Issues for Hacktoberfest
Milestone

Comments

@flexferrum
Copy link
Collaborator

flexferrum commented Sep 5, 2019

It should be possible to call common python string functions (like split, partition etc.) from the Jinja2 templates. Like this:

{% set strings=text.split(' ') %}
@flexferrum flexferrum added the enhancement New feature or request label Sep 5, 2019
@flexferrum flexferrum added this to the Release 1.1 milestone Sep 5, 2019
@flexferrum flexferrum added this to To Do in Jinja2Cpp standard features via automation Sep 5, 2019
@flexferrum flexferrum added the hacktoberfest Issues for Hacktoberfest label Sep 8, 2019
@Servuc
Copy link

Servuc commented Oct 7, 2019

If is it that you say : https://docs.python.org/fr/3/library/stdtypes.html#str

I will work on it for Hacktoberfest :)

@flexferrum
Copy link
Collaborator Author

Yes, exactly. Thanks! But before you start, lets discuss the exact set of methods to implement.

@Servuc
Copy link

Servuc commented Oct 7, 2019

Is it possible to first implement :

  • str.capitalize()
  • str.center(width[, fillchar])
  • str.count(sub[, start[, end]])
  • str.endswith(suffix[, start[, end]])
  • str.find(sub[, start[, end]])
  • str.index(sub[, start[, end]])
  • str.isalnum()
  • str.isascii()
  • str.isnumeric()
  • str.islower()
  • str.isupper()
  • str.lower()
  • str.replace(old, new[, count])
  • str.split(sep=None, maxsplit=-1)
  • str.splitlines([keepends])
  • str.startswith(prefix[, start[, end]])
  • str.strip([chars])
  • str.upper()

Is it too much ? :)

@Servuc
Copy link

Servuc commented Oct 7, 2019

More over,
For my personal dev, I will add a Dockerfile for compilation, do you want it too ?

Good coding day

@flexferrum flexferrum moved this from To Do to In Progress in Jinja2Cpp standard features Oct 7, 2019
@flexferrum
Copy link
Collaborator Author

For my personal dev, I will add a Dockerfile for compilation, do you want it too ?

I'm using Windows environment for development so Docker isn't my choice...

@flexferrum
Copy link
Collaborator Author

Is it too much ?

That's a good list. One thing I care about: there is implementation of some of this methods as a filters/testers (ex. https://github.com/jinja2cpp/Jinja2Cpp/blob/master/src/string_converter_filter.cpp ) So, there should be a way to reuse this implementation somehow.

@Servuc
Copy link

Servuc commented Oct 8, 2019

Hi,

For the Dockerfile, perhaps, just put it in wiki to prevent misunderstanding :)

Yes, I have see that file :) Thank you

@Servuc
Copy link

Servuc commented Nov 1, 2019

Hey,

Even if I have not ended that PR before the end of Hacktoberfest, I will finish it ;)

Have a good coding day

@flexferrum
Copy link
Collaborator Author

Thank you!

@flexferrum
Copy link
Collaborator Author

flexferrum commented Nov 5, 2019

Can you share your approach in handling user-callable for strings? Looks like I need to do the same for MapAdapter.
#178

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest Issues for Hacktoberfest
Projects
Development

No branches or pull requests

2 participants