diff options
author | no author <noone@nowhere> | 2005-09-26 02:58:54 +0000 |
---|---|---|
committer | no author <noone@nowhere> | 2005-09-26 02:58:54 +0000 |
commit | 84b8431608174e74a4c0d2394eb330a6621bc74b (patch) | |
tree | ffc2bd7ce21708a9147247c80b0e7fc7728ea063 /demo/demo_global_vars2.rb | |
download | coderay-84b8431608174e74a4c0d2394eb330a6621bc74b.tar.gz |
New Repository, initial import
Diffstat (limited to 'demo/demo_global_vars2.rb')
-rw-r--r-- | demo/demo_global_vars2.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/demo/demo_global_vars2.rb b/demo/demo_global_vars2.rb new file mode 100644 index 0000000..7646890 --- /dev/null +++ b/demo/demo_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
|