wikidata_position_history 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +33 -0
- data/.rubocop.yml +1 -1
- data/.travis.yml +1 -4
- data/CHANGELOG.md +14 -0
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/exe/update_wikidata_page +1 -1
- data/lib/sparql/item_query.rb +6 -0
- data/lib/wikidata_position_history/report.rb +18 -2
- data/lib/wikidata_position_history/version.rb +1 -1
- data/wikidata_position_history.gemspec +2 -2
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '018cdd5d51eee83b0738a0b84f32d92259bf4665fe25894b2d005f308c033466'
|
4
|
+
data.tar.gz: bf630179eacfe1e68b88dacd268ae4c1e35efdabfc0149963338cf9de3a20567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb6dd44e9a746bf425a5ef8199d7bd10891ea887d3f61dab6fff676ecdb21ceec19da22ac585c0ac3c61d70a4deeb26c5fd1f602ab45d49aaa6595ca4aa0dccd
|
7
|
+
data.tar.gz: 583747329e14ed0f7292c5f7e71e1e4bafe63ca83dd028786449fa582af0b68880e90287e1028b249eeef28f125f54d3b7ae0d6940048cc122901f57b52e2aa5
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v2
|
23
|
+
- name: Set up Ruby
|
24
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
25
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
26
|
+
# uses: ruby/setup-ruby@v1
|
27
|
+
uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
|
28
|
+
with:
|
29
|
+
ruby-version: 2.5
|
30
|
+
- name: Install dependencies
|
31
|
+
run: bundle install
|
32
|
+
- name: Run tests
|
33
|
+
run: bundle exec rake
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
# [1.3.4] - 2020-09-01
|
4
|
+
|
5
|
+
## Fixes
|
6
|
+
|
7
|
+
* Update to latest version of mediawiki-replaceable-content to include
|
8
|
+
upstream bug fix.
|
9
|
+
|
10
|
+
# [1.3.3] - 2020-08-29
|
11
|
+
|
12
|
+
## Enhancements
|
13
|
+
|
14
|
+
* Include link to Wikidata Query Service showing the SPARQL used to
|
15
|
+
generate the list.
|
16
|
+
|
3
17
|
# [1.3.2] - 2020-08-29
|
4
18
|
|
5
19
|
## Fixes
|
data/bin/console
CHANGED
File without changes
|
data/bin/setup
CHANGED
File without changes
|
data/exe/update_wikidata_page
CHANGED
@@ -17,7 +17,7 @@ if ARGV.first.start_with?('http')
|
|
17
17
|
page_title: uri.path.gsub('/wiki/', ''), # with 2.5.1 we could use delete_prefix
|
18
18
|
}
|
19
19
|
else
|
20
|
-
options = URI.decode_www_form(ARGV.first).
|
20
|
+
options = URI.decode_www_form(ARGV.first).transform_keys(&:to_sym)
|
21
21
|
end
|
22
22
|
|
23
23
|
warn "Running with options: #{options.inspect}" if ENV.key?('DEBUG')
|
data/lib/sparql/item_query.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'erb'
|
4
|
+
|
3
5
|
module WikidataPositionHistory
|
4
6
|
module SPARQL
|
5
7
|
# Turn raw SPARQL into result objects
|
@@ -12,6 +14,10 @@ module WikidataPositionHistory
|
|
12
14
|
json.map { |result| klass.new(result) }
|
13
15
|
end
|
14
16
|
|
17
|
+
def wdqs_url
|
18
|
+
"https://query.wikidata.org/##{ERB::Util.url_encode(sparql)}"
|
19
|
+
end
|
20
|
+
|
15
21
|
private
|
16
22
|
|
17
23
|
attr_reader :itemid
|
@@ -85,7 +85,7 @@ module WikidataPositionHistory
|
|
85
85
|
def wikitext
|
86
86
|
return no_items_output if mandates.empty?
|
87
87
|
|
88
|
-
[table_header, table_rows, table_footer].compact.join("\n")
|
88
|
+
[table_header, table_rows, table_footer, wdqs_section].compact.join("\n")
|
89
89
|
end
|
90
90
|
|
91
91
|
def header
|
@@ -115,8 +115,12 @@ module WikidataPositionHistory
|
|
115
115
|
[nil, mandates, nil].flatten(1)
|
116
116
|
end
|
117
117
|
|
118
|
+
def sparql
|
119
|
+
@sparql ||= SPARQL::Mandates.new(subject_item_id)
|
120
|
+
end
|
121
|
+
|
118
122
|
def mandates
|
119
|
-
@mandates ||=
|
123
|
+
@mandates ||= sparql.results_as(Mandate)
|
120
124
|
end
|
121
125
|
|
122
126
|
def no_items_output
|
@@ -131,6 +135,18 @@ module WikidataPositionHistory
|
|
131
135
|
"|}\n"
|
132
136
|
end
|
133
137
|
|
138
|
+
def wdqs_section
|
139
|
+
wdqs_div % sparql.wdqs_url
|
140
|
+
end
|
141
|
+
|
142
|
+
def wdqs_div
|
143
|
+
<<~HTML
|
144
|
+
<div style="margin-bottom:5px; border-bottom:3px solid #2f74d0; font-size:8pt">
|
145
|
+
<div style="float:right">[%s WDQS]</div>
|
146
|
+
</div>
|
147
|
+
HTML
|
148
|
+
end
|
149
|
+
|
134
150
|
def table_rows
|
135
151
|
padded_mandates.each_cons(3).map do |later, current, earlier|
|
136
152
|
MandateReport.new(later, current, earlier).output
|
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require 'wikidata_position_history/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.required_ruby_version = '>= 2.
|
8
|
+
spec.required_ruby_version = '>= 2.5.0'
|
9
9
|
spec.name = 'wikidata_position_history'
|
10
10
|
spec.version = WikidataPositionHistory::VERSION
|
11
11
|
spec.authors = ['Tony Bowden', 'Mark Longair']
|
@@ -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-
|
27
|
+
spec.add_runtime_dependency 'mediawiki-replaceable-content', '0.2.1'
|
28
28
|
spec.add_runtime_dependency 'rest-client', '~> 2.0'
|
29
29
|
|
30
30
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
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.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Bowden
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: mediawiki-
|
15
|
+
name: mediawiki-replaceable-content
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.1
|
20
|
+
version: 0.2.1
|
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.1
|
27
|
+
version: 0.2.1
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rest-client
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,6 +160,7 @@ executables:
|
|
160
160
|
extensions: []
|
161
161
|
extra_rdoc_files: []
|
162
162
|
files:
|
163
|
+
- ".github/workflows/ruby.yml"
|
163
164
|
- ".gitignore"
|
164
165
|
- ".reek.yml"
|
165
166
|
- ".rubocop.yml"
|
@@ -196,7 +197,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
196
197
|
requirements:
|
197
198
|
- - ">="
|
198
199
|
- !ruby/object:Gem::Version
|
199
|
-
version: 2.
|
200
|
+
version: 2.5.0
|
200
201
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
202
|
requirements:
|
202
203
|
- - ">="
|
@@ -204,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
205
|
version: '0'
|
205
206
|
requirements: []
|
206
207
|
rubyforge_project:
|
207
|
-
rubygems_version: 2.6.
|
208
|
+
rubygems_version: 2.7.6.2
|
208
209
|
signing_key:
|
209
210
|
specification_version: 4
|
210
211
|
summary: Generates a wikitext history of a holders of a position in Wikidata
|