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

Remove empty lines from html file by using ERB trim_mode flag #775

Merged
merged 1 commit into from
Jul 21, 2020

Conversation

benoittgt
Copy link
Contributor

Close: #759

As mentioned in #759, I saw that rdoc is generating extra empty lines. This PR try to reduce the amount of empty lines to have a cleaner html structure.

The impact of this PR can be seen on rspec-core gem documentation : benoittgt/rdoc-rspec-core-no-empty-lines@6b57098

First line of partial templates do not need to have -%> at the end, because it breaks the indentation when they are used in parent template.

@benoittgt benoittgt force-pushed the remove-empty-lines branch from 48174b6 to 9e27299 Compare July 2, 2020 20:51
@benoittgt benoittgt changed the title Remove empty lines by properly mark lines with ERB proper trim_mode flag Remove empty lines from html file by using ERB trim_mode flag Jul 2, 2020
@kbrock
Copy link

kbrock commented Jul 7, 2020

fwiw/ in erb, I tend to not bother with the <%- if it is at the beginning of the line with no indentation. But I tend to always have -%> at the end of the line. Noticed you're not using skip at the end of the line. reason for this?

(btw/ <3 the PR )

@benoittgt
Copy link
Contributor Author

Hello @kbrock

Thanks for your kind words. You are completly correct for the <%- when it is the begining of the line. I will change that.
What do you mean by "skip"? :)

Is it related to a comment I make:

First line of partial templates do not need to have -%> at the end, because it breaks the indentation when they are used in parent template.

@aycabta
Copy link
Member

aycabta commented Jul 21, 2020

Great works! I created #760 for this problem after #759 is issued, and you did investigations and created this Pull Request. I'll release a new version of RDoc later.

@aycabta aycabta merged commit 196cb5e into ruby:master Jul 21, 2020
@benoittgt benoittgt deleted the remove-empty-lines branch July 21, 2020 19:39
@kbrock
Copy link

kbrock commented Jul 28, 2020

@benoittgt adding -%> ignores the trailing "\n"
So it is easier to not add too much white space

glad this got merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Reduce the number of useless new lines in html doc
3 participants