Skip to content

Heredoc in code won't parse right #162

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

Closed
zzak opened this issue Dec 18, 2012 · 2 comments
Closed

Heredoc in code won't parse right #162

zzak opened this issue Dec 18, 2012 · 2 comments
Labels

Comments

@zzak
Copy link
Member

zzak commented Dec 18, 2012

Say you have the following code:

# A sample of ruby with a heredoc
#
#     puts <<END
#       foo = "bar"
#       baz = 42
#     END
#     # foo = "bar"
#     # baz = 42
#       #=> nil
class HereDoc; end

The heredoc is not being respected:

@drbrain
Copy link
Member

drbrain commented Dec 18, 2012

This isn't a bug that can be fully fixed due to:

<<HEREDOC.chomp

HEREDOC

With .chomp the reconstructed source won't display properly in output either, it'll look like:

<<-HEREDOC
…
HEREDOC.chomp

which is a syntax error. I can only fix this when the identifier is followed by the end of line.

@zzak
Copy link
Member Author

zzak commented Dec 18, 2012

Thank you, looks good!

drbrain added a commit that referenced this issue Feb 24, 2013

Verified

This commit was signed with the committer’s verified signature.
lforst Luca Forstner
A TkHEREDOC is only generated when the heredoc identifier is followed by
a line end.  When followed by a method call, comma, etc. a TkSTRING is
returned instead so the source output in the HTML view is correct.

Fixes #162

Conflicts:
	History.rdoc
	lib/rdoc/store.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants