diff options
author | murphy <murphy@rubychan.de> | 2009-06-09 10:41:06 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2009-06-09 10:41:06 +0000 |
commit | 052399c510acf6bb5ae374b7270acbdf9b861b71 (patch) | |
tree | 2d9d6949596dd60cebd1be3925704cf7c4eeb809 | |
parent | 90d4db43872599ba53fa50836542eab5fb8ff42b (diff) | |
download | coderay-052399c510acf6bb5ae374b7270acbdf9b861b71.tar.gz |
New: Plugin.title (closes #96)
The title saves the real name for a language, like "C++"...something that can't be deduced from the class name.
And a version fix in the README.
-rw-r--r-- | lib/README | 2 | ||||
-rw-r--r-- | lib/coderay/helpers/plugin.rb | 8 | ||||
-rw-r--r-- | lib/coderay/scanners/debug.rb | 1 | ||||
-rw-r--r-- | lib/coderay/scanners/diff.rb | 1 | ||||
-rw-r--r-- | lib/coderay/scanners/nitro_xhtml.rb | 1 | ||||
-rw-r--r-- | lib/coderay/scanners/plaintext.rb | 1 | ||||
-rw-r--r-- | lib/coderay/scanners/rhtml.rb | 1 |
7 files changed, 14 insertions, 1 deletions
@@ -18,7 +18,7 @@ And with line numbers. * is what everybody should have on their website * solves all your problems and makes the girls run after you -Version: 0.8.1 +Version: 0.9.0 Author:: murphy (Kornelius Kalnbach) Contact:: murphy rubychan de Website:: coderay.rubychan.de[http://coderay.rubychan.de] diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb index 3aa79e4..922c528 100644 --- a/lib/coderay/helpers/plugin.rb +++ b/lib/coderay/helpers/plugin.rb @@ -281,6 +281,14 @@ module Plugin plugin_host.register self, *ids end + def title title = nil + if title + @title = title.to_s + else + @title ||= name[/([^:]+)$/, 1] + end + end + # The host for this Plugin class. def plugin_host host = nil if host and not host.is_a? PluginHost diff --git a/lib/coderay/scanners/debug.rb b/lib/coderay/scanners/debug.rb index ec594c1..f43564e 100644 --- a/lib/coderay/scanners/debug.rb +++ b/lib/coderay/scanners/debug.rb @@ -7,6 +7,7 @@ module Scanners include Streamable register_for :debug file_extension 'raydebug' + title 'CodeRay Token Dump' protected def scan_tokens tokens, options diff --git a/lib/coderay/scanners/diff.rb b/lib/coderay/scanners/diff.rb index d52458c..bfb400b 100644 --- a/lib/coderay/scanners/diff.rb +++ b/lib/coderay/scanners/diff.rb @@ -4,6 +4,7 @@ module Scanners class Diff < Scanner register_for :diff + title 'diff output' def scan_tokens tokens, options diff --git a/lib/coderay/scanners/nitro_xhtml.rb b/lib/coderay/scanners/nitro_xhtml.rb index 871ce17..7087ffa 100644 --- a/lib/coderay/scanners/nitro_xhtml.rb +++ b/lib/coderay/scanners/nitro_xhtml.rb @@ -10,6 +10,7 @@ module Scanners include Streamable register_for :nitro_xhtml file_extension :xhtml + title 'Nitro XHTML' NITRO_RUBY_BLOCK = / <\?r diff --git a/lib/coderay/scanners/plaintext.rb b/lib/coderay/scanners/plaintext.rb index 7a08c3a..a362f0b 100644 --- a/lib/coderay/scanners/plaintext.rb +++ b/lib/coderay/scanners/plaintext.rb @@ -4,6 +4,7 @@ module Scanners class Plaintext < Scanner register_for :plaintext, :plain + title 'Plain text' include Streamable diff --git a/lib/coderay/scanners/rhtml.rb b/lib/coderay/scanners/rhtml.rb index ca8196a..75790d8 100644 --- a/lib/coderay/scanners/rhtml.rb +++ b/lib/coderay/scanners/rhtml.rb @@ -9,6 +9,7 @@ module Scanners include Streamable register_for :rhtml + title 'HTML.ERB' ERB_RUBY_BLOCK = / <%(?!%)[=-]? |