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
NE-ON: multiline string support #1375
Comments
Are you sure such string should be in config and not database or a template? |
@enumag I think that @ViliamKopecky would welcome it in Ristretto. Basically NEON is just data format, does not have to be necessarily for configuration (which should not contain such long strings). |
In case of Ristretto, yes it might be a good thing. :-) |
@vojtech-dobes exactly ;) |
It would be good for translations as well. |
In Neon is missing support for multiline strings, because I don't know how handle indentation in this:
|
@dg I'd do it like this:
= "multi\nline\nstring"
= "multi\n line\n string" |
Maybe something like HEREDOC in PHP? One line starts multiline content:
But doesn't look good. :/ |
@Majkl578 What about this
|
It's still confusing since indentation level normally means "array"... But probably best option. |
I think the indetation should be ignored (value should be as is, without removing indentation) inside the string. Its the value, what if you would want to have the indentation inside the string.
It's not nice, but multiline strings aren't nice anywhere :) so... And I presume it won't be widely used feature. |
In response to @dg's example - I think it should strip the indentation.
Should return:
But
Should return:
If I am right, then just text without |
👎 all of the proposed syntaxes are ugly |
What about:
should return
and
should return
|
What's wrong with:
|
@Elijen nothing, it works. But you have to write those |
Maybe not as annonying as telling your BFU translator to put "\n" instead of line break. :) |
I would prefer to strip indentation. There can be condition "only if exists on every next line". Neon content stay readable. |
Next question: Should be EOL normalized from |
|
What about, stripping indetation based on the ending
|
I think that the best distinctive solution is a different syntax. With indentation
No indentation
|
This is
so it is not good idea to confuse it with multi line string. And Stripping base indentation in quoted string in block flow is probably good enough. |
Stripping indentation is good. |
And both use singificant whitespace syntax similarly to NE-ON. I see the advantage in not needing to escape single |
|
added support for multilines strings [Closes nette/nette#1375]
What is the multiline syntax apart using `\n' then? |
I've read that and found only one liners. I'm looking for multiline string. |
What can I say, read it again. Or maybe I don't understand your question at all. |
I'm trying to write something like this but with no success: key:
multi
line
value Edit: oh, so this is the syntax? Is there any else? key: """
multi
line
value
""" key: '''
multi
line
value
'''' |
Thanks, much better! I expected that in the begging, since that's the real issue. |
I tried to make a pull-request, but got lost in the
Tokenizer
insides.I propose using the python multiline string syntax.
From NE-ON:
To PHP:
The text was updated successfully, but these errors were encountered: