diff daily-edition.js @ 32:c0e3b6984986

normalized html output a bit
author Atul Varma <varmaa@toolness.com>
date Sun, 03 Jan 2010 12:23:57 -0800
parents a4df72a6d8a1
children c5a49e9bade8
line wrap: on
line diff
--- a/daily-edition.js	Sun Jan 03 11:59:19 2010 -0800
+++ b/daily-edition.js	Sun Jan 03 12:23:57 2010 -0800
@@ -25,9 +25,15 @@
                   var html = [content.value
                               for each (content in article.content)
                               if (content.type == "text/html")];
-                  if (html.length > 0)
-                    div.find(".content").html(html[0]);
-                  else
+                  if (html.length > 0) {
+                    var content = div.find(".content");
+                    content.html(html[0]);
+                    if (content.get(0).firstChild.nodeType == 3)
+                      // The child isn't wrapped in a containing block
+                      // element, so do that to ensure it has some
+                      // padding from everything around it.
+                      content.html("<p>" + html[0] + "</p>");
+                  } else
                     console.warn("no html content for", article,
                                  "by", author);
                   div.find(".date").text(date);