<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -68,6 +68,8 @@ class TextDocument &lt; Document
         else
           if new_src = helper.send(:template_url_for_asset, :src =&gt; src, :current_folder=&gt;current_folder, :parse_assets =&gt; true)
             &quot;url(#{quote}#{new_src}#{quote})&quot;
+          elsif !(src =~ /\.\./) &amp;&amp; File.exist?(File.join(SITES_ROOT, current_site.public_path, src))
+            &quot;url(#{quote}#{src}?#{File.mtime(File.join(SITES_ROOT, current_site.public_path, src)).to_i}#{quote})&quot;
           else
             errors.add('asset', '{{asset}} not found', :asset =&gt; src.inspect)
             &quot;url(#{quote}#{src}#{quote})&quot;
@@ -93,17 +95,20 @@ class TextDocument &lt; Document
           $&amp;
         else
           quote, url   = $1, $2
-          if url =~ /\A\/\w\w.*?(\d+)(_\w+|)\./
+          if url =~ /\A\/\w\w\/.*?(\d+)(_\w+|)\./
             zip, mode = $1, $2
-            unless asset = secure(Node) { Node.find_by_zip(zip) }
+            if asset = secure(Node) { Node.find_by_zip(zip) }
+              if asset.fullpath =~ /\A#{current_folder}\/(.+)/
+                &quot;url(#{quote}#{$1}#{mode}.#{asset.version.content.ext}#{quote})&quot;
+              else
+                &quot;url(#{quote}/#{asset.fullpath}#{mode}.#{asset.version.content.ext}#{quote})&quot;
+              end
+            else
               errors.add('asset', '{{zip}} not found', :zip =&gt; zip)
               &quot;url(#{quote}#{url}#{quote})&quot;
             end
-            if asset.fullpath =~ /\A#{current_folder}\/(.+)/
-              &quot;url(#{quote}#{$1}#{mode}.#{asset.version.content.ext}#{quote})&quot;
-            else
-              &quot;url(#{quote}/#{asset.fullpath}#{mode}.#{asset.version.content.ext}#{quote})&quot;
-            end
+          elsif File.exist?(File.join(SITES_ROOT, current_site.public_path, url.sub(/\?\d+\Z/,'')))
+            &quot;url(#{quote}#{url.sub(/\?\d+\Z/,'')}#{quote})&quot;
           else
             # bad format
             errors.add('base', &quot;cannot unparse asset url #{url.inspect}&quot;)</diff>
      <filename>app/models/text_document.rb</filename>
    </modified>
    <modified>
      <diff>@@ -54,7 +54,7 @@ class TextDocumentTest &lt; Zena::Unit::TestCase
     assert bird.update_attributes(:parent_id =&gt; node[:parent_id])
     Zena::Db.set_attribute(bird, :updated_at, b_at)
     start =&lt;&lt;-END_CSS
-    body { font-size:10px; }
+    body { font-size:10px; behavior:url(&quot;/stylesheets/csshover2.htc&quot;); }
     #header { background:url('bird.jpg') }
     #pv     { background:url('bird_pv.jpg') }
     #footer { background:url('/projects/wiki/flower.jpg') }
@@ -68,7 +68,7 @@ class TextDocumentTest &lt; Zena::Unit::TestCase
     text = node.parse_assets(start, helper, 'v_text')
     assert node.errors.empty?
     res =&lt;&lt;-END_CSS
-    body { font-size:10px; }
+    body { font-size:10px; behavior:url(&quot;/stylesheets/csshover2.htc?1256556568&quot;); }
     #header { background:url('/en/image30.jpg?1144713600') }
     #pv     { background:url('/en/image30_pv.jpg?967816914293') }
     #footer { background:url('/en/image31.jpg?1144713600') }
@@ -80,7 +80,7 @@ class TextDocumentTest &lt; Zena::Unit::TestCase
     assert_equal res, text
     text = node.unparse_assets(text, helper, 'v_text')
     unparsed =&lt;&lt;-END_CSS
-    body { font-size:10px; }
+    body { font-size:10px; behavior:url(&quot;/stylesheets/csshover2.htc&quot;); }
     #header { background:url('bird.jpg') }
     #pv     { background:url('bird_pv.jpg') }
     #footer { background:url('/projects/wiki/flower.jpg') }</diff>
      <filename>test/unit/text_document_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>45f2c64174c2bbb0f9d1d27c3c33192e47f23526</id>
    </parent>
  </parents>
  <author>
    <name>Gaspard Bucher</name>
    <email>gaspard@teti.ch</email>
  </author>
  <url>http://github.com/zena/zena/commit/ab96ca37cc3a5cfd4ab1fdb1ae1c39adba20db1e</url>
  <id>ab96ca37cc3a5cfd4ab1fdb1ae1c39adba20db1e</id>
  <committed-date>2009-11-09T05:34:34-08:00</committed-date>
  <authored-date>2009-11-09T05:34:34-08:00</authored-date>
  <message>CSS should parser static assets from the site's public directory and add proper timestamp.</message>
  <tree>d50061879672a9e851e7e1f69ca74912b081f823</tree>
  <committer>
    <name>Gaspard Bucher</name>
    <email>gaspard@teti.ch</email>
  </committer>
</commit>
