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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35a434aeccb7428a5d7ebc4ff9b534e6477980d153e744760459c3125c4e90ae
4
- data.tar.gz: bf8f4773d018ae8800104989e2052689ea19217a2a2cafbc09c8d4e4839ce7d0
3
+ metadata.gz: 3cc474575654a299ceef536c692402288d072d7caf3d9bd62de17d9027bcd287
4
+ data.tar.gz: 2e6324cc0e272b5b747d65eab1aaa32f1c621a6e672487312f616afd9449d374
5
5
  SHA512:
6
- metadata.gz: 9900bcc56726b22bf6a2e590400298fdd50dec62c992c1613fd33d2250d4a909ceed1dfc409ec94d5c4ff992a4ffbfcd15893fd9522f3061e967ca2370b03fad
7
- data.tar.gz: c1d5ad9bdf3378afbebb3b97ffdd0bebca18e88be03605e0ba5d6a379efee73e5293b6881ebe854873fe879b1409320d721f20162d15a654350ccea4587e506c
6
+ metadata.gz: 709a0916f16fd2a890df7ae3e2873968a23f0640945cf756785eb59bf8d7589b578fb2bd51e6263b36de729e20ea2a200cfcd9731ee6957a2e539169cacb0cbf
7
+ data.tar.gz: 3dbe5d81f0fe77f6487ce0109b91205d3b4361e13c70b48f93464ea4a323d06f3c07b70ea263e4817592cedf1b632e10b10be832dd03a92114f59505b53dae5a
@@ -1,6 +1,14 @@
1
1
  # Changelog
2
2
 
3
- # [1.4.3] 2020-09-05
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
 
@@ -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
- return str if precision == '11'
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WikidataPositionHistory
4
- VERSION = '1.4.3'
4
+ VERSION = '1.5.0'
5
5
  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.3
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-05 00:00:00.000000000 Z
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