diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/coderay.rb | 2 | ||||
-rw-r--r-- | lib/coderay/duo.rb | 1 | ||||
-rw-r--r-- | lib/coderay/encoders/page.rb | 21 | ||||
-rw-r--r-- | lib/coderay/helpers/plugin.rb | 2 |
4 files changed, 24 insertions, 2 deletions
diff --git a/lib/coderay.rb b/lib/coderay.rb index a39d1cc..d503f03 100644 --- a/lib/coderay.rb +++ b/lib/coderay.rb @@ -133,7 +133,7 @@ module CodeRay # Minor: odd for beta, even for stable # Teeny: development state # Revision: Subversion Revision number (generated on rake) - Version = '0.7' + Version = '0.7.1' require 'coderay/tokens' require 'coderay/scanner' diff --git a/lib/coderay/duo.rb b/lib/coderay/duo.rb index 1957c95..e4e80df 100644 --- a/lib/coderay/duo.rb +++ b/lib/coderay/duo.rb @@ -22,6 +22,7 @@ module CodeRay @scanner.string = code
@encoder.encode_tokens(scanner.tokenize)
end
+ alias highlight encode
end
diff --git a/lib/coderay/encoders/page.rb b/lib/coderay/encoders/page.rb new file mode 100644 index 0000000..74bdc55 --- /dev/null +++ b/lib/coderay/encoders/page.rb @@ -0,0 +1,21 @@ +module CodeRay
+module Encoders
+
+ load :html
+
+ class Page < HTML
+
+ FILE_EXTENSION = 'html'
+
+ register_for :page
+
+ DEFAULT_OPTIONS = HTML::DEFAULT_OPTIONS.merge({
+ :css => :class,
+ :wrap => :page,
+ :line_numbers => :table
+ })
+
+ end
+
+end
+end
diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb index 2b47d8e..938d1a8 100644 --- a/lib/coderay/helpers/plugin.rb +++ b/lib/coderay/helpers/plugin.rb @@ -235,7 +235,7 @@ protected # Raises +ArgumentError+ for all other objects, or if the
# given String includes non-alphanumeric characters (\W).
def validate_id id
- if id.is_a? Symbol
+ if id.is_a? Symbol or id.nil?
id
elsif id.is_a? String
if id[/\w+/] == id
|