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

Minor replace and % funcs improvement. #1884

Merged
merged 2 commits into from
Feb 18, 2014
Merged

Minor replace and % funcs improvement. #1884

merged 2 commits into from
Feb 18, 2014

Conversation

seven-phases-max
Copy link
Member

I just noticed that the following code:

.test {
    1: replace( "foo", "1", "2");
    2: replace( 'bar', "1", "2");
    3: replace(  baz,  "1", "2");
    4: replace(~"qux", "1", "2");
}

compiles to:

.test {
  1: "foo";
  2: "bar";
  3: "baz";
  4: "qux";
}

So this PR is an attempt to bring some consistency there:

  • preserve quote char (", ' or none)
  • preserve escaped flag.

@seven-phases-max
Copy link
Member Author

P.S. The same is probably to be done for the % function since it has the same code.
(though I understand that the fact that both functions can accept escaped strings and even tree.Keyword values was unintended and not documented, but if they actually can then...)

@lukeapage
Copy link
Member

shall we add tests for this? I'll do this in a couple of days if you don't get round to it

@seven-phases-max
Copy link
Member Author

I can do that. Will it be OK if I also add % changes into this PR?

@lukeapage
Copy link
Member

Fine by me.

@seven-phases-max
Copy link
Member Author

Done.

lukeapage added a commit that referenced this pull request Feb 18, 2014
@lukeapage lukeapage merged commit 9dbb18c into less:master Feb 18, 2014
@seven-phases-max seven-phases-max deleted the replace-func-improvement branch February 18, 2014 15:54
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

Successfully merging this pull request may close these issues.

2 participants