changeset 7:0d5b69cd01db

Added a CSS sheet and a basic two-column layout.
author Atul Varma <varmaa@toolness.com>
date Mon, 05 Jan 2009 17:49:59 -0800
parents dc88b0e46f2d
children f3f56cc75bfd
files thingy.css thingy.html thingy.js
diffstat 3 files changed, 42 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/thingy.css	Mon Jan 05 17:49:59 2009 -0800
@@ -0,0 +1,27 @@
+body {
+    font-family: palatino, georgia, verdana, arial, sans-serif;
+    font-size: 10pt;
+}
+
+#content {
+    width: 800px;
+}
+
+.documentation {
+    width: 400px;
+    float: left;
+    padding-right: 20px;
+}
+
+.code {
+    font-family: monaco, andale mono, lucidatypewriter, courier,
+                 courier new, monospace;
+    float: left;
+    white-space: pre;
+    font-size: 6pt;
+}
+
+.divider {
+    clear: both;
+    border-top: 1px dotted;
+}
\ No newline at end of file
--- a/thingy.html	Mon Jan 05 17:17:33 2009 -0800
+++ b/thingy.html	Mon Jan 05 17:49:59 2009 -0800
@@ -3,6 +3,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
   <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+  <link rel="stylesheet" type="text/css" media="all" href="thingy.css" />
   <title>Narcissus Thingy</title>
 </head>
 <body>
--- a/thingy.js	Mon Jan 05 17:17:33 2009 -0800
+++ b/thingy.js	Mon Jan 05 17:49:59 2009 -0800
@@ -10,6 +10,7 @@
   var lines = code.split('\n');
   var blocks = [];
   var blockText = "";
+  var codeText = "";
   var firstCommentLine;
   var lastCommentLine;
 
@@ -17,7 +18,8 @@
     if (blockText)
       blocks.push({text: blockText,
                    lineno: firstCommentLine,
-                   numLines: lastCommentLine - firstCommentLine + 1});
+                   numLines: lastCommentLine - firstCommentLine + 1,
+                   code: codeText});
   }
 
   jQuery.each(
@@ -25,8 +27,10 @@
     function(lineNum) {
       var line = this;
       var isComment = (App.trim(line).indexOf("//") == 0);
-      if (!isComment)
+      if (!isComment) {
+        codeText += line + "\n";
         return;
+      }
       var startIndex = line.indexOf("//");
       var text = line.slice(startIndex + 3);
       if (lineNum == lastCommentLine + 1) {
@@ -37,6 +41,7 @@
         firstCommentLine = lineNum;
         lastCommentLine = lineNum;
         blockText = text + "\n";
+        codeText = "";
       }
     });
   maybeAppendBlock();
@@ -52,7 +57,13 @@
   jQuery.each(
     blocks,
     function(i) {
-      creole.parse($("#content").get(0), this.text);
+      var docs = $('<div class="documentation">');
+      creole.parse(docs.get(0), this.text);
+      $("#content").append(docs);
+      var code = $('<div class="code">');
+      code.text(this.code);
+      $("#content").append(code);
+      $("#content").append('<div class="divider">');
     });
 };