yard icon indicating copy to clipboard operation
yard copied to clipboard

Heredoc constants do not preserve their indentation

Open AaronC81 opened this issue 4 years ago • 0 comments

Heredocs are sensitive to their indentation, but it seems that YARD strips away this indentation.

Steps to reproduce

Create this file and generate documentation for it:

module X
  A = <<-EOF
    bar!
    EOF

  B = <<-EOF
  bar!
  EOF
end

Actual Output

irb> require 'yard'
=> true
irb> YARD::Registry.load!
=> YARD::Registry
irb> YARD::Registry.root.children.first.children.map(&:value)
=> ["<<-EOF\nbar!\nEOF", "<<-EOF\nbar!\nEOF"]

Expected Output

The values of the constants should be "<<-EOF\n bar!\n EOF" and <<-EOF\n bar!\n EOF" respectively, to reflect the values which Ruby assigns to them.

Environment details:

  • OS: Manjaro Linux 19.0.2 Kyria
  • Ruby version (ruby -v): ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
  • YARD version (yard -v): yard 0.9.24

I have read the Contributing Guide.

AaronC81 avatar Mar 12 '20 17:03 AaronC81