Skip to content

Feature request: Add helper to comment out parts of a file #68

@Fjan

Description

@Fjan

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:

def comment(...);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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions