wikidata_position_history 1.4.0 → 1.4.1

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: 0ef4815c74d73d50bd3d74a70af9d9b47177d5f3c00e35748892cad201150bed
4
- data.tar.gz: fdd1e8b5fa7fe220da78daabdcdc016e8ee729c57648103bbc384860e2ef0ce6
3
+ metadata.gz: 1e79781ac90a9b99e18013cb11a56de58959f5d91aaef2cebe888f73f54205e2
4
+ data.tar.gz: c43cdea3f569a532eda7df1141e6a6017eb881a127571ca0ee289e67d80f0f1a
5
5
  SHA512:
6
- metadata.gz: fe138774ce37cf9258c7f11bfc3bc95cbaafa3811507a2b963d006d1e5982e9257ce754ea46fe47fe7e3eabb95520ae534549badcc6a7c8335ee3ff4368cef82
7
- data.tar.gz: 2e266bd52f9bef2e8736bcf566c1ec5e4b7ad10a90f13d4a31f6613411797ff01e4a528263db3b15cce573de10c4c41eb36ea46838f7d16c30748a3a58585564
6
+ metadata.gz: 00b3260f1ebcaa8ad0037459e97460297ed9c2dfb3e373355d551c043b2ac58759bf1f38437977a65b623bfa45631b8f4521a8207638d3a3490d7e7db18191c4
7
+ data.tar.gz: 4a37942a4d5bcefd9694bed153d3e39692d8b78c96f3256cc9046e64d8ce5ba75a99ea25a599b901508ce42b1852deeb0b6ada2eb959a737d02be9142a31fd2e
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ # [1.4.1] 2020-09-04
4
+
5
+ ## Fixes
6
+
7
+ * Work around template deployment issue.
8
+
3
9
  # [1.4.0] 2020-09-04
4
10
 
5
11
  ## Enhancements
@@ -6,6 +6,7 @@ require 'sparql/position_data'
6
6
  require 'sparql/bio_data'
7
7
  require 'sparql/mandates'
8
8
  require 'wikidata_position_history/checks'
9
+ require 'wikidata_position_history/template'
9
10
  require 'wikidata_position_history/report'
10
11
  require 'wikidata_position_history/version'
11
12
 
@@ -41,38 +41,14 @@ module WikidataPositionHistory
41
41
  attr_reader :later, :current, :earlier
42
42
  end
43
43
 
44
- # Interface to the ERB Template for the output
45
- class ReportTemplate
46
- def initialize(file, data)
47
- @file = file
48
- @data = data
49
- end
50
-
51
- def output
52
- template.result_with_hash(data)
53
- end
54
-
55
- private
56
-
57
- def template_path
58
- Pathname.new(file)
59
- end
60
-
61
- def template
62
- @template ||= ERB.new(template_path.read)
63
- end
64
-
65
- attr_reader :file, :data
66
- end
67
-
68
44
  # The entire wikitext generated for this report
69
45
  class Report
70
- def initialize(position_id, template_file = 'report.erb')
46
+ def initialize(position_id, template_class = ReportTemplate)
71
47
  @position_id = position_id
72
- @template_file = template_file
48
+ @template_class = template_class
73
49
  end
74
50
 
75
- attr_reader :position_id, :template_file
51
+ attr_reader :position_id, :template_class
76
52
 
77
53
  def wikitext
78
54
  return no_items_output if mandates.empty?
@@ -128,7 +104,7 @@ module WikidataPositionHistory
128
104
  end
129
105
 
130
106
  def output
131
- ReportTemplate.new(template_file, template_params).output
107
+ template_class.new(template_params).output
132
108
  end
133
109
 
134
110
  def template_params
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WikidataPositionHistory
4
+ # Interface to the ERB Template for the output
5
+ class ReportTemplate
6
+ def initialize(data)
7
+ @data = data
8
+ end
9
+
10
+ def output
11
+ template.result_with_hash(data)
12
+ end
13
+
14
+ private
15
+
16
+ attr_reader :data
17
+
18
+ def template
19
+ @template ||= ERB.new(template_text)
20
+ end
21
+
22
+ def template_text
23
+ <<~ERB
24
+ {| class="wikitable" style="text-align: center; border: none;"
25
+ <% table_rows.map(&:values).each do |mandate, bio| %>|-
26
+ | style="padding:0.5em 2em" | <%= mandate.ordinal_string %>
27
+ | style="padding:0.5em 2em" | <%= bio.map(&:image_link).first %>
28
+ | 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 %>|}
31
+
32
+ <div style="margin-bottom:5px; border-bottom:3px solid #2f74d0; font-size:8pt">
33
+ <div style="float:right">[<%= sparql_url %> WDQS]</div>
34
+ </div>
35
+ ERB
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WikidataPositionHistory
4
- VERSION = '1.4.0'
4
+ VERSION = '1.4.1'
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.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Bowden
@@ -183,8 +183,8 @@ files:
183
183
  - lib/wikidata_position_history.rb
184
184
  - lib/wikidata_position_history/checks.rb
185
185
  - lib/wikidata_position_history/report.rb
186
+ - lib/wikidata_position_history/template.rb
186
187
  - lib/wikidata_position_history/version.rb
187
- - report.erb
188
188
  - wikidata_position_history.gemspec
189
189
  homepage: https://github.com/everypolitician/wikidata-position-history/
190
190
  licenses:
data/report.erb DELETED
@@ -1,11 +0,0 @@
1
- {| class="wikitable" style="text-align: center; border: none;"
2
- <% table_rows.map(&:values).each do |mandate, bio| %>|-
3
- | style="padding:0.5em 2em" | <%= mandate.ordinal_string %>
4
- | style="padding:0.5em 2em" | <%= bio.map(&:image_link).first %>
5
- | 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 %>
6
- | 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 %>
7
- <% end %>|}
8
-
9
- <div style="margin-bottom:5px; border-bottom:3px solid #2f74d0; font-size:8pt">
10
- <div style="float:right">[<%= sparql_url %> WDQS]</div>
11
- </div>