Multiline template strings that don't break indentation
gundersen at gmail.com
Fri Sep 12 00:04:04 PDT 2014
On Fri, Sep 12, 2014 at 7:40 AM, Sebastian Zartner <
sebastianzartner at gmail.com> wrote:
> And if someone wants to use his own tag? Would he have to reimplement
> dontIndent or String.noIndentation by himself?
> What I meant above with tag concatenation would be something like this:
> var a = String.noIndentation myTag
> `This is a template string.
> Even though each line is indented to keep the
> code neat and tidy, the white space used to indent
> is not in the resulting string`;
> So first the template string would be parsed by String.noIndentation and
> subsequently by myTag.
String.noIndent could return an array similar to what a tag function
expects to get as its arguments, where the first item is the string split
into chunks and the rest of the array is the values to be inserted. That
would let you do:
var query = sql(...String.noIndent`
select * from myDB
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss