|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
RHTML commentsWe have actions in the IDE for commenting/uncommenting sections of
code. It works for Ruby - just hit Ctrl-/ to toggle comments. It doesn't work in RHTML however - as tracked by issue http:// ruby.netbeans.org/issues/show_bug.cgi?id=110505 . I was going to fix this - but then realized I'm not sure how to fix it. What's the best way of commenting out a line, repeatedly, in RHTML? Just inserting <!-- and --> around each line won't work - Ruby code will still be executed. I'm thinking of using <%# and %> around each line. There are some other alternatives, like inserting <% if false %>, <% end %> around the block of code, but this has some disadvantages - you don't get syntax highlighting feedback that the code is commented out (since it's "execution"-based commenting) - and it works differently than the "per-line-commenting" that is used for this in the IDE. -- Tor --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: RHTML commentsOn Aug 2, 2007, at 2:58 PM, Tor Norbye wrote: > I'm thinking of using <%# and %> around each line. There are some > other alternatives, like inserting <% if false %>, <% end %> around > the block of code, but this has some disadvantages - you don't get > syntax highlighting feedback that the code is commented out (since > it's "execution"-based commenting) - and it works differently than > the "per-line-commenting" that is used for this in the IDE. <%# %> is the standard rhtml comment. Unless there's a really good reason not to, I'd use that. :dudley --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: RHTML commentsOn 8/3/07, Dudley Flanders <dudley@...> wrote:
> > On Aug 2, 2007, at 2:58 PM, Tor Norbye wrote: > > I'm thinking of using <%# and %> around each line. There are some > > other alternatives, like inserting <% if false %>, <% end %> around > > the block of code, but this has some disadvantages - you don't get > > syntax highlighting feedback that the code is commented out (since > > it's "execution"-based commenting) - and it works differently than > > the "per-line-commenting" that is used for this in the IDE. > > <%# %> is the standard rhtml comment. Unless there's a really good > reason not to, I'd use that. > > :dudley Yes I would second that.... -- Let them talk of their oriental summer climes of everlasting conservatories; give me the privilege of making my own summer with my own coals. http://blog.gnufied.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: RHTML commentsGiven:
<% a = :snark b = 2 %> I'd expect the result to be: <% # a = :snark # b = 2 %> For a one-liner (or N consecutive one-liners), it'd be what's been mentioned before: <% a = :snark %> <% b = 2 %> <%# a = :snark %> <%# b = 2 %> The if-false block seems like a different operation than "comment this region." - James Moore --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: RHTML commentsOn 8/3/07, James Moore <jamesthepiper@...> wrote:
> Given: > > <% > a = :snark > b = 2 > %> > thats considered ugly and not advisable in ruby/rails world i suppose. > I'd expect the result to be: > > <% > # a = :snark > # b = 2 > %> > > For a one-liner (or N consecutive one-liners), it'd be what's been > mentioned before: > > <% a = :snark %> > <% b = 2 %> > > <%# a = :snark %> > <%# b = 2 %> > > The if-false block seems like a different operation than "comment this region." > > - James Moore > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > > -- Let them talk of their oriental summer climes of everlasting conservatories; give me the privilege of making my own summer with my own coals. http://blog.gnufied.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: RHTML commentsOn 8/3/07, hemant <gethemant@...> wrote:
> thats considered ugly and not advisable in ruby/rails world i suppose. Still, an erb commenting system needs to deal with it. Turning it into multiple statements is problematic - a commenting system needs to be reversible. I expect a select_region-comment-uncomment cycle to be a no-op. And I'm not sure I agree that it's bad style. In general Rails code should be moved to helpers and models, not in erb, but I suspect there are perfectly reasonable uses for this style of code in an erb. For one, you can't assume that an erb file is dealing with HTML in a Rails app; it's just embedded Ruby in a text file, and I suspect in a non-html/non-Rails environment people would use multiline ruby far more often. - James Moore --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: RHTML commentsOn Aug 2, 2007, at 2:10 PM, James Moore wrote:
> Given: > > <% > a = :snark > b = 2 > %> > > I'd expect the result to be: > > <% > # a = :snark > # b = 2 > %> > > For a one-liner (or N consecutive one-liners), it'd be what's been > mentioned before: > > <% a = :snark %> > <% b = 2 %> > > <%# a = :snark %> > <%# b = 2 %> > > The if-false block seems like a different operation than "comment > this region." Just to tie up this thread - thank you all for your feedback. I implemented something similar to the below: Toggle comment for <% foo %> will create <%# foo %> (and toggle again gives you back what you had.) For non-Ruby lines in the RHTML file, like this: <p> Hello World </p> I also use RHTML-style comments such that the lines will be removed from output: <%#*<p>%> <%#*Hello World%> <%#*</p>%> Toggling again will bring back what you originally had - <p>Hello World</p>. The reason I stick an extra "*" in there is such that I can correctly uncomment/comment the code. Otherwise, how can I uncomment the below? <%# foo %> Is it Ruby code, which should uncomment to <% foo %> or is it text, which should uncomment to foo ? The * is what gives it away. Hopefully this works well enough for 6.0. File any bugs or suggestions for improvements with the issue tracker. -- Tor --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: RHTML comments<snip>
> <p> > Hello World > </p> > > I also use RHTML-style comments such that the lines will be removed > from output: > > <%#*<p>%> > <%#*Hello World%> > <%#*</p>%> > > Toggling again will bring back what you originally had - <p>Hello > World</p>. > > The reason I stick an extra "*" in there is such that I can correctly > uncomment/comment the code. Otherwise, how can I uncomment the below? > would ## not suffice? just my 2c Thanks for all the effort Mark > <%# foo %> > > Is it Ruby code, which should uncomment to > <% foo %> > or is it text, which should uncomment to > foo > ? > The * is what gives it away. > > Hopefully this works well enough for 6.0. File any bugs or > suggestions for improvements with the issue tracker. > > -- Tor > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
| Free Forum Powered by Nabble | Forum Help |