-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
if-then-else example does not work #1569
Comments
@zbuc - When using jqplay, you don't include the outermost quotation marks. Same thing if the jq program goes in a file. Indeed, the outermost quotation marks are sometimes not needed at all. |
I followed the link directly from the documentation page, and did not manually change anything. It does not work as linked from the documentation. I tried removing the single quotes, and it does work. This seems like a defect in the links included in the documentation. |
@zbuc That's an example for you to use on a local shell, not on jqplay. I'm sorry, but there's no way to make the examples work for both. |
Then why is there a link to run it on jqplay if it doesn't work? |
Use multiline match on jqplay "run" link generation in documentation.
@nicowilliams here, I found and fixed the bug. The regex being used only worked properly on single-line examples and failed on multiline ones. |
@zbuc Oh! I never knew about that feature (the Run button). I use NoScript, and wasn't enabling the required origin for that... |
The example for if-then-else in the documentation does not work correctly when you try to run it in the linked jqplay editor:
https://stedolan.github.io/jq/manual/#example74
https://jqplay.org/jq?q=%27if%20.%20%3D%3D%200%20then%0A%20%20%22zero%22%0Aelif%20.%20%3D%3D%201%20then%0A%20%20%22one%22%0Aelse%0A%20%20%22many%22%0Aend%27&j=2
Results:
The text was updated successfully, but these errors were encountered: