Skip to content
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

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

Open
Fjan opened this issue Sep 8, 2023 · 0 comments
Open

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

Fjan opened this issue Sep 8, 2023 · 0 comments

Comments

@Fjan
Copy link

Fjan commented Sep 8, 2023

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.

@denisdefreyne denisdefreyne transferred this issue from nanoc/nanoc Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant