Sha256: e3297d40ddd8fe68fcd5d7c4febdb75c731ad666f32b8b9066e10e5ce612ff81
Contents?: true
Size: 638 Bytes
Versions: 26
Compression:
Stored size: 638 Bytes
Contents
/** * Module dependencies. */ require.paths.unshift(__dirname + '/koala/lib'); var koala = require('koala'), sys = require('sys'), stdin = process.openStdin(); var str = ''; stdin.addListener('data', function(chunk){ str += chunk; }); stdin.addListener('end', function(){ sys.print(str.replace(/<code>([^]+?)<\/code>/g, function(_, code){ return looksLikeJavaScript(code) ? '<code class="js">' + koala.render('.js', code) + '</code>' : '<code>' + code + '</code>'; })); }); function looksLikeJavaScript(code){ return code.indexOf('{') >= 0 && code.indexOf('(') >= 0; }
Version data entries
26 entries across 26 versions & 1 rubygems