diff options
author | murphy <murphy@rubychan.de> | 2005-10-01 02:14:46 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2005-10-01 02:14:46 +0000 |
commit | c194637b0d9af5ee756c5efa0942fe8cc09769e5 (patch) | |
tree | c9f6f310cacbf8b70b0bc45c2892a402529341db /demo | |
parent | 1712b65570da6495a87f267cb3f11ef05383cbe5 (diff) | |
download | coderay-c194637b0d9af5ee756c5efa0942fe8cc09769e5.tar.gz |
Some demos updated.
Massive changes for HTML output layout.
Diffstat (limited to 'demo')
-rw-r--r-- | demo/demo_css.rb | 6 | ||||
-rw-r--r-- | demo/demo_dump.rb | 19 | ||||
-rw-r--r-- | demo/demo_html.rb | 1 |
3 files changed, 15 insertions, 11 deletions
diff --git a/demo/demo_css.rb b/demo/demo_css.rb index e4cd455..93a6ef0 100644 --- a/demo/demo_css.rb +++ b/demo/demo_css.rb @@ -1,6 +1,4 @@ require 'coderay'
-data = File.read $0
-page = CodeRay.scan(data, :ruby).optimize.html(:css => :style, :debug => $DEBUG).page
-
-puts page
+# print the default stylesheet for HTML codes
+puts CodeRay::Encoders[:html]::CSS::DEFAULT_STYLESHEET
diff --git a/demo/demo_dump.rb b/demo/demo_dump.rb index b848dcd..cd68dc8 100644 --- a/demo/demo_dump.rb +++ b/demo/demo_dump.rb @@ -1,8 +1,15 @@ require 'coderay'
-puts CodeRay.
- scan("puts 'Hello, world!'", :ruby).
- compact.
- dump.
- undump.
- html(:wrap => :div)
+# scan some code
+tokens = CodeRay.scan(File.read($0), :ruby)
+
+# dump using YAML
+yaml = tokens.yaml
+puts 'YAML: %4d bytes' % yaml.size
+
+# dump using Marshal
+dump = tokens.dump(0)
+puts 'Dump: %4d bytes' % dump.size
+
+# undump and encode
+puts 'undumped:', dump.undump.div(:css => :class)
diff --git a/demo/demo_html.rb b/demo/demo_html.rb index d2d25a1..c854635 100644 --- a/demo/demo_html.rb +++ b/demo/demo_html.rb @@ -392,4 +392,3 @@ module CodeRay end end - |