summaryrefslogtreecommitdiff
path: root/rake_helpers/ca.rb
diff options
context:
space:
mode:
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