Skip to content

Commit 6912998

Browse files
committed
remove extra space from tokens
1 parent 904c582 commit 6912998

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/boilerpipe/sax/tag_actions/anchor_text.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ def changes_tag_level?
2929
def append_anchor_text_start(handler)
3030
handler.append_space
3131
handler.append_token(Boilerpipe::SAX::HTMLContentHandler::ANCHOR_TEXT_START)
32-
handler.append_token(' ')
3332
end
3433

3534
def append_anchor_text_end(handler)
3635
handler.append_space
3736
handler.append_token(Boilerpipe::SAX::HTMLContentHandler::ANCHOR_TEXT_END)
38-
handler.append_token(' ')
3937
end
4038

4139
def nested_achor_tag_error_recovering(handler, name)

spec/sax/tag_actions/anchor_text_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Boilerpipe::SAX::TagActions
1010

1111
it 'adds anchor text start' do
1212
handler = Boilerpipe::SAX::HTMLContentHandler.new
13-
expect { subject.start(handler, nil, nil) }.to change { handler.token_buffer_size }.from(0).to(5)
13+
expect { subject.start(handler, nil, nil) }.to change { handler.token_buffer_size }.from(0).to(4)
1414
end
1515

1616
it 'returns false' do
@@ -24,15 +24,16 @@ module Boilerpipe::SAX::TagActions
2424
subject.start(handler, nil, nil)
2525
expect(handler.in_anchor_tag).to eq(1)
2626
end
27+
2728
it 'doesnt append end anchor text' do
2829
handler = Boilerpipe::SAX::HTMLContentHandler.new
2930
expect { subject.start(handler, nil, nil) }.to change { handler.in_anchor_tag }.from(0).to(1)
3031
# puts handler.token_buffer
31-
expect(handler.token_buffer_size).to eq(5)
32+
expect(handler.token_buffer_size).to eq(4)
3233

3334
subject.start(handler, nil, nil)
3435
# puts handler.token_buffer
35-
expect(handler.token_buffer_size).to eq(5)
36+
expect(handler.token_buffer_size).to eq(4)
3637
end
3738
end
3839
end
@@ -47,7 +48,8 @@ module Boilerpipe::SAX::TagActions
4748
it 'adds end anchor text' do
4849
handler = Boilerpipe::SAX::HTMLContentHandler.new
4950
handler.in_anchor_tag = 1
50-
expect { subject.end_tag(handler, nil) }.to change { handler.token_buffer_size }.from(0).to(5)
51+
expect { subject.end_tag(handler, nil) }.to change { handler.token_buffer_size }.from(0).to(4)
52+
puts Boilerpipe::SAX::HTMLContentHandler::ANCHOR_TEXT_END.size
5153
end
5254

5355
context 'if in nested anchor tag' do

0 commit comments

Comments
 (0)