summaryrefslogtreecommitdiff
path: root/rake_helpers/ca.rb
diff options
context:
space:
mode:
authorno author <noone@nowhere>2005-09-26 22:05:44 +0000
committerno author <noone@nowhere>2005-09-26 22:05:44 +0000
commit152f113f771ffb896e4d72b9a377a1e89f64c0f2 (patch)
tree4866bbb8c6d317b17653a54194d218956d0ba0fd /rake_helpers/ca.rb
parentdc3d3c61778daac9ff7e613f0f501e78ba751ac4 (diff)
downloadcoderay-152f113f771ffb896e4d72b9a377a1e89f64c0f2.tar.gz
New RDoc Template!
added trunk/rake_helpers folder moved trunk/coderay_rdoc_template.rb to it changed trunk/Rakefile added trunk/rake_helpers/ca.rb (CSS preprocessing)
Diffstat (limited to 'rake_helpers/ca.rb')
-rw-r--r--rake_helpers/ca.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/rake_helpers/ca.rb b/rake_helpers/ca.rb
new file mode 100644
index 0000000..8c18518
--- /dev/null
+++ b/rake_helpers/ca.rb
@@ -0,0 +1,40 @@
+#!c:/ruby/bin/rubyw
+# Hy-Ca 0.2 by murphy
+
+module Hy
+ def self.ca str
+ str.gsub! %r-^(\s*)(?://)(.*)?-, '\1/*\2*/'
+ str.gsub! %r-\s*/\*.*?\*/\n?-m, ''
+ str.gsub!(/<<(.*?)>>/m) do
+ begin
+ eval $1
+ ''
+ rescue Exception => boom
+ "<<\n#{boom}\n>>"
+ end
+ end
+
+ str.gsub!(/\$([\w_]+)/m) do
+ begin
+ eval $1
+ rescue
+ ''
+ end
+ end
+
+ str
+ end
+end
+
+begin
+ if file = ENV['PATH_TRANSLATED']
+ puts "Content-Type: text/css"
+ puts
+ ca = File.read file
+ else
+ ca = ARGF.read
+ end
+ print Hy.ca(ca)
+rescue => boom
+ p boom
+end