diff options
-rw-r--r-- | Changes.textile | 2 | ||||
-rw-r--r-- | lib/coderay/encoder.rb | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/Changes.textile b/Changes.textile index 4bdf402..293d12f 100644 --- a/Changes.textile +++ b/Changes.textile @@ -16,7 +16,7 @@ Changes related to the new tokens handling include: * *REWRITE* of all Scanners, Encoders, Filters, and Tokens. * *RENAMED* @:open@ and @:close@ actions to @:begin_group@ and @:end_group@. * *RENAMED* @open_token@ and @close_token@ methods to @begin_group@ and @end_group@. -* *NEW* method @:tokens@ allows to add several tokens to the stream. +* *NEW* method @#tokens@ allows to add several tokens to the stream. @Tokens@ and @Encoders::Encoder@ define this method. * *CHANGED* The above name changes also affect the JSON, XML, and YAML encoders. CodeRay 1.0 output will be incompatible with earlier versions. * *REMOVED* @TokenStream@ and the @Streamable@ API and all related features like @NotStreamableError@ are now obsolete and have been removed. diff --git a/lib/coderay/encoder.rb b/lib/coderay/encoder.rb index 6e32e75..7acfe79 100644 --- a/lib/coderay/encoder.rb +++ b/lib/coderay/encoder.rb @@ -167,8 +167,7 @@ module CodeRay content = nil for item in tokens if item.is_a? Array - warn 'two-element array tokens are deprecated' - content, item = *item + raise ArgumentError, 'Two-element array tokens are no longer supported.' end if content token content, item @@ -177,8 +176,11 @@ module CodeRay content = item end end - raise if content + raise 'odd number list for Tokens' if content end + + alias tokens compile + public :tokens end |