views:

69

answers:

0

Possible Duplicate:
Formatting of dynamically generated HTML - does no one care?

I have very little experience in web development, so this may be a very basic question.

It's just, from the limited experience I do have (a little PHP, and a little Ruby on Rails), it seems that the way dynamically generated HTML is formatted just "doesn't matter"; it ends up ugly, with weird indentation, and nobody cares because that isn't what the users sees.

Unless, of course, the user is a developer, or even just someone who's curious to look at a little HTML to try and learn something.

Maybe you don't know what I'm talking about; so let me give an example.

In a Ruby file I might have some code like this:

<h1>Heading</h1>

<div>
    <%= render :partial => '/layouts/body' %>
</div>

Then, in my "/layouts/_body.html.erb" file, I might have this:

<p>Here is some content!</p>

<ul>
    <li>List item 1</li>
    <li>List item 2</li>
    <li>List item 3</li>
</ul>

When all this gets rendered, it'll look fine. But if the user tries to view the source, the HTML will look pretty crappy:

    <h1>Heading</h1>

    <div>
        <p>Here is some content!</p>

<ul>
    <li>List item 1</li>
    <li>List item 2</li>
    <li>List item 3</li>
</ul>

    </div>

Obviously, this is not a big deal. And I can totally understand if the prevailing opinion is simply "It doesn't matter." But is that just the way it has to be? Does the readability of HTML not matter to anyone?

I'm just curious to know if this ever bugged anyone else enough for him/her to come up with a "solution" for it (obviously it would have to be someone who viewed it as a "problem" in the first place).