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

caddyfile: Support backticks as quotes #3242

Merged
merged 1 commit into from
May 5, 2020
Merged

caddyfile: Support backticks as quotes #3242

merged 1 commit into from
May 5, 2020

Conversation

mholt
Copy link
Member

@mholt mholt commented Apr 8, 2020

Slated to land just after 2.0 release.

Closes #2591

@mholt mholt added the under review 🧐 Review is pending before merging label Apr 8, 2020
@mholt mholt added this to the 2.1 milestone Apr 8, 2020
Copy link
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and simple! 👍

@Conan-Kudo
Copy link
Member

@mholt Why use backticks instead of """? That would align similarly with other languages that do this (like Python, Ruby, et al)?

@francislavoie
Copy link
Member

francislavoie commented Apr 18, 2020

Since the primary usecase for this is JSON strings, backticks make more sense here I think. Easier to read, and JS has support for backticks as "template literals", i.e. interpolated strings, and Go does as well, "string literals".

Compare:

respond `{"some": "JSON", "content": ["1", "2", "3"]}`

vs...

respond """{"some": "JSON", "content": ["1", "2", "3"]}"""

And it's easier to implement in the lexer because otherwise we'd need to special case finding three consecutive ". Not that big of a difference, but simpler is better.

Copy link
Collaborator

@elcore elcore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@mholt mholt removed the under review 🧐 Review is pending before merging label May 5, 2020
@mholt mholt merged commit 5230561 into master May 5, 2020
@mholt mholt deleted the backtick-strings branch May 5, 2020 18:27
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.

Caddyfile support backtick strings
4 participants