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

indent will mess up heredocs #3

Closed
thinkerbot opened this issue Feb 24, 2011 · 1 comment
Closed

indent will mess up heredocs #3

thinkerbot opened this issue Feb 24, 2011 · 1 comment

Comments

@thinkerbot
Copy link
Contributor

For example:

[recipe/example.rb]
target.puts "# outdent"
indent do
  target.puts "# indent"
  heredoc do
    target.puts 'abc'
    target.puts 'xyz'
  end
end
target.puts "# outdent"

Produces:

# outdent
  # indent
  << HEREDOC_0
  abc
  xyz
  HEREDOC_0
# outdent

To solve this, perhaps add magic comments to turn on/off indent, a-la

    << HEREDOC_0 # :indent-off:
  abc
  xyz
  HEREDOC_0  # :indent-on:

Then strip out these processing instructions within indent if capture depth is 0 (ie right before the indent is written to the true output).

@thinkerbot
Copy link
Contributor Author

Indent logic is now in linebook. Closed by pinnacol/linebook@23fccae

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

No branches or pull requests

1 participant