wikidata_position_history 1.4.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +14 -0
- data/CHANGELOG.md +53 -0
- data/Rakefile +1 -1
- data/lib/query_service.rb +16 -6
- data/lib/sparql/{bio_data.rb → bio_query.rb} +2 -2
- data/lib/sparql/item_query.rb +5 -1
- data/lib/sparql/{mandates.rb → mandates_query.rb} +6 -2
- data/lib/sparql/{position_data.rb → position_query.rb} +22 -6
- data/lib/wikidata_position_history.rb +17 -17
- data/lib/wikidata_position_history/checks.rb +3 -3
- data/lib/wikidata_position_history/report.rb +77 -17
- data/lib/wikidata_position_history/template.rb +26 -4
- data/lib/wikidata_position_history/version.rb +1 -1
- data/wikidata_position_history.gemspec +6 -4
- metadata +39 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc98f35825bd450d052eaf0bbb84934db297933bce312b88fd8b545474b742bf
|
4
|
+
data.tar.gz: 663abb5df3df62744eebbdeaea9ce2e63bf90aeff5335bf2406ae66306dd7608
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d06f8f44b1b84107e9bed22f158479f2be66569511ee1f9dea33ceaa788a9cff118b15e3e0960723cc943a290f832c6442f5c8c8659fb275002449e57c90d285
|
7
|
+
data.tar.gz: edae0f0fc3223778d655546c873792f81da0f514c50be44e27a192717df11c2672eedc251e2cf210ab4e623cdd0c5a232b6e65671c7cc9b2a356a1498ed3426f
|
data/.rubocop.yml
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rspec
|
4
|
+
|
1
5
|
AllCops:
|
2
6
|
Exclude:
|
3
7
|
- 'Vagrantfile'
|
@@ -29,6 +33,13 @@ Lint/AssignmentInCondition:
|
|
29
33
|
Naming/ClassAndModuleCamelCase:
|
30
34
|
Enabled: false
|
31
35
|
|
36
|
+
RSpec/DescribedClass:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
# TODO: remove this?
|
40
|
+
RSpec/MultipleExpectations:
|
41
|
+
Max: 2
|
42
|
+
|
32
43
|
Style/CollectionMethods:
|
33
44
|
Enabled: true
|
34
45
|
|
@@ -52,3 +63,6 @@ Style/TrailingCommaInHashLiteral:
|
|
52
63
|
|
53
64
|
Style/TrailingCommaInArrayLiteral:
|
54
65
|
EnforcedStyleForMultiline: no_comma
|
66
|
+
|
67
|
+
Layout/ClassStructure:
|
68
|
+
Enabled: true
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,58 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
# [1.7.0] 2020-09-08
|
4
|
+
|
5
|
+
# Enchancements
|
6
|
+
|
7
|
+
* Yesterday’s future, when we said we'd do something a little better
|
8
|
+
with positions that have multiple inception or abolition dates, has
|
9
|
+
arrived. Now we display all of them (with a warning), rather than just
|
10
|
+
picking one semi-randomly.
|
11
|
+
|
12
|
+
# Improvements
|
13
|
+
|
14
|
+
* A query like https://w.wiki/bVz is taking about 6 seconds to run.
|
15
|
+
Changing that to https://w.wiki/bW3 drops that to about half a second.
|
16
|
+
If you were to guess that the first has now been replaced by the
|
17
|
+
second, you'd be entirely correct.
|
18
|
+
|
19
|
+
# [1.6.0] 2020-09-07
|
20
|
+
|
21
|
+
## Enhancements
|
22
|
+
|
23
|
+
* If a position has an inception date and/or abolition date, those will
|
24
|
+
now also be displayed. (If a position has more than one of either of
|
25
|
+
those — which really shouldn't happen, but sometimes does — then the
|
26
|
+
behaviour may not be particularly sensible. Later evolutions of this
|
27
|
+
feature will hopefully handle that better.)
|
28
|
+
|
29
|
+
## Fixes
|
30
|
+
|
31
|
+
* Previously, any warnings would be displayed at the bottom of the page,
|
32
|
+
which was fine if this table was the only thing on the page, but would
|
33
|
+
be slightly odd if there was other discussion after it. Now the
|
34
|
+
footnotes are explicitly displayed immediately after the table.
|
35
|
+
|
36
|
+
# [1.5.0] 2020-09-06
|
37
|
+
|
38
|
+
## Enhancements
|
39
|
+
|
40
|
+
* When showing the results for a position from long long ago (such as
|
41
|
+
the High Kings of Ireland), display the dates as "862 – 879" not as
|
42
|
+
"862 – 879"
|
43
|
+
* If we only know that someone took (or left) office sometime in a given
|
44
|
+
decade (i.e. at date precision 8), display that as (say) "1930s"
|
45
|
+
|
46
|
+
## Fixes
|
47
|
+
|
48
|
+
* No longer blows up when a P39 has a start date, but no end date
|
49
|
+
|
50
|
+
# [1.4.2] 2020-09-05
|
51
|
+
|
52
|
+
## Fixes
|
53
|
+
|
54
|
+
* Bring back the warnings when start or end dates are missing.
|
55
|
+
|
3
56
|
# [1.4.1] 2020-09-04
|
4
57
|
|
5
58
|
## Fixes
|
data/Rakefile
CHANGED
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
|
@@ -7,7 +7,7 @@ module WikidataPositionHistory
|
|
7
7
|
# This is distinct from the mandate query itself to avoid complex
|
8
8
|
# GROUP BY scenarios where people have multiple values for
|
9
9
|
# biographical properties.
|
10
|
-
class
|
10
|
+
class BioQuery < ItemQuery
|
11
11
|
def raw_sparql
|
12
12
|
<<~SPARQL
|
13
13
|
# holder-biodata
|
@@ -24,7 +24,7 @@ module WikidataPositionHistory
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# Represents a single row returned from the Position query
|
27
|
-
class
|
27
|
+
class BioRow
|
28
28
|
def initialize(row)
|
29
29
|
@row = row
|
30
30
|
end
|
data/lib/sparql/item_query.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module WikidataPositionHistory
|
4
4
|
module SPARQL
|
5
5
|
# SPARQL for fetching all officeholdings of a position
|
6
|
-
class
|
6
|
+
class MandatesQuery < ItemQuery
|
7
7
|
def raw_sparql
|
8
8
|
<<~SPARQL
|
9
9
|
# position-mandates
|
@@ -28,7 +28,7 @@ module WikidataPositionHistory
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# Represents a single row returned from the Mandates query
|
31
|
-
class
|
31
|
+
class MandateRow
|
32
32
|
def initialize(row)
|
33
33
|
@row = row
|
34
34
|
end
|
@@ -63,10 +63,14 @@ module WikidataPositionHistory
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def start_date
|
66
|
+
return if start_date_raw.empty?
|
67
|
+
|
66
68
|
QueryService::WikidataDate.new(start_date_raw, start_date_precision)
|
67
69
|
end
|
68
70
|
|
69
71
|
def end_date
|
72
|
+
return if end_date_raw.empty?
|
73
|
+
|
70
74
|
QueryService::WikidataDate.new(end_date_raw, end_date_precision)
|
71
75
|
end
|
72
76
|
|
@@ -3,35 +3,51 @@
|
|
3
3
|
module WikidataPositionHistory
|
4
4
|
module SPARQL
|
5
5
|
# SPARQL for fetching metadata about a position
|
6
|
-
class
|
6
|
+
class PositionQuery < ItemQuery
|
7
7
|
def raw_sparql
|
8
8
|
<<~SPARQL
|
9
9
|
# position-metadata
|
10
10
|
|
11
|
-
SELECT DISTINCT ?inception ?inception_precision ?abolition ?abolition_precision ?isPosition
|
11
|
+
SELECT DISTINCT ?item ?inception ?inception_precision ?abolition ?abolition_precision ?isPosition
|
12
12
|
WHERE {
|
13
13
|
VALUES ?item { wd:%s }
|
14
|
-
BIND(EXISTS {
|
15
|
-
OPTIONAL { ?item p:P571
|
16
|
-
|
14
|
+
BIND(EXISTS { wd:%s wdt:P279+ wd:Q4164871 } as ?isPosition)
|
15
|
+
OPTIONAL { ?item p:P571 [ a wikibase:BestRank ;
|
16
|
+
psv:P571 [ wikibase:timeValue ?inception; wikibase:timePrecision ?inception_precision ]
|
17
|
+
] }
|
18
|
+
OPTIONAL { ?item p:P576 [ a wikibase:BestRank ;
|
19
|
+
psv:P576 [ wikibase:timeValue ?abolition; wikibase:timePrecision ?abolition_precision ]
|
20
|
+
] }
|
17
21
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
|
18
22
|
}
|
19
23
|
SPARQL
|
20
24
|
end
|
25
|
+
|
26
|
+
def sparql_args
|
27
|
+
[itemid, itemid]
|
28
|
+
end
|
21
29
|
end
|
22
30
|
end
|
23
31
|
|
24
32
|
# Represents a single row returned from the Position query
|
25
|
-
class
|
33
|
+
class PositionRow
|
26
34
|
def initialize(row)
|
27
35
|
@row = row
|
28
36
|
end
|
29
37
|
|
38
|
+
def item
|
39
|
+
QueryService::WikidataItem.new(row.dig(:item, :value))
|
40
|
+
end
|
41
|
+
|
30
42
|
def inception_date
|
43
|
+
return if inception_date_raw.empty?
|
44
|
+
|
31
45
|
QueryService::WikidataDate.new(inception_date_raw, inception_date_precision)
|
32
46
|
end
|
33
47
|
|
34
48
|
def abolition_date
|
49
|
+
return if abolition_date_raw.empty?
|
50
|
+
|
35
51
|
QueryService::WikidataDate.new(abolition_date_raw, abolition_date_precision)
|
36
52
|
end
|
37
53
|
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'query_service'
|
4
4
|
require 'sparql/item_query'
|
5
|
-
require 'sparql/
|
6
|
-
require 'sparql/
|
7
|
-
require 'sparql/
|
5
|
+
require 'sparql/position_query'
|
6
|
+
require 'sparql/bio_query'
|
7
|
+
require 'sparql/mandates_query'
|
8
8
|
require 'wikidata_position_history/checks'
|
9
9
|
require 'wikidata_position_history/template'
|
10
10
|
require 'wikidata_position_history/report'
|
@@ -22,6 +22,19 @@ module WikidataPositionHistory
|
|
22
22
|
WIKI_USERNAME = ENV['WIKI_USERNAME']
|
23
23
|
WIKI_PASSWORD = ENV['WIKI_PASSWORD']
|
24
24
|
|
25
|
+
NO_ID_ERROR = <<~WIKITEXT
|
26
|
+
'''#{WIKI_TEMPLATE_NAME} Error''': You must pass the <code>id</code>
|
27
|
+
parameter to the <code>#{WIKI_TEMPLATE_NAME}</code> template; e.g.
|
28
|
+
<nowiki>{{#{WIKI_TEMPLATE_NAME}|id=Q14211}}</nowiki>
|
29
|
+
WIKITEXT
|
30
|
+
|
31
|
+
MALFORMED_ID_ERROR = <<~WIKITEXT
|
32
|
+
'''#{WIKI_TEMPLATE_NAME} Error''': The <code>id</code> parameter was
|
33
|
+
malformed; it should be Q followed by a number of digits, e.g. as in:
|
34
|
+
|
35
|
+
<nowiki>{{#{WIKI_TEMPLATE_NAME}|id=Q14211}}</nowiki>
|
36
|
+
WIKITEXT
|
37
|
+
|
25
38
|
def initialize(mediawiki_site:, page_title:)
|
26
39
|
@mediawiki_site = mediawiki_site
|
27
40
|
@page_title = page_title.tr('_', ' ')
|
@@ -33,7 +46,7 @@ module WikidataPositionHistory
|
|
33
46
|
|
34
47
|
def new_content
|
35
48
|
return [NO_ID_ERROR, 'The id parameter was missing'] if position_id.empty?
|
36
|
-
return [MALFORMED_ID_ERROR, 'The id parameter was malformed'] unless position_id
|
49
|
+
return [MALFORMED_ID_ERROR, 'The id parameter was malformed'] unless position_id[/^Q\d+$/]
|
37
50
|
|
38
51
|
[WikidataPositionHistory::Report.new(position_id).wikitext, "Successfully updated holders of #{position_id}"]
|
39
52
|
end
|
@@ -42,19 +55,6 @@ module WikidataPositionHistory
|
|
42
55
|
|
43
56
|
attr_reader :mediawiki_site, :page_title
|
44
57
|
|
45
|
-
NO_ID_ERROR = <<~EOERROR
|
46
|
-
'''#{WIKI_TEMPLATE_NAME} Error''': You must pass the <code>id</code>
|
47
|
-
parameter to the <code>#{WIKI_TEMPLATE_NAME}</code> template; e.g.
|
48
|
-
<nowiki>{{#{WIKI_TEMPLATE_NAME}|id=Q14211}}</nowiki>
|
49
|
-
EOERROR
|
50
|
-
|
51
|
-
MALFORMED_ID_ERROR = <<~EOERROR
|
52
|
-
'''#{WIKI_TEMPLATE_NAME} Error''': The <code>id</code> parameter was
|
53
|
-
malformed; it should be Q followed by a number of digits, e.g. as in:
|
54
|
-
|
55
|
-
<nowiki>{{#{WIKI_TEMPLATE_NAME}|id=Q14211}}</nowiki>
|
56
|
-
EOERROR
|
57
|
-
|
58
58
|
def position_id
|
59
59
|
return id_param unless id_param.empty?
|
60
60
|
|
@@ -124,10 +124,10 @@ module WikidataPositionHistory
|
|
124
124
|
def problem?
|
125
125
|
return false unless later
|
126
126
|
|
127
|
-
|
128
|
-
return false
|
127
|
+
next_starts = later.start_date or return false
|
128
|
+
ends = current.end_date or return false
|
129
129
|
|
130
|
-
ends >
|
130
|
+
ends > next_starts
|
131
131
|
rescue ArgumentError
|
132
132
|
true
|
133
133
|
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module WikidataPositionHistory
|
4
4
|
# Date for a single mandate row, to be passed to the report template
|
5
5
|
class MandateData
|
6
|
+
CHECKS = [Check::MissingFields, Check::WrongPredecessor, Check::WrongSuccessor, Check::Overlap].freeze
|
7
|
+
|
6
8
|
def initialize(later, current, earlier)
|
7
9
|
@later = later
|
8
10
|
@current = current
|
@@ -20,8 +22,7 @@ module WikidataPositionHistory
|
|
20
22
|
|
21
23
|
def dates
|
22
24
|
dates = [current.start_date, current.end_date]
|
23
|
-
|
24
|
-
return '' if dates.reject(&:empty?).empty?
|
25
|
+
return '' if dates.compact.empty?
|
25
26
|
|
26
27
|
dates.join(' – ')
|
27
28
|
end
|
@@ -36,11 +37,71 @@ module WikidataPositionHistory
|
|
36
37
|
|
37
38
|
private
|
38
39
|
|
39
|
-
CHECKS = [Check::MissingFields, Check::WrongPredecessor, Check::WrongSuccessor, Check::Overlap].freeze
|
40
|
-
|
41
40
|
attr_reader :later, :current, :earlier
|
42
41
|
end
|
43
42
|
|
43
|
+
# Data about the position itself, to be passed to the report template
|
44
|
+
class Metadata
|
45
|
+
# simplified version of a WikidataPositionHistory::Check
|
46
|
+
Warning = Struct.new(:headline, :explanation)
|
47
|
+
|
48
|
+
def initialize(rows)
|
49
|
+
@rows = rows
|
50
|
+
end
|
51
|
+
|
52
|
+
def item
|
53
|
+
rows.map(&:item).first
|
54
|
+
end
|
55
|
+
|
56
|
+
def inception_date
|
57
|
+
return if inception_dates.empty?
|
58
|
+
|
59
|
+
inception_dates.join(' / ')
|
60
|
+
end
|
61
|
+
|
62
|
+
def inception_warning
|
63
|
+
count = inception_dates.count
|
64
|
+
|
65
|
+
return if count == 1
|
66
|
+
return Warning.new('Missing field', "#{item_qlink} is missing {{P|571}}") if count.zero?
|
67
|
+
|
68
|
+
Warning.new('Multiple values', "#{item_qlink} has more than one {{P|571}}")
|
69
|
+
end
|
70
|
+
|
71
|
+
def abolition_date
|
72
|
+
return if abolition_dates.empty?
|
73
|
+
|
74
|
+
abolition_dates.join(' / ')
|
75
|
+
end
|
76
|
+
|
77
|
+
def abolition_warning
|
78
|
+
return unless abolition_dates.count > 1
|
79
|
+
|
80
|
+
Warning.new('Multiple values', "#{item_qlink} has more than one {{P|576}}")
|
81
|
+
end
|
82
|
+
|
83
|
+
def position?
|
84
|
+
# this should be the same everywhere
|
85
|
+
rows.map(&:position?).first
|
86
|
+
end
|
87
|
+
|
88
|
+
private
|
89
|
+
|
90
|
+
attr_reader :rows
|
91
|
+
|
92
|
+
def inception_dates
|
93
|
+
rows.map(&:inception_date).compact.uniq(&:to_s).sort
|
94
|
+
end
|
95
|
+
|
96
|
+
def abolition_dates
|
97
|
+
rows.map(&:abolition_date).compact.uniq(&:to_s).sort
|
98
|
+
end
|
99
|
+
|
100
|
+
def item_qlink
|
101
|
+
item.qlink
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
44
105
|
# The entire wikitext generated for this report
|
45
106
|
class Report
|
46
107
|
def initialize(position_id, template_class = ReportTemplate)
|
@@ -71,16 +132,22 @@ module WikidataPositionHistory
|
|
71
132
|
[header, wikitext].join("\n")
|
72
133
|
end
|
73
134
|
|
135
|
+
def template_params
|
136
|
+
{
|
137
|
+
metadata: metadata,
|
138
|
+
table_rows: table_rows,
|
139
|
+
sparql_url: sparql.wdqs_url,
|
140
|
+
}
|
141
|
+
end
|
142
|
+
|
74
143
|
private
|
75
144
|
|
76
145
|
def metadata
|
77
|
-
|
78
|
-
# multiple dates
|
79
|
-
@metadata ||= SPARQL::PositionData.new(position_id).results_as(PositionData).first
|
146
|
+
@metadata ||= Metadata.new(SPARQL::PositionQuery.new(position_id).results_as(PositionRow))
|
80
147
|
end
|
81
148
|
|
82
149
|
def biodata
|
83
|
-
@biodata ||= SPARQL::
|
150
|
+
@biodata ||= SPARQL::BioQuery.new(position_id).results_as(BioRow)
|
84
151
|
end
|
85
152
|
|
86
153
|
def biodata_for(officeholder)
|
@@ -92,11 +159,11 @@ module WikidataPositionHistory
|
|
92
159
|
end
|
93
160
|
|
94
161
|
def sparql
|
95
|
-
@sparql ||= SPARQL::
|
162
|
+
@sparql ||= SPARQL::MandatesQuery.new(position_id)
|
96
163
|
end
|
97
164
|
|
98
165
|
def mandates
|
99
|
-
@mandates ||= sparql.results_as(
|
166
|
+
@mandates ||= sparql.results_as(MandateRow)
|
100
167
|
end
|
101
168
|
|
102
169
|
def no_items_output
|
@@ -107,13 +174,6 @@ module WikidataPositionHistory
|
|
107
174
|
template_class.new(template_params).output
|
108
175
|
end
|
109
176
|
|
110
|
-
def template_params
|
111
|
-
{
|
112
|
-
table_rows: table_rows,
|
113
|
-
sparql_url: sparql.wdqs_url,
|
114
|
-
}
|
115
|
-
end
|
116
|
-
|
117
177
|
def table_rows
|
118
178
|
padded_mandates.each_cons(3).map do |later, current, earlier|
|
119
179
|
{
|
@@ -16,22 +16,44 @@ module WikidataPositionHistory
|
|
16
16
|
attr_reader :data
|
17
17
|
|
18
18
|
def template
|
19
|
-
@template ||= ERB.new(template_text)
|
19
|
+
@template ||= ERB.new(template_text, nil, '-')
|
20
20
|
end
|
21
21
|
|
22
22
|
def template_text
|
23
23
|
<<~ERB
|
24
24
|
{| class="wikitable" style="text-align: center; border: none;"
|
25
|
-
<%
|
25
|
+
<% if metadata.abolition_date -%>
|
26
|
+
|-
|
27
|
+
| colspan="3" style="padding:0.5em 2em; border: none; background: #fff; font-size: 1.25em; text-align: right;" | '''Position abolished''': <%= metadata.abolition_date %>
|
28
|
+
| style="padding:0.5em 2em 0.5em 1em; border: none; background: #fff; text-align: left;" | \
|
29
|
+
<% [metadata.abolition_warning].compact.each do |warning| -%>
|
30
|
+
<span style="display: block">[[File:Pictogram voting comment.svg|15px|link=]] <span style="color: #d33; font-weight: bold; vertical-align: middle;"><%= warning.headline %></span> <ref><%= warning.explanation %></ref></span>\
|
31
|
+
<% end %>
|
32
|
+
<% end -%>
|
33
|
+
<% table_rows.map(&:values).each do |mandate, bio| -%>
|
34
|
+
|-
|
26
35
|
| style="padding:0.5em 2em" | <%= mandate.ordinal_string %>
|
27
36
|
| style="padding:0.5em 2em" | <%= bio.map(&:image_link).first %>
|
28
37
|
| style="padding:0.5em 2em" | <span style="font-size: <%= mandate.acting? ? '1.25em; font-style: italic;' : '1.5em' %>; display: block;"><%= mandate.person %></span> <%= mandate.dates %>
|
29
|
-
| style="padding:0.5em 2em 0.5em 1em; border: none; background: #fff; text-align: left;" |
|
30
|
-
<%
|
38
|
+
| style="padding:0.5em 2em 0.5em 1em; border: none; background: #fff; text-align: left;" | \
|
39
|
+
<% mandate.warnings.each do |warning| -%>
|
40
|
+
<span style="display: block">[[File:Pictogram voting comment.svg|15px|link=]] <span style="color: #d33; font-weight: bold; vertical-align: middle;"><%= warning.headline %></span> <ref><%= warning.explanation %></ref></span>\
|
41
|
+
<% end %>
|
42
|
+
<% end -%>
|
43
|
+
<% if metadata.inception_date -%>
|
44
|
+
|-
|
45
|
+
| colspan="3" style="padding:0.5em 2em; border: none; background: #fff; font-size: 1.25em; text-align: right;" | '''Position created''': <%= metadata.inception_date %>
|
46
|
+
| style="padding:0.5em 2em 0.5em 1em; border: none; background: #fff; text-align: left;" | \
|
47
|
+
<% [metadata.inception_warning].compact.each do |warning| -%>
|
48
|
+
<span style="display: block">[[File:Pictogram voting comment.svg|15px|link=]] <span style="color: #d33; font-weight: bold; vertical-align: middle;"><%= warning.headline %></span> <ref><%= warning.explanation %></ref></span>\
|
49
|
+
<% end %>
|
50
|
+
<% end -%>
|
51
|
+
|}
|
31
52
|
|
32
53
|
<div style="margin-bottom:5px; border-bottom:3px solid #2f74d0; font-size:8pt">
|
33
54
|
<div style="float:right">[<%= sparql_url %> WDQS]</div>
|
34
55
|
</div>
|
56
|
+
{{reflist}}
|
35
57
|
ERB
|
36
58
|
end
|
37
59
|
end
|
@@ -11,8 +11,8 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.authors = ['Tony Bowden', 'Mark Longair']
|
12
12
|
spec.email = ['tony@tmtm.com']
|
13
13
|
|
14
|
-
spec.summary = 'Generates a
|
15
|
-
spec.homepage = 'https://github.com/
|
14
|
+
spec.summary = 'Generates a table of historic holders of a Wikidata position'
|
15
|
+
spec.homepage = 'https://github.com/tmtmtmtm/wikidata-position-history/'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
18
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
25
|
spec.require_paths = ['lib']
|
26
26
|
|
27
|
-
spec.add_runtime_dependency 'mediawiki-replaceable-content', '0.2.
|
27
|
+
spec.add_runtime_dependency 'mediawiki-replaceable-content', '0.2.2'
|
28
28
|
spec.add_runtime_dependency 'rest-client', '~> 2.0'
|
29
29
|
|
30
30
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
@@ -33,6 +33,8 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency 'rake', '~> 13.0'
|
34
34
|
spec.add_development_dependency 'reek', '~> 6.0'
|
35
35
|
spec.add_development_dependency 'rubocop', '~> 0.89'
|
36
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.8.0'
|
37
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.43.2'
|
36
38
|
spec.add_development_dependency 'warning', '~> 1.1'
|
37
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
39
|
+
spec.add_development_dependency 'webmock', '~> 3.8.3'
|
38
40
|
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.7.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-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mediawiki-replaceable-content
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.2.
|
20
|
+
version: 0.2.2
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.2.
|
27
|
+
version: 0.2.2
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rest-client
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,6 +123,34 @@ dependencies:
|
|
123
123
|
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0.89'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rubocop-performance
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 1.8.0
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: 1.8.0
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: rubocop-rspec
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 1.43.2
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: 1.43.2
|
126
154
|
- !ruby/object:Gem::Dependency
|
127
155
|
name: warning
|
128
156
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,14 +171,14 @@ dependencies:
|
|
143
171
|
requirements:
|
144
172
|
- - "~>"
|
145
173
|
- !ruby/object:Gem::Version
|
146
|
-
version: 3.
|
174
|
+
version: 3.8.3
|
147
175
|
type: :development
|
148
176
|
prerelease: false
|
149
177
|
version_requirements: !ruby/object:Gem::Requirement
|
150
178
|
requirements:
|
151
179
|
- - "~>"
|
152
180
|
- !ruby/object:Gem::Version
|
153
|
-
version: 3.
|
181
|
+
version: 3.8.3
|
154
182
|
description:
|
155
183
|
email:
|
156
184
|
- tony@tmtm.com
|
@@ -176,17 +204,17 @@ files:
|
|
176
204
|
- exe/position-history-for-item
|
177
205
|
- exe/update_wikidata_page
|
178
206
|
- lib/query_service.rb
|
179
|
-
- lib/sparql/
|
207
|
+
- lib/sparql/bio_query.rb
|
180
208
|
- lib/sparql/item_query.rb
|
181
|
-
- lib/sparql/
|
182
|
-
- lib/sparql/
|
209
|
+
- lib/sparql/mandates_query.rb
|
210
|
+
- lib/sparql/position_query.rb
|
183
211
|
- lib/wikidata_position_history.rb
|
184
212
|
- lib/wikidata_position_history/checks.rb
|
185
213
|
- lib/wikidata_position_history/report.rb
|
186
214
|
- lib/wikidata_position_history/template.rb
|
187
215
|
- lib/wikidata_position_history/version.rb
|
188
216
|
- wikidata_position_history.gemspec
|
189
|
-
homepage: https://github.com/
|
217
|
+
homepage: https://github.com/tmtmtmtm/wikidata-position-history/
|
190
218
|
licenses:
|
191
219
|
- MIT
|
192
220
|
metadata:
|
@@ -210,5 +238,5 @@ rubyforge_project:
|
|
210
238
|
rubygems_version: 2.7.6.2
|
211
239
|
signing_key:
|
212
240
|
specification_version: 4
|
213
|
-
summary: Generates a
|
241
|
+
summary: Generates a table of historic holders of a Wikidata position
|
214
242
|
test_files: []
|