File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -68,9 +68,9 @@ def merge_next(other)
6868 @offset_blocks_end = [ @offset_blocks_end , other . offset_blocks_end ] . max
6969 @content |= other . is_content?
7070 @labels . merge ( other . labels . clone )
71- init_densities
72-
7371 @tag_level = [ @tag_level , other . tag_level ] . min
72+
73+ init_densities
7474 end
7575
7676 def to_s
Original file line number Diff line number Diff line change @@ -133,6 +133,18 @@ module Boilerpipe
133133
134134 expect ( block . labels ) . to eq Set . new ( [ 'boom' , 'pow' ] )
135135 end
136+
137+ it 'sets the tag level to the minimum of the two blocks' do
138+ block = Document ::TextBlock . new ( 'one' )
139+ block . set_tag_level ( 2 )
140+
141+ another_block = Document ::TextBlock . new ( 'two' )
142+ another_block . set_tag_level ( 1 )
143+
144+ block . merge_next ( another_block )
145+
146+ expect ( block . tag_level ) . to eq 1
147+ end
136148 end
137149
138150 describe '#add_label' do
You can’t perform that action at this time.
0 commit comments