Skip to content

Commit 5c41245

Browse files
committed
rename :independent_lines option to :break_lines
1 parent df4e2bc commit 5c41245

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lib/coderay/encoders/html.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ module Encoders
4747
#
4848
# Default: 'CodeRay output'
4949
#
50-
# === :independent_lines
50+
# === :break_lines
51+
#
5152
# Split multiline blocks at line breaks.
5253
# Forced to true if :line_numbers option is set to :inline.
5354
#
@@ -106,7 +107,7 @@ class HTML < Encoder
106107
:wrap => nil,
107108
:title => 'CodeRay output',
108109

109-
:independent_lines => false,
110+
:break_lines => false,
110111

111112
:line_numbers => nil,
112113
:line_number_anchors => 'n',
@@ -176,9 +177,9 @@ def setup options
176177
@out = ''
177178
end
178179

179-
options[:independent_lines] = true if options[:line_numbers] == :inline
180+
options[:break_lines] = true if options[:line_numbers] == :inline
180181

181-
@independent_lines = (options[:independent_lines] == true)
182+
@break_lines = (options[:break_lines] == true)
182183

183184
@HTML_ESCAPE = HTML_ESCAPE.dup
184185
@HTML_ESCAPE["\t"] = ' ' * options[:tab_width]
@@ -260,7 +261,7 @@ def text_token text, kind
260261

261262
style = @span_for_kind[@last_opened ? [kind, *@opened] : kind]
262263

263-
if @independent_lines && (i = text.index("\n")) && (c = @opened.size + (style ? 1 : 0)) > 0
264+
if @break_lines && (i = text.index("\n")) && (c = @opened.size + (style ? 1 : 0)) > 0
264265
close = '</span>' * c
265266
reopen = ''
266267
@opened.each_with_index do |k, index|

test/unit/html.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class HtmlTest < Test::Unit::TestCase
55

6-
def test_independent_lines_option
6+
def test_break_lines_option
77
snippets = {}
88

99
snippets[:ruby] = {}
@@ -96,8 +96,8 @@ def test_independent_lines_option
9696
tokens = CodeRay.scan code[:in], lang
9797

9898
assert_equal code[:expected_with_option_off], tokens.html
99-
assert_equal code[:expected_with_option_off], tokens.html(:independent_lines => false)
100-
assert_equal code[:expected_with_option_on], tokens.html(:independent_lines => true)
99+
assert_equal code[:expected_with_option_off], tokens.html(:break_lines => false)
100+
assert_equal code[:expected_with_option_on], tokens.html(:break_lines => true)
101101
end
102102
end
103103
end

0 commit comments

Comments
 (0)