<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -24,11 +24,27 @@ def all_files
   ].collect{ |f| f + '.js' }
 end
 
+def license
+  return &lt;&lt;-LICENSE
+/*
+ * sassijs 0.4.71 - Syntactically Awesome StyleSheets in JavaScript
+ *
+ * Copyright (c) 2009 Casey Rosenthal (github.net/clr)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * $Date: #{ Date.today } #{ Time.now } $
+ * $Rev: 1 more than last time $
+ */
+ 
+LICENSE
+end
+
 namespace :javascript do
 
   desc &quot;Concatenate the files together.&quot;
   task :join do
-    all_scripts = ''
+    all_scripts = license
     all_files.each do |file|
       all_scripts &lt;&lt; File.read( File.join( 'lib', file ) )
     end
@@ -43,3 +59,4 @@ namespace :javascript do
 end
 
 
+</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 // This file contains various helper methods.
 
 
-// Sugar functions follow, some of which were ispired by
+// Sugar functions follow, some of which were inspired by
 // [ http://www.crockford.com/javascript/inheritance.html ]
 Function.prototype.method = function( name, lambda ){
   this.prototype[name] = lambda;</diff>
      <filename>lib/pepper.js</filename>
    </modified>
    <modified>
      <diff>@@ -4,8 +4,10 @@ SassijsTree = function( template ){
   this.determineTab();
   var rootLine = new SassijsLine( '', this.getTab(), 0 );
   this.root = rootLine.determineNode();
+  this.variables = {};
   this.determineLines();
   this.determineNodes();
+  this.determineVariables();
 }
 
 SassijsTree.method( 'getTab', function(){
@@ -33,6 +35,16 @@ SassijsTree.method( 'getTemplateLines', function(){
   return this.getTemplate().split( '\n' );
 });
 
+SassijsTree.method( 'getVariable', function( hashName ){
+  return this.variables[ hashName ];
+});
+
+SassijsTree.method( 'setVariable', function( hashName, newValue ){
+  this.variables[ hashName ] = newValue;
+  return this;
+});
+
+
 // The tab is the form of indentation, which can be tabs or spaces,
 // but not both.
 SassijsTree.method( 'determineTab', function(){
@@ -102,6 +114,23 @@ SassijsTree.method( 'determineNodes', function(){
     }
   }
 });
+
+// Here we iterate through all of the nodes, and if we find a Node
+// of species Variable, we take the value and stick it in the 
+// tree's hash for reference later.
+SassijsTree.method( 'determineVariables', function( node ){
+  if( node == null ){
+    var node = this.getRoot();
+  }
+  if( node.getSpecies() == 'variable' ){
+    this.setVariable( node.getKey(), node.getValue() );
+  }
+  // We will just implement a traditional recursion here.
+  var childrenToThisNode = node.getChildren();
+  for( var i = 0; i &lt; childrenToThisNode.length; i++ ){
+    this.determineVariables( childrenToThisNode[ i ] );
+  }
+});
 /*
 
 SassijsTreeNodeRule.method( 'getCss', function(){</diff>
      <filename>lib/sassijs/tree.js</filename>
    </modified>
    <modified>
      <diff>@@ -109,6 +109,9 @@ SassijsTreeNode.method( 'getCss', function(){
 // in a short-hand.  When this node is a Rule, it needs to have its
 // children duplicated and appended to the split Rule in order to be 
 // uncompressed.
-SassijsTreeNode.method( 'expandChildren', function(){
-  
+SassijsTreeNode.method( 'recurse', function( anonymousFunction ){
+  anonymousFunction.call( this );
+  for( var i = 0; i &lt; this.getChildren().length; i++ ){
+    this.getChildren()[ i ].recurse( anonymousFunction );
+  }
 });</diff>
      <filename>lib/sassijs/tree/node.js</filename>
    </modified>
    <modified>
      <diff>@@ -6,11 +6,22 @@ SassijsTreeNodeRule = function( line ){
 
 SassijsTreeNodeRule.inherits( SassijsTreeNode );
 
+/*
+I don't think I'll need this function after all.
+
+''
+// This function has to look at it's children, and if it 
+// sees a compressed Rule node, it splits that node into
+// two, with identical children.
 SassijsTreeNodeRule.method( 'determineMitosis', function(){
   var css = '';
   var attributes = [];
   for( var i = 0; i &lt; this.getChildren().length; i++ ){
-    switch( this.getChildren()[ i ].getSpecies() ){
+    var child = this.getChildren()[ i ];
+    if( ( child.getSpecies() == &quot;&quot; ) &amp;&amp; child.getLine().getSyntax().indexOf( ',' ) ){
+      var uncompressedRules = child.getLine().getSyntax().split( ',' );
+    }
+    if( )switch( this.getChildren()[ i ].getSpecies() ){
       case 'rule':
         css += this.getLine().getSyntax() + ' ' + this.getChildren()[ i ].getCss();
       case 'attribute':
@@ -24,7 +35,6 @@ SassijsTreeNodeRule.method( 'determineMitosis', function(){
   }
 });
 
-/*
 SassijsTreeNodeRule.method( 'getCss', function(){
   var css = '';
   var attributes = [];</diff>
      <filename>lib/sassijs/tree/rule.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,13 @@
+/*
+ * sassijs 0.4.71 - Syntactically Awesome StyleSheets in JavaScript
+ *
+ * Copyright (c) 2009 Casey Rosenthal (github.net/clr)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * $Date: 2009-04-25 Sat Apr 25 15:11:12 -0400 2009 $
+ * $Rev: 1 more than last time $
+ */
 // This file contains various helper methods.
 
 
@@ -112,8 +122,12 @@ Sassijs.method( 'determineTree', function(){
   this.tree = new SassijsTree( this.getTemplate() );
 });
 
+Sassijs.method( 'getCss', function(){
+  return this.getTree().getRoot().getCss().join( '\n' );
+});
+
 Sassijs.method( 'getStyleElement', function(){
-  return '&lt;style type=&quot;text/css&quot;&gt;&lt;!--\n' + this.getTree().getRoot().getCss().join( '\n' ) + '\n--&gt;&lt;/style&gt;';
+  return '&lt;style type=&quot;text/css&quot;&gt;&lt;!--\n' + this.getCss() + '\n--&gt;&lt;/style&gt;';
 });
 
 Sassijs.method( 'writeToDocument', function(){
@@ -273,6 +287,12 @@ SassijsTreeNode.method( 'getChildren', function(){
   return this.children;
 });
 
+// It's an odd kind of tree, but we can only traverse out,
+// and these poor children will never know their parents.
+SassijsTreeNode.method( 'hasChildren', function(){
+  return( this.children.length &gt; 0 );
+});
+
 SassijsTreeNode.method( 'getLine', function(){
   return this.line;
 });
@@ -298,25 +318,10 @@ SassijsTreeNode.method( 'getLastChild', function() {
 SassijsTreeNode.method( 'getSpecies', function(){
   return this.species;
 });
-
-SassijsTreeNode.method( 'toS', function() {
-  var result = &quot;&quot;;
-  for( child in this.getChildren() ){
-    if( child.isType( AttrNode ) ){
-      throw( new SassijError( 'Attributes aren\'t allowed at the root of a document.', child.line ) );
-    } else {
-      //    result &lt;&lt; &quot;#{child.to_s(1)}&quot; + (@style == :compressed ? '' : &quot;\n&quot;)
-      // need to add a @style indicator at some point
-      result += child.toS( 1 );
-    }
-  }
-      // @style == :compressed ? result+&quot;\n&quot; : result[0...-1]
-  return result;
-});
   
-  // This method should be overridden by subclasses to return an error message
-  // if the given child node is invalid,
-  // and false or nil otherwise.
+// This method should be overridden by subclasses to return an error message
+// if the given child node is invalid,
+// and false or nil otherwise.
 SassijsTreeNode.method( 'isInvalidChild', function( child ){
   return false;
 });
@@ -350,7 +355,18 @@ SassijsTreeNode.method( 'getCss', function(){
     for( var i = 0; i &lt; ruleChildren.length; i++ ){
       prefixRule = this.getLine().getSyntax();
       if( prefixRule.length &gt; 0 ){
-        ruleChildren[ i ] = prefixRule + &quot; &quot; + ruleChildren[ i ];
+        // Sometimes CSS rules are compressed like 'a span, a div' and we
+        // need to expand those children here and prepend the parent to 
+        // both sub-rules, span and div in the above example.
+        if( ruleChildren[ i ].indexOf( ',' ) ){
+          ruleChildrenParts = ruleChildren[ i ].split( ', ' );
+          for( var j = 0; j &lt; ruleChildrenParts.length; j++ ){
+            ruleChildrenParts[ j ] = prefixRule + &quot; &quot; + ruleChildrenParts[ j ];
+          }
+          ruleChildren[ i ] = ruleChildrenParts.join( ', ' );
+        } else {
+          ruleChildren[ i ] = prefixRule + &quot; &quot; + ruleChildren[ i ];
+        }
       }
     }
     return ruleChildren;
@@ -360,6 +376,14 @@ SassijsTreeNode.method( 'getCss', function(){
   }
 });
 
+
+// There are several cases where the children of a node are compressed
+// in a short-hand.  When this node is a Rule, it needs to have its
+// children duplicated and appended to the split Rule in order to be 
+// uncompressed.
+SassijsTreeNode.method( 'expandChildren', function(){
+  
+});
 SassijsTreeNodeAttribute = function( line ){
   this.children = [];
   this.species = 'attribute';
@@ -415,7 +439,23 @@ SassijsTreeNodeAttribute.method( 'getValue', function(){
 });
 
 SassijsTreeNodeAttribute.method( 'getCss', function(){
-  return this.getKey() + &quot;: &quot; + this.getValue() + &quot;;&quot;;
+  // If an Attribute node has children, then those children have
+  // to be Attribute nodes as well, because that means that this
+  // node is a family definition of attributes, like font-size, 
+  // font-weight, font-style, etc.
+  if( this.hasChildren() ){
+    var attributeChildren = [];
+    for( var i = 0; i &lt; this.getChildren().length; i++ ){
+      var child = this.getChildren()[ i ];
+      if( child.getSpecies() != 'attribute' ){
+        // Raise error.
+      }
+      attributeChildren.push( this.getKey() + &quot;-&quot; + child.getKey() + &quot;: &quot; + child.getValue() + &quot;;&quot; );
+    }
+    return attributeChildren.join( ' ' );
+  } else {
+    return this.getKey() + &quot;: &quot; + this.getValue() + &quot;;&quot;;
+  }
 });
 
 SassijsTreeNodeComment = function( line ){
@@ -484,9 +524,8 @@ SassijsTreeNodeRule = function( line ){
 };
 
 SassijsTreeNodeRule.inherits( SassijsTreeNode );
-/*
 
-SassijsTreeNodeRule.method( 'getCss', function(){
+SassijsTreeNodeRule.method( 'determineMitosis', function(){
   var css = '';
   var attributes = [];
   for( var i = 0; i &lt; this.getChildren().length; i++ ){
@@ -504,6 +543,7 @@ SassijsTreeNodeRule.method( 'getCss', function(){
   }
 });
 
+/*
 SassijsTreeNodeRule.method( 'getCss', function(){
   var css = '';
   var attributes = [];</diff>
      <filename>sassijs.js</filename>
    </modified>
    <modified>
      <diff>@@ -74,6 +74,33 @@
     equals( tree.getCss().join( '\n' ), testResult() );
   });
 
+  test( &quot;should get and set variables associated with this tree&quot;, function(){
+    scriptSassijs = new SassijsFile( '../templates/script.sass', false );
+    tree = scriptSassijs.getTree();
+    tree.setVariable( 'first', 0 ).setVariable( 'second', 1 );
+    equals( tree.getVariable( 'first' ), 0 );
+    equals( tree.getVariable( 'second' ), 1 );
+  });
+  
+  test( &quot;should find variables and store them in the tree's variable hash&quot;, function(){
+    scriptSassijs = new SassijsFile( '../templates/script.sass', false );
+    tree = scriptSassijs.getTree();
+    equals( tree.getVariable( 'width' ), &quot;10em + 20&quot; );
+    equals( tree.getVariable( 'color' ), &quot;#00ff98&quot; );
+    equals( tree.getVariable( 'main_text' ), &quot;#ffa&quot; );
+    equals( tree.getVariable( 'num' ), &quot;10&quot; );
+    equals( tree.getVariable( 'dec' ), &quot;10.2&quot; );
+    equals( tree.getVariable( 'dec_0' ), &quot;99.0&quot; );
+    equals( tree.getVariable( 'neg' ), &quot;-10&quot; );
+    equals( tree.getVariable( 'esc' ), &quot;10\&quot;+12\&quot;&quot; );
+    equals( tree.getVariable( 'str' ), &quot;Hello!&quot; );
+    equals( tree.getVariable( 'qstr' ), &quot;Quo\&quot;ted\&quot;!&quot; );
+    equals( tree.getVariable( 'hstr' ), &quot;Hyph-en!&quot; );
+    equals( tree.getVariable( 'concat' ), &quot;#{5 + 4} hi there&quot; );
+    equals( tree.getVariable( 'percent' ), &quot;11%&quot; );
+    equals( tree.getVariable( 'complex' ), &quot;1px/1em&quot; );
+  });
+
     &lt;/script&gt;
     &lt;h1&gt;&lt;/h1&gt;
     &lt;h2 id=&quot;banner&quot;&gt;&lt;/h2&gt;</diff>
      <filename>test/sassijs/tree.qunit</filename>
    </modified>
    <modified>
      <diff>@@ -24,6 +24,7 @@
     equals( sassijsNode1.getCss(), '#column.left' );
   });
  
+ /* Don't think I need this anymore.
   test( &quot;SassijTreeNodeRule should split if written in compressed format&quot;, function(){
     sassijsLine0 = new SassijsLine( '  #container', '  ', 15 );
     sassijsNode0 = sassijsLine0.determineNode();
@@ -50,7 +51,6 @@
     equals( sassijsNode0.getChildren()[1].getChildren()[0].getLine().getSyntax(), &quot;color: grey&quot; );
   });
  
-/*
   test( &quot;SassijTreeNodeRule should render subchild rules&quot;, function(){
     sassijsLine1 = new SassijsLine( '    #column.left', '  ', 15 );
     sassijsNode1 = sassijsLine1.determineNode();</diff>
      <filename>test/sassijs/tree/rule.qunit</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c5fda5a00e6c8bb0aa83eaa4c954ca16c5fcf894</id>
    </parent>
  </parents>
  <author>
    <name>clr</name>
    <email>clr@port49.com</email>
  </author>
  <url>http://github.com/clr/sassijs/commit/95aef99f217a2812e3130b5f87616577fe3879d1</url>
  <id>95aef99f217a2812e3130b5f87616577fe3879d1</id>
  <committed-date>2009-05-04T20:09:15-07:00</committed-date>
  <authored-date>2009-05-04T20:09:15-07:00</authored-date>
  <message>-- variables are now stored in tree, ready for evaluation --</message>
  <tree>55d1d1717b0b7cac6e13f35f1068fc8a45b85a61</tree>
  <committer>
    <name>clr</name>
    <email>clr@port49.com</email>
  </committer>
</commit>
