parsehtml 1.12.0 → 1.12.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/README.rdoc +27 -6
- data/lib/parsehtml.rb +2 -2
- data/website/index.html +3 -1
- data/website/index.txt +3 -0
- metadata +1 -1
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
=
|
1
|
+
= ParseHTML
|
2
2
|
|
3
3
|
http://parsehtml.rubyforge.org
|
4
4
|
|
@@ -6,10 +6,6 @@ http://parsehtml.rubyforge.org
|
|
6
6
|
|
7
7
|
ParseHTML is an HTML parser which works with Ruby 1.8 and above. ParseHTML will even try to handle invalid HTML to some degree.
|
8
8
|
|
9
|
-
== SYNOPSIS:
|
10
|
-
|
11
|
-
FIX (code sample of usage)
|
12
|
-
|
13
9
|
== REQUIREMENTS:
|
14
10
|
|
15
11
|
Ruby 1.8
|
@@ -18,9 +14,34 @@ Ruby 1.8
|
|
18
14
|
|
19
15
|
sudo gem install parsehtml
|
20
16
|
|
17
|
+
== USAGE:
|
18
|
+
|
19
|
+
require 'parsehtml'
|
20
|
+
|
21
|
+
html = %Q(
|
22
|
+
<h1>This is my HTML code</h1>
|
23
|
+
<p>Pass this <b>directly</b> into the parser</p>
|
24
|
+
)
|
25
|
+
|
26
|
+
parser = ParseHTML.new(html) # Create a new parser object
|
27
|
+
parser.next_node # traverse through the HTML nodes
|
28
|
+
parser.node # gives the current node (<h1>)
|
29
|
+
parser.node_type # gives the node type (tag)
|
30
|
+
parser.open_tags # lists any open tags ([])
|
31
|
+
parser.tag_name # gives the DOM tag name (h1)
|
32
|
+
parser.is_block_element # is this a block element? (true)
|
33
|
+
parser.is_empty_tag # is this an empty tag? (false)
|
34
|
+
parser.is_start_tag # is this a start tag? (true)
|
35
|
+
parser.tag_attributes # lists the current tags attributes ({})
|
36
|
+
|
37
|
+
|
38
|
+
== CONTRIBUTE:
|
39
|
+
|
40
|
+
git clone git://github.com/cpjolicoeur/parsehtml.git
|
41
|
+
|
21
42
|
== DEVELOPERS:
|
22
43
|
|
23
|
-
Craig P Jolicoeur - http://
|
44
|
+
Craig P Jolicoeur - http://craigjolicoeur.com
|
24
45
|
|
25
46
|
== ACKNOWLEDGEMENTS:
|
26
47
|
|
data/lib/parsehtml.rb
CHANGED
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
4
|
class ParseHTML
|
5
|
-
VERSION = '1.12.
|
5
|
+
VERSION = '1.12.1'
|
6
6
|
|
7
7
|
# tags which are always empty (<br />, etc.)
|
8
8
|
EMPTY_TAGS = %w(br hr input img area link meta param)
|
@@ -449,4 +449,4 @@ class ParseHTML
|
|
449
449
|
return html
|
450
450
|
end
|
451
451
|
|
452
|
-
end # end class ParseHTML
|
452
|
+
end # end class ParseHTML
|
data/website/index.html
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
<div class="sidebar">
|
35
35
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/parsehtml"; return false'>
|
36
36
|
<p>Get Version</p>
|
37
|
-
<a href="http://rubyforge.org/projects/parsehtml" class="numbers">1.12.
|
37
|
+
<a href="http://rubyforge.org/projects/parsehtml" class="numbers">1.12.1</a>
|
38
38
|
</div>
|
39
39
|
</div>
|
40
40
|
<h2>What</h2>
|
@@ -74,6 +74,8 @@
|
|
74
74
|
<pre>cd parsehtml
|
75
75
|
rake test
|
76
76
|
rake install_gem</pre>
|
77
|
+
<h2>Documentation</h2>
|
78
|
+
<p><a href="http://parsehtml.rubyforge.orb/rdoc">http://parsehtml.rubyforge.orb/rdoc</a></p>
|
77
79
|
<h2>License</h2>
|
78
80
|
<p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
|
79
81
|
<h2>Contact</h2>
|
data/website/index.txt
CHANGED