

Ask HN: What is with Rotten Tomatoes' HTML Source? - BenSchaechter

1. http://rottentomatoes.com<p>2. View source
======
camtarn
If you mean the crazy amount of whitespace, it may be caused by a templating
system. For instance, in JSP JSTL:

    
    
      <c:choose>
      <c:when test="${!empty article}">
      <c:out value="${article}"/>
      </c:when>
      <c:when test="${!empty comments}">
      <c:out value="${article}"/>
      </c:when>
      </c:choose>
    

Each of the choose/when tags has a newline after it, so even though the tag is
not output into the resulting HTML source, it causes a literal newline to be
emitted. This doesn't normally matter, since HTML collapses multiple runs of
whitespace into a single space.

However, for places where you can't have any whitespace (like the middle of a
word) you can work around that by concatenating all the tags into one long
line, or by strange arrangements of opening/closing angle brackets:

    
    
      <c:choose
      ><c:when test="..."
      ><c:out ... /
      ></c:when
      ></c:choose>
    

Some webservers like Tomcat also provide the ability to strip all excess
outgoing whitespace, which preserves the readability of the source files.

------
byoung2
I use smarty, and making the template logic readable sometimes leaves extra
newlines and whitespace. You can wrap {strip}{/strip} tags around it to remove
it though. This is what I use to get all code in a single line as on
<http://www.dealspyer.com>

------
slater
Only time I've seen that happen was with ColdFusion or Java-powered sites that
don't strip the lines used by inline logic, eg where you see 10 empty lines,
there might be an if/else snippet running. At runtime, the language runs
through those parts, but keeps the space intact.

