Skip to content

Commit 689300b

Browse files
committed
Merge branch 'hotfix/0.3.1'
2 parents 494a60a + 672630c commit 689300b

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

shard.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: crystagiri
2-
version: 0.3.0
2+
version: 0.3.1
33

44
authors:
55
- madeindjs <[email protected]>

spec/crystagiri_html_spec.cr

+5
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,9 @@ describe Crystagiri::HTML do
102102
Crystagiri::HTML.css_query_to_xpath(css_query).should eq xpath_query
103103
doc.at_css(css_query).should be_a Crystagiri::Tag
104104
end
105+
106+
it "should find a class with number" do
107+
doc = Crystagiri::HTML.from_file "spec/fixture/HTML.html"
108+
doc.at_css(".title69").should be_a Crystagiri::Tag
109+
end
105110
end

spec/fixture/HTML.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
3+
<head class="title69">
44
<title>Crystagiri</title>
55
</head>
66
<body>

src/crystagiri/html.cr

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ module Crystagiri
3131
def self.css_query_to_xpath(query : String) : String
3232
query = "//#{query}"
3333
# Convert '#id_name' as '[@id="id_name"]'
34-
query = query.gsub /\#[A-z]+-*_*[A-z]+/ { |m| "*[@id=\"%s\"]" % m.delete('#') }
34+
query = query.gsub /\#[A-z0-9]+-*_*[A-z0-9]+/ { |m| "*[@id=\"%s\"]" % m.delete('#') }
3535
# Convert '.classname' as '[@class="classname"]'
36-
query = query.gsub /\.[A-z]+-*_*[A-z]+/ { |m| "[@class=\"%s\"]" % m.delete('.') }
36+
query = query.gsub /\.[A-z0-9]+-*_*[A-z0-9]+/ { |m| "[@class=\"%s\"]" % m.delete('.') }
3737
# Convert ' > ' as '/'
3838
query = query.gsub /\s*>\s*/ { |m| "/" }
3939
# Convert ' ' as '//'

src/crystagiri/version.cr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Crystagiri
2-
VERSION = "0.3.0"
2+
VERSION = "0.3.1"
33
end

0 commit comments

Comments
 (0)