wikidata_position_history 1.4.3 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/lib/query_service.rb +16 -6
- data/lib/wikidata_position_history/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cc474575654a299ceef536c692402288d072d7caf3d9bd62de17d9027bcd287
|
4
|
+
data.tar.gz: 2e6324cc0e272b5b747d65eab1aaa32f1c621a6e672487312f616afd9449d374
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 709a0916f16fd2a890df7ae3e2873968a23f0640945cf756785eb59bf8d7589b578fb2bd51e6263b36de729e20ea2a200cfcd9731ee6957a2e539169cacb0cbf
|
7
|
+
data.tar.gz: 3dbe5d81f0fe77f6487ce0109b91205d3b4361e13c70b48f93464ea4a323d06f3c07b70ea263e4817592cedf1b632e10b10be832dd03a92114f59505b53dae5a
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
# [1.
|
3
|
+
# [1.5.0] 2020-09-06
|
4
|
+
|
5
|
+
## Enhancements
|
6
|
+
|
7
|
+
* When showing the results for a position from long long ago (such as
|
8
|
+
the High Kings of Ireland), display the dates as "862 – 879" not as
|
9
|
+
"862 – 879"
|
10
|
+
* If we only know that someone took (or left) office sometime in a given
|
11
|
+
decade (i.e. at date precision 8), display that as (say) "1930s"
|
4
12
|
|
5
13
|
## Fixes
|
6
14
|
|
data/lib/query_service.rb
CHANGED
@@ -54,6 +54,8 @@ module QueryService
|
|
54
54
|
class WikidataDate
|
55
55
|
include Comparable
|
56
56
|
|
57
|
+
DATELEN = { '11' => 10, '10' => 7, '9' => 4, '8' => 4 }.freeze
|
58
|
+
|
57
59
|
def initialize(str, precision)
|
58
60
|
@str = str
|
59
61
|
@raw_precision = precision.to_s
|
@@ -66,12 +68,7 @@ module QueryService
|
|
66
68
|
end
|
67
69
|
|
68
70
|
def to_s
|
69
|
-
|
70
|
-
return str[0..6] if precision == '10'
|
71
|
-
return str[0..3] if precision == '9'
|
72
|
-
|
73
|
-
warn "Cannot handle precision #{precision} for #{str}"
|
74
|
-
str
|
71
|
+
precisioned_string.delete_prefix('0')
|
75
72
|
end
|
76
73
|
|
77
74
|
def empty?
|
@@ -99,5 +96,18 @@ module QueryService
|
|
99
96
|
def parts
|
100
97
|
to_s.split('-')
|
101
98
|
end
|
99
|
+
|
100
|
+
def truncated_string
|
101
|
+
return str[0...DATELEN[precision]] if DATELEN.key?(precision)
|
102
|
+
|
103
|
+
warn "Cannot handle precision #{precision} for #{str}"
|
104
|
+
str
|
105
|
+
end
|
106
|
+
|
107
|
+
def precisioned_string
|
108
|
+
return "#{truncated_string}s" if precision == '8'
|
109
|
+
|
110
|
+
truncated_string
|
111
|
+
end
|
102
112
|
end
|
103
113
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wikidata_position_history
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Bowden
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-09-
|
12
|
+
date: 2020-09-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mediawiki-replaceable-content
|