TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

2 pointsby BenSchaechterover 14 years ago
1. http://rottentomatoes.com<p>2. View source

3 comments

camtarnover 14 years ago
If you mean the crazy amount of whitespace, it may be caused by a templating system. For instance, in JSP JSTL:<p><pre><code> &#60;c:choose&#62; &#60;c:when test="${!empty article}"&#62; &#60;c:out value="${article}"/&#62; &#60;/c:when&#62; &#60;c:when test="${!empty comments}"&#62; &#60;c:out value="${article}"/&#62; &#60;/c:when&#62; &#60;/c:choose&#62; </code></pre> 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.<p>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:<p><pre><code> &#60;c:choose &#62;&#60;c:when test="..." &#62;&#60;c:out ... / &#62;&#60;/c:when &#62;&#60;/c:choose&#62; </code></pre> Some webservers like Tomcat also provide the ability to strip all excess outgoing whitespace, which preserves the readability of the source files.
byoung2over 14 years ago
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 <a href="http://www.dealspyer.com" rel="nofollow">http://www.dealspyer.com</a>
slaterover 14 years ago
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.