semantic_date_time_tags 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04be8990eb888f1e0ef6297fcc2c6a391a8c21f1
4
- data.tar.gz: 6ae0c1811a285fb4eba9d280455312f14bb9ed49
3
+ metadata.gz: f17fd498857389f4ffdf131281e1c075e1a9c7d8
4
+ data.tar.gz: 15293f3511e64fb33035cb18cf5e6c536db144c1
5
5
  SHA512:
6
- metadata.gz: 133dfcd6fa54dce7340b6fd7a6aa07836efc4f859bef2d1ebaecdfba394ab64f5cd37228d2dbc5a56ce3364f8bbdd68e2414fddcebeb603c18d601874d1870bb
7
- data.tar.gz: cf77b7873987a0f82805f2c83b7a876f80e569a2b367f22ff8979f127fa05c9e674fbc2a1b8258ddc2faf9e5123908af202b37803bf4f34ae3897d19756105b3
6
+ metadata.gz: cd59f9d4cd2353e36771978ba0c4d12328b63771e77f3724c337deaed6aa5a28b0d49016165486aa53b90fd785a5d012100645f2b2a538e8ab5c7bc62c47382a
7
+ data.tar.gz: b3874f294fd267994114a8093ab2dffbccdc9e1ca90f88595d247276bec58f3eec0d4da60bc294ccc13335c9b322253a8fdf1cac408c31c200be65fea787c410
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- semantic_date_time_tags (0.1.10)
4
+ semantic_date_time_tags (0.1.11)
5
5
  rails (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,8 @@
1
+ # encoding: utf-8
1
2
  require 'action_view'
2
3
 
3
4
  module SemanticDateTimeTags
4
- class FormatParser < Struct.new :format, :str
5
+ class FormatParser < Struct.new(:format, :str)
5
6
  include ActionView::Helpers::TagHelper
6
7
 
7
8
  def to_html
@@ -19,7 +20,7 @@ module SemanticDateTimeTags
19
20
  private # =============================================================
20
21
 
21
22
  def formatting_components
22
- format.scan /(%-?\w|.+?(?=%))/
23
+ format.scan(/(%-?[[:word:]]|.+?(?=%))/)
23
24
  end
24
25
 
25
26
  def get_tag_for_match(match, comp)
@@ -27,20 +28,20 @@ module SemanticDateTimeTags
27
28
  end
28
29
 
29
30
  def get_regexp_for_component(comp)
30
- case
31
- when comp =~ /%-?\w/ then '(\\w+)'
31
+ case comp
32
+ when /%-?[[:word:]]/ then '([[:word:]]+)'
32
33
  else "(#{comp})"
33
34
  end
34
35
  end
35
36
 
36
37
  def get_classes_for_component(comp)
37
38
  case comp
38
- when /%-?[YCy]/ then ['year', comp[/\w/]]
39
- when /%-?[mBbh]/ then ['month', comp[/\w/]]
40
- when /%-?[aAdej]/ then ['day', comp[/\w/]]
41
- when /%-?[HKIl]/ then ['hours', comp[/\w/]]
42
- when /%-?[M]/ then ['minutes', comp[/\w/]]
43
- when /%-?[pP]/ then ['ampm', comp[/\w/]]
39
+ when /%-?[YCy]/ then ['year', comp[/[[:word:]]/]]
40
+ when /%-?[mBbh]/ then ['month', comp[/[[:word:]]/]]
41
+ when /%-?[aAdej]/ then ['day', comp[/[[:word:]]/]]
42
+ when /%-?[HKIl]/ then ['hours', comp[/[[:word:]]/]]
43
+ when /%-?[M]/ then ['minutes', comp[/[[:word:]]/]]
44
+ when /%-?[pP]/ then ['ampm', comp[/[[:word:]]/]]
44
45
  when /\W+/ then ['sep']
45
46
  end
46
47
  end
@@ -1,3 +1,3 @@
1
1
  module SemanticDateTimeTags
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
@@ -61,5 +61,14 @@ describe SemanticDateTimeTags::FormatParser do
61
61
  to_html.must_include '<span class="ampm P">'
62
62
  end
63
63
  end
64
+
65
+ describe ':cs' do
66
+ let(:format) { '%A, %-d. %B, %Y' }
67
+ let(:string) { "Čtvrtek, 16. Červen, 2016" }
68
+
69
+ it 'deals fine with accented characters' do
70
+ to_html.must_equal "<span class=\"day A\">Čtvrtek</span><span class=\"sep\">, </span><span class=\"day d\">16</span><span class=\"sep\">. </span><span class=\"month B\">Červen</span><span class=\"sep\">, </span><span class=\"year Y\">2016</span>"
71
+ end
72
+ end
64
73
  end
65
74
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic_date_time_tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-21 00:00:00.000000000 Z
11
+ date: 2016-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails