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

multiline strings enhancements #391

Open
rogue-one opened this issue Apr 24, 2016 · 1 comment
Open

multiline strings enhancements #391

rogue-one opened this issue Apr 24, 2016 · 1 comment

Comments

@rogue-one
Copy link
Contributor

rogue-one commented Apr 24, 2016

following features support for multiline strings will go a long way.

  • support for substitution for multi-line strings
  • support for scala's stripMargin like feature.
    ie remove leading and trailing white-spaces without relatively changing the indentation between each line. This is required if we have any indentation sensitive content in the leaf string node of the config, say for eg a python script. below I have used triple quotes to distinguish this from normal multiline string.
   conf = {
      language = python
      code = '''
             |for item in range(10)
             |     <some expression>
             '''
    }
@rogue-one rogue-one changed the title multiline strings multiline strings enhancements Apr 24, 2016
@havocp
Copy link
Collaborator

havocp commented Apr 24, 2016

Substitution could use the backtick "template literal" syntax from JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
This seems fairly straightforward if we have anyone willing to do the spec/code patch.

I don't really know how to do stripmargin. There are limits to what we can do without making HOCON into a programming language... but maybe there's a clever solution. There is a workaround now I believe (use multiple string literals and allow them to be concatenated) which doesn't seem terrible, so I don't know if we'd want to do anything complex here. But it could be worth exploring options and proposing how it would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants