# Unwanted empty lines in the resulting HTML files

**URL:** <https://www.ruby-forum.com/t/unwanted-empty-lines-in-the-resulting-html-files/83585>\
**Category:** Rails\
**Created:** [January 27, 2007, 6:54am UTC](https://www.ruby-forum.com/t/unwanted-empty-lines-in-the-resulting-html-files/83585 "2007-01-27T06:54:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathias\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a9adbd/32.png) [@Mathias\_W](https://www.ruby-forum.com/u/Mathias_W)\
**Post date:** [January 27, 2007, 6:54am UTC](https://www.ruby-forum.com/t/unwanted-empty-lines-in-the-resulting-html-files/83585/1 "2007-01-27T06:54:54Z")

</div>

Hey all,

I got a weird issue where my Ruby tags looking like this:  
\<% (something) -%\>  
actually produces empty lines once I put them on my webhost. Locally  
while I develop I don’t get them at all. This is really annoying as  
the resulting HTML code looks really messed up.

I have frozen Rails, so it’s the exact same Rails code being run  
locally as well as in production. What might cause this problem? Known  
bug? Is there any other way to stop if statements and ends to create  
blank lines?

Thanks,  
Mathias.

---

<div class="post-metadata">

**Author:** ![Mathias\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a9adbd/32.png) [@Mathias\_W](https://www.ruby-forum.com/u/Mathias_W)\
**Post date:** [January 27, 2007, 7:26am UTC](https://www.ruby-forum.com/t/unwanted-empty-lines-in-the-resulting-html-files/83585/2 "2007-01-27T07:26:44Z")

</div>

Mathias W. wrote:

> Hey all,
> 
> I got a weird issue where my Ruby tags looking like this:  
> \<% (something) -%\>  
> actually produces empty lines once I put them on my webhost. Locally  
> while I develop I don’t get them at all. This is really annoying as  
> the resulting HTML code looks really messed up.
> 
> I have frozen Rails, so it’s the exact same Rails code being run  
> locally as well as in production. What might cause this problem? Known  
> bug? Is there any other way to stop if statements and ends to create  
> blank lines?
> 
> Thanks,  
> Mathias.

Try %\> instead of -%\>

Abon

---

<div class="post-metadata">

**Author:** ![Mathias\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a9adbd/32.png) [@Mathias\_W](https://www.ruby-forum.com/u/Mathias_W)\
**Post date:** [January 27, 2007, 8:16am UTC](https://www.ruby-forum.com/t/unwanted-empty-lines-in-the-resulting-html-files/83585/3 "2007-01-27T08:16:58Z")

</div>

On 1/27/07, Bontina C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Try %\> instead of -%\>
> 
> Abon

I thought the dash would force that line to not produce any blank  
lines. Isn’t that the feature? I guess I’ll try without it, can’t  
hurt. 🙂

Thanks,  
Mathias.

---

<div class="post-metadata">

**Author:** ![Mathias\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a9adbd/32.png) [@Mathias\_W](https://www.ruby-forum.com/u/Mathias_W)\
**Post date:** [January 27, 2007, 8:28am UTC](https://www.ruby-forum.com/t/unwanted-empty-lines-in-the-resulting-html-files/83585/4 "2007-01-27T08:28:59Z")

</div>

On 1/27/07, Bontina C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Try %\> instead of -%\>
> 
> Abon

Just tried this and it made no difference.

I’m developing the project under Windows (in RadRails) and it is  
deployed to a Linux server. Could it be some end-of-line delimiter  
that’s different between the OSes that’s causing this bug? I can’t be  
the only one suffering from this?

Mathias.

---

<div class="post-metadata">

**Author:** ![Mathias\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a9adbd/32.png) [@Mathias\_W](https://www.ruby-forum.com/u/Mathias_W)\
**Post date:** [January 28, 2007, 3:07am UTC](https://www.ruby-forum.com/t/unwanted-empty-lines-in-the-resulting-html-files/83585/5 "2007-01-28T03:07:10Z")

</div>

On 1/27/07, Russell N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Yeah. I used to have this problem. I think it’s definitely an issue with  
> Windows line-endings. I solved it by [ack] editing the files on the server  
> [with pico/nano]. Now I develop on Linux so there’s no issue. I don’t think.
> 
> RSL

I looked into this a bit more and it seems like one problem is that if  
you comment out the line, for example:  
\<% # if whatever? -%\>  
then it will still produce an empty line. But there were other places  
where the problems disappeared once I started editing the files on the  
server to try it out. So it might be a combination. Will keep it in  
mind though, will help me with the trouble shooting if it happens  
again.

Thanks,  
Mathias.

---

<div class="post-metadata">

**Author:** ![Mathias\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a9adbd/32.png) [@Mathias\_W](https://www.ruby-forum.com/u/Mathias_W)\
**Post date:** [January 27, 2007, 2:44pm UTC](https://www.ruby-forum.com/t/unwanted-empty-lines-in-the-resulting-html-files/83585/6 "2007-01-27T14:44:41Z")

</div>

Yeah. I used to have this problem. I think it’s definitely an issue with  
Windows line-endings. I solved it by [ack] editing the files on the  
server  
[with pico/nano]. Now I develop on Linux so there’s no issue. I don’t  
think.

RSL
