---
layout: default
layout: page
nometa: true
title: Syntax Highlighting Debug
---
 
<h3 class="filename">gist_syntax_test.rb</h3>
{% gist 996818 test.rb %}
 
<h3 class="filename">syntax_test.diff</h3>
{% highlight diff %}
@@ -590,7 +590,7 @@ class SpritesTest < Test::Unit::TestCase
   it "should generate a sprite from nested folders" do
     css = render <<-SCSS
-      @import "nested/*.png";
+      @import "nested/**/*.png";
       @include all-nested-sprites;
     SCSS
     assert_correct css, <<-CSS
 
{% endhighlight %}
 
<h3 class="filename">syntax_test.html</h3>
{% highlight html %}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>A Tiny Page</title>
<style type="text/css">
<!--
      p { font-size:15pt; color:#000 }
    -->
</style></head><!-- real comment -->
<body bgcolor="#FFFFFF" text="#000000" link="#0000CC">
<script language="javascript" type="text/javascript">
      function changeHeight(h) {
        var tds = document.getElementsByTagName("td");
        for(var i = 0; i < tds.length; i++) {
          tds[i].setAttribute("height", h + "px");
      }}
</script>
<h1>abc</h1>
<h2>def</h2>
<p>Testing page</p>
</body></html>
{% endhighlight %}
 
<h3 class="filename">syntax_test.js</h3>
{% highlight js %}
 
/**
sample javascript from xui
*/
 
var undefined,
    xui,
    window     = this,
    string     = new String('string'),
    document   = window.document,
    simpleExpr = /^#?([\w-]+)$/,
    idExpr     = /^#/,
    tagExpr    = /<([\w:]+)/,
    slice      = function (e) { return [].slice.call(e, 0); };
    try { var a = slice(document.documentElement.childNodes)[0].nodeType; }
    catch(e){ slice = function (e) { var ret=[]; for (var i=0; e[i]; i++)
        ret.push(e[i]); return ret; }; }
 
window.x$ = window.xui = xui = function(q, context) {
    return new xui.fn.find(q, context);
};
 
 
{% endhighlight %}
 
<h3 class="filename">syntax_test.rb</h3>
{% highlight ruby %}
 
include Enumerable
 
def initialize(rbconfig)
@rbconfig = rbconfig
@no_harm = false
end
 
def load_savefile
begin
    File.foreach(savefile()) do |line|
    k, v = *line.split(/=/, 2)
    self[k] = v.strip
    end
rescue Errno::ENOENT
    setup_rb_error $!.message + "\n#{File.basename($0)} config first"
end
end
 
if c['rubylibdir']
    # V > 1.6.3
    libruby         = "#{c['prefix']}/lib/ruby"
    siterubyverarch = c['sitearchdir']
end
parameterize = lambda {|path|
    path.sub(/\A#{Regexp.quote(c['prefix'])}/, '$prefix')
}