Skip to content

Commit

Permalink
Join multiple email addressess with semi-colons
Browse files Browse the repository at this point in the history
Some members have multiple email addresses. Previously MemberPage was
capturing them joined as one contiguous string. With this commit,
multiple email addresses are now delimited with semi-colons.
  • Loading branch information
Oliver Denman authored and tmtmtmtm committed Jul 14, 2017
1 parent e66515f commit 6b307bf
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/member_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class MemberPage < Scraped::HTML
end

field :email do
bio.xpath('//table/tr/td/a[contains(@href, "mailto")]/text()').to_s.tidy
bio.xpath('//table/tr/td/a[contains(@href, "mailto")]').map(&:text).map(&:tidy).join(';')
end

field :website do
Expand Down
125 changes: 125 additions & 0 deletions test/cassettes/lct_htm.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions test/data/lct.htm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
:class: MemberPage
:url: http://www.legco.gov.hk/general/english/members/yr16-20/lct.htm
:to_h:
:id: yr16-20/lct
:term: yr16-20
:name: LAM Cheuk-ting
:honorific_prefix: Hon
:honorific_suffix: ''
:gender:
:faction: Democratic Party
:email: [email protected];[email protected];[email protected]
:website: ''
:phone: 3611 0266 / 2650 0040
:fax: 3705 9822 / 2650 0955
:img: http://www.legco.gov.hk/images/mem_1620/lct.jpg
:area: New Territories East
:area_type: geographical
:source: http://www.legco.gov.hk/general/english/members/yr16-20/lct.htm

0 comments on commit 6b307bf

Please sign in to comment.