csl 1.0.0.pre22 → 1.0.0.pre23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/csl/style/choose.rb +14 -6
- data/lib/csl/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23b9a4f1447a95e1b46a96a403ff301b1ab93f32
|
4
|
+
data.tar.gz: 0355a94ad1f0be978d1a8e243c99aa6ad4d9ee5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41f1534aea931e42092073d7408b3105805f30a4e7656b53b63504e80b3eae1d4d5c0e08a704c7e3181b49a8482e0303a176a9561a4c097f196e7f14ce40e306
|
7
|
+
data.tar.gz: 0fd8a4e0eada2d438c213ff18495dfa6f8e153f2a079217f87e9d971c1fc31d4d30853999404396b7556800f92182e7f9e48b146404020390d0003f5086cbf3a
|
data/lib/csl/style/choose.rb
CHANGED
@@ -13,16 +13,14 @@ module CSL
|
|
13
13
|
nodename.to_s =~ /^if(-else)?|else$/
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def conditions
|
18
18
|
attributes_for(*Schema.attr(:conditionals)).map do |name, values|
|
19
19
|
extract_type_and_matcher_from(name) << values.to_s.split(/\s+/)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def matcher(match =
|
24
|
-
match ||= attributes[:match]
|
25
|
-
|
23
|
+
def matcher(match = attributes[:match])
|
26
24
|
case match
|
27
25
|
when 'any'
|
28
26
|
:any?
|
@@ -32,12 +30,22 @@ module CSL
|
|
32
30
|
:all?
|
33
31
|
end
|
34
32
|
end
|
35
|
-
|
33
|
+
|
36
34
|
private
|
37
35
|
|
38
36
|
def extract_type_and_matcher_from(attribute)
|
39
37
|
type, match = attribute.to_s.split(/-(any|all|none)$/, 2)
|
40
|
-
|
38
|
+
|
39
|
+
# subtle: if the default matcher is :none? and there
|
40
|
+
# is no override we to use :any? in the nested lists
|
41
|
+
# to avoid double negation during evaluation
|
42
|
+
|
43
|
+
if match.nil?
|
44
|
+
match = matcher
|
45
|
+
[type.to_sym, match == :none? ? :any? : matcher]
|
46
|
+
else
|
47
|
+
[type.to_sym, matcher(match)]
|
48
|
+
end
|
41
49
|
end
|
42
50
|
end
|
43
51
|
end
|
data/lib/csl/version.rb
CHANGED