You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I often find myself adding a trivial comment helper to my nanoc projects to be able to easily comment out sections of a page. I suggest adding it to nanoc as it might be useful to everyone.
Use case: I often have the need to temporarily remove parts of a page. I can't use the Erb comment directive <%# ... %> because that cannot be nested: if the commented section contains a link helper it will break if included inside an Erb comment block. I also don't want to use the HTML comment <!-- ... --> because that leaves the HTML on the page. Ruby doesn't have a "no op" statement like some other languages do, <% if false %> ... <% end %> works but it's not very pretty.
So I find myself adding this trivial helper in default.rb:
defcomment(...);end
This allows me to do something like:
<% comment 'This still needs to be translated' do %>
Text here
<% end %>
Alternatively, it could be named skip or discard.
The text was updated successfully, but these errors were encountered:
I often find myself adding a trivial
comment
helper to my nanoc projects to be able to easily comment out sections of a page. I suggest adding it to nanoc as it might be useful to everyone.Use case: I often have the need to temporarily remove parts of a page. I can't use the Erb comment directive
<%# ... %>
because that cannot be nested: if the commented section contains a link helper it will break if included inside an Erb comment block. I also don't want to use the HTML comment<!-- ... -->
because that leaves the HTML on the page. Ruby doesn't have a "no op" statement like some other languages do,<% if false %> ... <% end %>
works but it's not very pretty.So I find myself adding this trivial helper in
default.rb
:This allows me to do something like:
Alternatively, it could be named
skip
ordiscard
.The text was updated successfully, but these errors were encountered: