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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f17fd498857389f4ffdf131281e1c075e1a9c7d8
|
4
|
+
data.tar.gz: 15293f3511e64fb33035cb18cf5e6c536db144c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd59f9d4cd2353e36771978ba0c4d12328b63771e77f3724c337deaed6aa5a28b0d49016165486aa53b90fd785a5d012100645f2b2a538e8ab5c7bc62c47382a
|
7
|
+
data.tar.gz: b3874f294fd267994114a8093ab2dffbccdc9e1ca90f88595d247276bec58f3eec0d4da60bc294ccc13335c9b322253a8fdf1cac408c31c200be65fea787c410
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require 'action_view'
|
2
3
|
|
3
4
|
module SemanticDateTimeTags
|
4
|
-
class FormatParser < Struct.new
|
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
|
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
|
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[
|
39
|
-
when /%-?[mBbh]/ then ['month', comp[
|
40
|
-
when /%-?[aAdej]/ then ['day', comp[
|
41
|
-
when /%-?[HKIl]/ then ['hours', comp[
|
42
|
-
when /%-?[M]/ then ['minutes', comp[
|
43
|
-
when /%-?[pP]/ then ['ampm', comp[
|
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
|
@@ -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.
|
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-
|
11
|
+
date: 2016-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|