getSql: Line break within arguments

I have this bad ass short code

<table border="1">
  {{ range $i, $r := getSql "SELECT name,sku,url_path,price  FROM `catalog_product_flat_1` where type_id=\"configurable\" and  price > 350" }}

    {{ if eq $i 0 }}
      <thead>
        <tr>
            <th>Name</th>
            <th>Sku</th>
            <th>Url</th>
        </tr>
      </thead>
    {{else}}
      <tbody>
        <tr>
            <td>{{ index $r "name" }}</td>
            <td>{{ index $r "sku" }}</td>
            <td><a href="/{{ index $r "url_path" }}">{{ index $r "price" }}</a></td>
        </tr>
      </tbody>
    {{end}}

  {{ end }}
</table>

The new feature getSql is available here. For self-compilers: check for build tags for using different drivers.

My problem is that the SQL query itself gets too long. How can I do a line break? Everything I’ve tried makes Hugo panic :frowning:

I would like to have something:

  {{ range $i, $r := getSql "SELECT name,sku,url_path,price 
      FROM `catalog_product_flat_1` 
      WHERE type_id=\"configurable\" and  price > 350" }}

Any ideas?

raw string literals, maybe.

See discussion at https://github.com/spf13/hugo/issues/923#issuecomment-75826513

and @bep’s comment

It can be fixed by removing the \n case here:

https://github.com/spf13/hugo/blob/master/hugolib/shortcodeparser.go#L429

PRs are welcome.

Neither of them is working. It does not affect the shortcodes.

Go states: http://golang.org/pkg/text/template/

although raw strings may not span newlines.

I have found another solution by using a path to .sql file as an argument. This is not really nice but makes working with SQL more easier.