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

Multiple delimeters #6

Open
robertlevy opened this issue Sep 13, 2014 · 2 comments
Open

Multiple delimeters #6

robertlevy opened this issue Sep 13, 2014 · 2 comments

Comments

@robertlevy
Copy link

Would love to see support for multiple delimiters. Something like:

options.delimiters = [
  '__', 
  {start: '<', end: '>'}, 
  {start: '{{', end: '}}'} 
]

Bonus points for handling nested delimiters (the ones that use start/end atleast)

@bunkat
Copy link
Owner

bunkat commented Sep 14, 2014

I don't have any need for this so probably won't be adding it myself. If you decide to add support, I'd be happy to take a pull request.

@burin
Copy link

burin commented Aug 25, 2015

@robertlevy I needed something like this as well, but the way that I am getting away with having multiple delimiters is passing in RegEx that will match multiple things. It doesn't work perfectly, but it may work for you.

Example:

pseudoloc.option.startDelimiter = '(%{|<|</)'; // %{ or < or </
pseudoloc.option.endDelimiter = '(}|>|/>)'; // } or > or />

The reason this works is because the delimiters are prepended/appended to a RegEx.

For me, it doesn't work perfectly, because I have html strings with attributes (<a href="">) that don't get excluded properly. However, strings like <strong> and </strong> get excluded OK.

Hope this helps!

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

No branches or pull requests

3 participants