Skip to content

Commit

Permalink
Update README synopsis to use a less volatile site
Browse files Browse the repository at this point in the history
Finishes #1120.
  • Loading branch information
flavorjones committed Jan 20, 2015
1 parent 2bdb444 commit bf276fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
17 changes: 9 additions & 8 deletions README.ja.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,25 @@ IRCのチャンネルはfreenodeの #nokogiri です。

require 'nokogiri'
require 'open-uri'

doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))


# Fetch and parse HTML document
doc = Nokogiri::HTML(open('http://www.nokogiri.org/tutorials/installing_nokogiri.html'))

####
# Search for nodes by css
doc.css('h3.r a.l').each do |link|
doc.css('nav ul.menu li a').each do |link|
puts link.content
end

####
# Search for nodes by xpath
doc.xpath('//h3/a[@class="l"]').each do |link|
doc.xpath('//h2 | //h3').each do |link|
puts link.content
end

####
# Or mix and match.
doc.search('h3.r a.l', '//h3/a[@class="l"]').each do |link|
doc.search('code.sh', '//h2').each do |link|
puts link.content
end

Expand Down
13 changes: 5 additions & 8 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,24 @@ The IRC channel is #nokogiri on freenode.
require 'nokogiri'
require 'open-uri'

# Get a Nokogiri::HTML::Document for the page we’re interested in...

doc = Nokogiri::HTML(open('http://www.google.com/search?q=sparklemotion'))

# Do funky things with it using Nokogiri::XML::Node methods...
# Fetch and parse HTML document
doc = Nokogiri::HTML(open('http://www.nokogiri.org/tutorials/installing_nokogiri.html'))

####
# Search for nodes by css
doc.css('h3.r a').each do |link|
doc.css('nav ul.menu li a').each do |link|
puts link.content
end

####
# Search for nodes by xpath
doc.xpath('//h3/a').each do |link|
doc.xpath('//h2 | //h3').each do |link|
puts link.content
end

####
# Or mix and match.
doc.search('h3.r a.l', '//h3/a').each do |link|
doc.search('code.sh', '//h2').each do |link|
puts link.content
end

Expand Down

0 comments on commit bf276fb

Please sign in to comment.