changeset 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
files daily-edition.css daily-edition.js
diffstat 2 files changed, 22 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/daily-edition.css	Sun Jan 03 11:59:19 2010 -0800
+++ b/daily-edition.css	Sun Jan 03 12:23:57 2010 -0800
@@ -26,6 +26,10 @@
     float: right;
 }
 
+#header #info #issue-no, #header #info #pub-date {
+    color: gray;
+}
+
 .article {
     padding-top: 1em;
     padding-bottom: 1em;
@@ -43,14 +47,21 @@
     color: gray;
 }
 
+/* Get rid of annoying <br/>'s at the beginning of articles. */
+.article .content br {
+    display: none;
+}
+
 .article .content a {
     color: black;
 }
 
+a:hover {
+    background: yellow;
+}
+
 .article .content img {
     display: none;
-    border: none;
-    padding: 0.5em;
 }
 
 .article .title {
--- 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);