summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2012-04-02 00:15:20 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2012-04-02 00:15:20 +0200
commit5c4124559127f8ce991e31e4ea8a40516fe0757a (patch)
treef1d513f7ddb722bebd218115534921d203592c6a
parentdf4e2bc7f7d8238f56e2d823aea707bfd860ad8f (diff)
downloadcoderay-5c4124559127f8ce991e31e4ea8a40516fe0757a.tar.gz
rename :independent_lines option to :break_lines
-rw-r--r--lib/coderay/encoders/html.rb11
-rw-r--r--test/unit/html.rb6
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb
index 2ec0f37..635a4d8 100644
--- a/lib/coderay/encoders/html.rb
+++ b/lib/coderay/encoders/html.rb
@@ -47,7 +47,8 @@ module Encoders
#
# Default: 'CodeRay output'
#
- # === :independent_lines
+ # === :break_lines
+ #
# Split multiline blocks at line breaks.
# Forced to true if :line_numbers option is set to :inline.
#
@@ -106,7 +107,7 @@ module Encoders
:wrap => nil,
:title => 'CodeRay output',
- :independent_lines => false,
+ :break_lines => false,
:line_numbers => nil,
:line_number_anchors => 'n',
@@ -176,9 +177,9 @@ module Encoders
@out = ''
end
- options[:independent_lines] = true if options[:line_numbers] == :inline
+ options[:break_lines] = true if options[:line_numbers] == :inline
- @independent_lines = (options[:independent_lines] == true)
+ @break_lines = (options[:break_lines] == true)
@HTML_ESCAPE = HTML_ESCAPE.dup
@HTML_ESCAPE["\t"] = ' ' * options[:tab_width]
@@ -260,7 +261,7 @@ module Encoders
style = @span_for_kind[@last_opened ? [kind, *@opened] : kind]
- if @independent_lines && (i = text.index("\n")) && (c = @opened.size + (style ? 1 : 0)) > 0
+ if @break_lines && (i = text.index("\n")) && (c = @opened.size + (style ? 1 : 0)) > 0
close = '</span>' * c
reopen = ''
@opened.each_with_index do |k, index|
diff --git a/test/unit/html.rb b/test/unit/html.rb
index cc4a0c6..0072635 100644
--- a/test/unit/html.rb
+++ b/test/unit/html.rb
@@ -3,7 +3,7 @@ require 'coderay'
class HtmlTest < Test::Unit::TestCase
- def test_independent_lines_option
+ def test_break_lines_option
snippets = {}
snippets[:ruby] = {}
@@ -96,8 +96,8 @@ public class Test {
tokens = CodeRay.scan code[:in], lang
assert_equal code[:expected_with_option_off], tokens.html
- assert_equal code[:expected_with_option_off], tokens.html(:independent_lines => false)
- assert_equal code[:expected_with_option_on], tokens.html(:independent_lines => true)
+ assert_equal code[:expected_with_option_off], tokens.html(:break_lines => false)
+ assert_equal code[:expected_with_option_on], tokens.html(:break_lines => true)
end
end
end