summaryrefslogtreecommitdiff
path: root/sample/global_vars2.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2006-10-17 10:10:35 +0000
committermurphy <murphy@rubychan.de>2006-10-17 10:10:35 +0000
commit5e0d6d97bf4676ab1c1ca9b06590dd774d263b0d (patch)
treedb433d0109b087ffaa3f25fece64ea62c7481e8e /sample/global_vars2.rb
parent975a2fd6ea64529d993bc1412899fad386ff02ea (diff)
downloadcoderay-5e0d6d97bf4676ab1c1ca9b06590dd774d263b0d.tar.gz
Renamed demo files (trim demo_ prefix).
Diffstat (limited to 'sample/global_vars2.rb')
-rw-r--r--sample/global_vars2.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/sample/global_vars2.rb b/sample/global_vars2.rb
new file mode 100644
index 0000000..7646890
--- /dev/null
+++ b/sample/global_vars2.rb
@@ -0,0 +1,28 @@
+require 'coderay'
+require 'erb'
+include ERB::Util
+
+code = <<'CODE'
+$ie.text_field(:name, "pAnfrage ohne $gV und mit #{$gv}").set artikel
+oder
+text = $bla.test(...)
+CODE
+puts <<HTML
+<html>
+<head>
+<style>span.glob-var { color: green; font-weight: bold; }</style>
+</head>
+<body>
+HTML
+
+CodeRay.scan_stream code, :ruby do |text, kind|
+ next if text.is_a? Symbol
+ text = h(text)
+ text = '<span class="glob-var">%s</span>' % text if kind == :global_variable
+ print text
+end
+
+puts <<HTML
+</body>
+</html>
+HTML