wikidata_position_history 1.5.0 → 1.6.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: 3cc474575654a299ceef536c692402288d072d7caf3d9bd62de17d9027bcd287
4
- data.tar.gz: 2e6324cc0e272b5b747d65eab1aaa32f1c621a6e672487312f616afd9449d374
3
+ metadata.gz: d6133f77b6d65f7decf2dcac481ff36a661a136fb79aff442677669801248437
4
+ data.tar.gz: dccd3b0a0ed29d89c945756c9efa30e8c02f1c912b4402bec1a45a1c45d81e88
5
5
  SHA512:
6
- metadata.gz: 709a0916f16fd2a890df7ae3e2873968a23f0640945cf756785eb59bf8d7589b578fb2bd51e6263b36de729e20ea2a200cfcd9731ee6957a2e539169cacb0cbf
7
- data.tar.gz: 3dbe5d81f0fe77f6487ce0109b91205d3b4361e13c70b48f93464ea4a323d06f3c07b70ea263e4817592cedf1b632e10b10be832dd03a92114f59505b53dae5a
6
+ metadata.gz: 0112ca4aae8b9631d86bbf1c2cca5120808e9eb1bb207008e8ba8d221ec0c0c2d16e5f22ec0c59fe9454839c04fcd32bd71f67d1e1793e0d8c053b9d2f1d1471
7
+ data.tar.gz: 8fd03fc79a37459686524927ba536ab770c22ac4c8d948fde53be1eafba155a3a0f2b072cd8ab8142867e0f57a8138ac62c1535d54bf5330e987bbfc7a2a553e
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ # [1.6.0] 2020-09-07
4
+
5
+ ## Enhancements
6
+
7
+ * If a position has an inception date and/or abolition date, those will
8
+ now also be displayed. (If a position has more than one of either of
9
+ those — which really shouldn't happen, but sometimes does — then the
10
+ behaviour may not be particularly sensible. Later evolutions of this
11
+ feature will hopefully handle that better.)
12
+
13
+ ## Fixes
14
+
15
+ * Previously, any warnings would be displayed at the bottom of the page,
16
+ which was fine if this table was the only thing on the page, but would
17
+ be slightly odd if there was other discussion after it. Now the
18
+ footnotes are explicitly displayed immediately after the table.
19
+
3
20
  # [1.5.0] 2020-09-06
4
21
 
5
22
  ## Enhancements
@@ -28,10 +28,14 @@ module WikidataPositionHistory
28
28
  end
29
29
 
30
30
  def inception_date
31
+ return if inception_date_raw.empty?
32
+
31
33
  QueryService::WikidataDate.new(inception_date_raw, inception_date_precision)
32
34
  end
33
35
 
34
36
  def abolition_date
37
+ return if abolition_date_raw.empty?
38
+
35
39
  QueryService::WikidataDate.new(abolition_date_raw, abolition_date_precision)
36
40
  end
37
41
 
@@ -70,6 +70,14 @@ module WikidataPositionHistory
70
70
  [header, wikitext].join("\n")
71
71
  end
72
72
 
73
+ def template_params
74
+ {
75
+ metadata: metadata,
76
+ table_rows: table_rows,
77
+ sparql_url: sparql.wdqs_url,
78
+ }
79
+ end
80
+
73
81
  private
74
82
 
75
83
  def metadata
@@ -106,13 +114,6 @@ module WikidataPositionHistory
106
114
  template_class.new(template_params).output
107
115
  end
108
116
 
109
- def template_params
110
- {
111
- table_rows: table_rows,
112
- sparql_url: sparql.wdqs_url,
113
- }
114
- end
115
-
116
117
  def table_rows
117
118
  padded_mandates.each_cons(3).map do |later, current, earlier|
118
119
  {
@@ -16,22 +16,38 @@ 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
- <% table_rows.map(&:values).each do |mandate, bio| %>|-
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
+ <% end -%>
30
+ <% table_rows.map(&:values).each do |mandate, bio| -%>
31
+ |-
26
32
  | style="padding:0.5em 2em" | <%= mandate.ordinal_string %>
27
33
  | style="padding:0.5em 2em" | <%= bio.map(&:image_link).first %>
28
34
  | 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;" | <% mandate.warnings.each do |warning| %><span style="display: block">[[File:Pictogram voting comment.svg|15px|link=]]&nbsp;<span style="color: #d33; font-weight: bold; vertical-align: middle;"><%= warning.headline %></span>&nbsp;<ref><%= warning.explanation %></ref></span><% end %>
30
- <% end %>|}
35
+ | style="padding:0.5em 2em 0.5em 1em; border: none; background: #fff; text-align: left;" | \
36
+ <% mandate.warnings.each do |warning| -%>
37
+ <span style="display: block">[[File:Pictogram voting comment.svg|15px|link=]]&nbsp;<span style="color: #d33; font-weight: bold; vertical-align: middle;"><%= warning.headline %></span>&nbsp;<ref><%= warning.explanation %></ref></span>\
38
+ <% end %>
39
+ <% end -%>
40
+ <% if metadata.inception_date -%>
41
+ |-
42
+ | colspan="3" style="padding:0.5em 2em; border: none; background: #fff; font-size: 1.25em; text-align: right;" | '''Position created''': <%= metadata.inception_date %>
43
+ | style="padding:0.5em 2em 0.5em 1em; border: none; background: #fff; text-align: left;" |
44
+ <% end -%>
45
+ |}
31
46
 
32
47
  <div style="margin-bottom:5px; border-bottom:3px solid #2f74d0; font-size:8pt">
33
48
  <div style="float:right">[<%= sparql_url %> WDQS]</div>
34
49
  </div>
50
+ {{reflist}}
35
51
  ERB
36
52
  end
37
53
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WikidataPositionHistory
4
- VERSION = '1.5.0'
4
+ VERSION = '1.6.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.5.0
4
+ version: 1.6.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-06 00:00:00.000000000 Z
12
+ date: 2020-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mediawiki-replaceable-content