infoboxer 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +32 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +97 -75
- data/README.md +1 -1
- data/lib/infoboxer.rb +7 -5
- data/lib/infoboxer/core_ext.rb +2 -0
- data/lib/infoboxer/definitions/en.wikipedia.org.rb +2 -0
- data/lib/infoboxer/media_wiki.rb +3 -1
- data/lib/infoboxer/media_wiki/page.rb +2 -0
- data/lib/infoboxer/media_wiki/traits.rb +4 -1
- data/lib/infoboxer/navigation.rb +2 -0
- data/lib/infoboxer/navigation/lookup.rb +5 -5
- data/lib/infoboxer/navigation/sections.rb +5 -1
- data/lib/infoboxer/navigation/selector.rb +3 -1
- data/lib/infoboxer/navigation/shortcuts.rb +2 -0
- data/lib/infoboxer/navigation/wikipath.rb +2 -0
- data/lib/infoboxer/parser.rb +3 -1
- data/lib/infoboxer/parser/context.rb +10 -6
- data/lib/infoboxer/parser/html.rb +2 -0
- data/lib/infoboxer/parser/image.rb +3 -1
- data/lib/infoboxer/parser/inline.rb +8 -4
- data/lib/infoboxer/parser/paragraphs.rb +3 -1
- data/lib/infoboxer/parser/table.rb +23 -15
- data/lib/infoboxer/parser/template.rb +3 -0
- data/lib/infoboxer/parser/util.rb +2 -0
- data/lib/infoboxer/templates.rb +2 -0
- data/lib/infoboxer/templates/base.rb +2 -0
- data/lib/infoboxer/templates/set.rb +2 -0
- data/lib/infoboxer/tree.rb +2 -0
- data/lib/infoboxer/tree/compound.rb +3 -1
- data/lib/infoboxer/tree/document.rb +2 -0
- data/lib/infoboxer/tree/gallery.rb +2 -0
- data/lib/infoboxer/tree/html.rb +4 -2
- data/lib/infoboxer/tree/image.rb +3 -1
- data/lib/infoboxer/tree/inline.rb +2 -0
- data/lib/infoboxer/tree/linkable.rb +2 -0
- data/lib/infoboxer/tree/list.rb +4 -2
- data/lib/infoboxer/tree/math.rb +2 -0
- data/lib/infoboxer/tree/node.rb +3 -1
- data/lib/infoboxer/tree/nodes.rb +16 -4
- data/lib/infoboxer/tree/paragraphs.rb +2 -0
- data/lib/infoboxer/tree/ref.rb +2 -0
- data/lib/infoboxer/tree/table.rb +5 -3
- data/lib/infoboxer/tree/template.rb +3 -1
- data/lib/infoboxer/tree/text.rb +11 -9
- data/lib/infoboxer/tree/wikilink.rb +3 -0
- data/lib/infoboxer/version.rb +4 -2
- data/lib/infoboxer/wiki_path.rb +2 -0
- data/regression/pages/2012_bdo_world_darts_championship.wiki +941 -0
- data/regression/pages/progress_wrestling.wiki +1308 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 755e1283e896d2c2b363983a9b04ac92cb14870cfa2ab67fd62777684bac1352
|
4
|
+
data.tar.gz: c5443d788fc06a2310c65b80bc16531b820bb7142f611f5d063af8992cee7525
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1443ecf7dbb485555a275a4d5390417ee48fabb2321a23fb59c208d32c1424259515924e903872b762afebcaaf5574afd713e4eade6c346aeb8e71719c051436
|
7
|
+
data.tar.gz: 71c007554240c40a7e7f9bee81d66d637b8643f1ccf18a5900c24087545d3c430830d8a30d9c4463244b13419d4edb349aee585885b6aecf03dc8d8b37d701a7
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
main:
|
11
|
+
name: >-
|
12
|
+
${{ matrix.ruby }}
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
strategy:
|
15
|
+
fail-fast: false
|
16
|
+
matrix:
|
17
|
+
ruby: [ 2.6, 2.7, 3.0, head ]
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- name: checkout
|
21
|
+
uses: actions/checkout@v2
|
22
|
+
- name: set up Ruby
|
23
|
+
uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: ${{ matrix.ruby }}
|
26
|
+
|
27
|
+
- name: install dependencies
|
28
|
+
run: bundle install --jobs 3 --retry 3
|
29
|
+
- name: spec
|
30
|
+
run: bundle exec rake spec
|
31
|
+
- name: rubocop
|
32
|
+
run: bundle exec rake rubocop
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Infoboxer's change log
|
2
2
|
|
3
|
+
## 0.4.0 (2021-05-30)
|
4
|
+
|
5
|
+
* A cluster of bugs found in #81 fixed:
|
6
|
+
* Empty comment (`<!---->`) now processed properly;
|
7
|
+
* Templates that are implicitly inside tables (put on a separate row) now always create
|
8
|
+
an implicit `<TableCell>`
|
9
|
+
* Heading after non-closed table closes the table implicitly instead of being inserted
|
10
|
+
into the last cell.
|
11
|
+
* Drop Ruby < 2.6, and support 3.0 instead.
|
12
|
+
|
13
|
+
PS: Yeah, year-and-almost-half is much better than 2 years between releases, I guess.. And let's call
|
14
|
+
it non-patch version then.
|
15
|
+
|
3
16
|
## 0.3.3 (2020-02-09)
|
4
17
|
|
5
18
|
* Fixed table captions handling (thanks @robfors for reporting)
|
data/Gemfile.lock
CHANGED
@@ -10,7 +10,7 @@ GIT
|
|
10
10
|
PATH
|
11
11
|
remote: .
|
12
12
|
specs:
|
13
|
-
infoboxer (0.
|
13
|
+
infoboxer (0.4.0)
|
14
14
|
addressable
|
15
15
|
htmlentities
|
16
16
|
mediawiktory (= 0.1.3)
|
@@ -19,31 +19,44 @@ PATH
|
|
19
19
|
GEM
|
20
20
|
remote: https://rubygems.org/
|
21
21
|
specs:
|
22
|
-
addressable (2.
|
23
|
-
public_suffix (
|
22
|
+
addressable (2.7.0)
|
23
|
+
public_suffix (>= 2.0.2, < 5.0)
|
24
24
|
ansi (1.5.0)
|
25
|
-
ast (2.4.
|
26
|
-
backports (3.
|
27
|
-
byebug (
|
28
|
-
coveralls (0.8.
|
25
|
+
ast (2.4.2)
|
26
|
+
backports (3.21.0)
|
27
|
+
byebug (11.1.3)
|
28
|
+
coveralls (0.8.23)
|
29
29
|
json (>= 1.8, < 3)
|
30
|
-
simplecov (~> 0.
|
30
|
+
simplecov (~> 0.16.1)
|
31
31
|
term-ansicolor (~> 1.3)
|
32
|
-
thor (
|
32
|
+
thor (>= 0.19.4, < 2.0)
|
33
33
|
tins (~> 1.6)
|
34
|
-
crack (0.4.
|
35
|
-
|
36
|
-
diff-lcs (1.
|
37
|
-
docile (1.
|
38
|
-
faraday (
|
34
|
+
crack (0.4.5)
|
35
|
+
rexml
|
36
|
+
diff-lcs (1.4.4)
|
37
|
+
docile (1.4.0)
|
38
|
+
faraday (1.4.2)
|
39
|
+
faraday-em_http (~> 1.0)
|
40
|
+
faraday-em_synchrony (~> 1.0)
|
41
|
+
faraday-excon (~> 1.1)
|
42
|
+
faraday-net_http (~> 1.0)
|
43
|
+
faraday-net_http_persistent (~> 1.1)
|
39
44
|
multipart-post (>= 1.2, < 3)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
45
|
+
ruby2_keywords (>= 0.0.4)
|
46
|
+
faraday-em_http (1.0.0)
|
47
|
+
faraday-em_synchrony (1.0.0)
|
48
|
+
faraday-excon (1.1.0)
|
49
|
+
faraday-net_http (1.0.1)
|
50
|
+
faraday-net_http_persistent (1.1.0)
|
51
|
+
faraday_middleware (1.0.0)
|
52
|
+
faraday (~> 1.0)
|
53
|
+
hashdiff (1.0.1)
|
54
|
+
hashie (4.1.0)
|
44
55
|
htmlentities (4.3.4)
|
45
|
-
|
46
|
-
|
56
|
+
io-console (0.5.9)
|
57
|
+
irb (1.3.5)
|
58
|
+
reline (>= 0.1.5)
|
59
|
+
json (2.5.1)
|
47
60
|
mediawiktory (0.1.3)
|
48
61
|
addressable
|
49
62
|
faraday
|
@@ -51,80 +64,89 @@ GEM
|
|
51
64
|
hashie
|
52
65
|
naught
|
53
66
|
nokogiri
|
54
|
-
mini_portile2 (2.4.0)
|
55
67
|
multipart-post (2.1.1)
|
56
68
|
naught (1.1.0)
|
57
|
-
nokogiri (1.
|
58
|
-
|
59
|
-
parallel (1.
|
60
|
-
parser (
|
61
|
-
ast (~> 2.4.
|
62
|
-
|
63
|
-
|
69
|
+
nokogiri (1.11.6-x86_64-linux)
|
70
|
+
racc (~> 1.4)
|
71
|
+
parallel (1.20.1)
|
72
|
+
parser (3.0.1.1)
|
73
|
+
ast (~> 2.4.1)
|
74
|
+
public_suffix (4.0.6)
|
75
|
+
racc (1.5.2)
|
64
76
|
rainbow (3.0.0)
|
65
|
-
rake (
|
66
|
-
redcarpet (3.
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
rspec
|
73
|
-
rspec-
|
74
|
-
|
77
|
+
rake (13.0.3)
|
78
|
+
redcarpet (3.5.1)
|
79
|
+
regexp_parser (2.1.1)
|
80
|
+
reline (0.2.5)
|
81
|
+
io-console (~> 0.5)
|
82
|
+
rexml (3.2.5)
|
83
|
+
rouge (3.26.0)
|
84
|
+
rspec (3.10.0)
|
85
|
+
rspec-core (~> 3.10.0)
|
86
|
+
rspec-expectations (~> 3.10.0)
|
87
|
+
rspec-mocks (~> 3.10.0)
|
88
|
+
rspec-core (3.10.1)
|
89
|
+
rspec-support (~> 3.10.0)
|
90
|
+
rspec-expectations (3.10.1)
|
75
91
|
diff-lcs (>= 1.2.0, < 2.0)
|
76
|
-
rspec-support (~> 3.
|
77
|
-
rspec-its (1.
|
92
|
+
rspec-support (~> 3.10.0)
|
93
|
+
rspec-its (1.3.0)
|
78
94
|
rspec-core (>= 3.0.0)
|
79
95
|
rspec-expectations (>= 3.0.0)
|
80
|
-
rspec-mocks (3.
|
96
|
+
rspec-mocks (3.10.2)
|
81
97
|
diff-lcs (>= 1.2.0, < 2.0)
|
82
|
-
rspec-support (~> 3.
|
83
|
-
rspec-support (3.
|
84
|
-
rubocop (
|
98
|
+
rspec-support (~> 3.10.0)
|
99
|
+
rspec-support (3.10.2)
|
100
|
+
rubocop (1.15.0)
|
85
101
|
parallel (~> 1.10)
|
86
|
-
parser (>=
|
87
|
-
powerpack (~> 0.1)
|
102
|
+
parser (>= 3.0.0.0)
|
88
103
|
rainbow (>= 2.2.2, < 4.0)
|
104
|
+
regexp_parser (>= 1.8, < 3.0)
|
105
|
+
rexml
|
106
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
89
107
|
ruby-progressbar (~> 1.7)
|
90
|
-
unicode-display_width (
|
91
|
-
rubocop-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
108
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
109
|
+
rubocop-ast (1.7.0)
|
110
|
+
parser (>= 3.0.1.1)
|
111
|
+
rubocop-rspec (2.3.0)
|
112
|
+
rubocop (~> 1.0)
|
113
|
+
rubocop-ast (>= 1.1.0)
|
114
|
+
ruby-prof (1.4.3)
|
115
|
+
ruby-progressbar (1.11.0)
|
116
|
+
ruby2_keywords (0.0.4)
|
117
|
+
rubygems-tasks (0.2.5)
|
118
|
+
irb (~> 1.0)
|
97
119
|
saharspec (0.0.4)
|
98
|
-
simplecov (0.
|
99
|
-
docile (~> 1.1
|
120
|
+
simplecov (0.16.1)
|
121
|
+
docile (~> 1.1)
|
100
122
|
json (>= 1.8, < 3)
|
101
123
|
simplecov-html (~> 0.10.0)
|
102
|
-
simplecov-html (0.10.
|
124
|
+
simplecov-html (0.10.2)
|
103
125
|
slop (3.6.0)
|
104
|
-
|
126
|
+
sync (0.5.0)
|
127
|
+
term-ansicolor (1.7.1)
|
105
128
|
tins (~> 1.0)
|
106
|
-
terminal-table (
|
107
|
-
unicode-display_width (
|
108
|
-
thor (
|
109
|
-
timecop (0.9.
|
110
|
-
tins (1.
|
111
|
-
|
112
|
-
unicode-display_width (
|
113
|
-
vcr (
|
114
|
-
webmock (3.0
|
129
|
+
terminal-table (3.0.1)
|
130
|
+
unicode-display_width (>= 1.1.1, < 3)
|
131
|
+
thor (1.1.0)
|
132
|
+
timecop (0.9.4)
|
133
|
+
tins (1.29.1)
|
134
|
+
sync
|
135
|
+
unicode-display_width (2.0.0)
|
136
|
+
vcr (6.0.0)
|
137
|
+
webmock (3.13.0)
|
115
138
|
addressable (>= 2.3.6)
|
116
139
|
crack (>= 0.3.2)
|
117
|
-
hashdiff
|
118
|
-
yard (0.9.
|
119
|
-
yard-junk (0.0.
|
120
|
-
backports
|
140
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
141
|
+
yard (0.9.26)
|
142
|
+
yard-junk (0.0.9)
|
143
|
+
backports (>= 3.18)
|
121
144
|
rainbow
|
122
|
-
tty-color
|
123
145
|
yard
|
124
146
|
|
125
147
|
PLATFORMS
|
126
|
-
java
|
127
148
|
ruby
|
149
|
+
x86_64-linux
|
128
150
|
|
129
151
|
DEPENDENCIES
|
130
152
|
byebug
|
@@ -135,8 +157,8 @@ DEPENDENCIES
|
|
135
157
|
redcarpet
|
136
158
|
rspec (~> 3)
|
137
159
|
rspec-its (~> 1)
|
138
|
-
rubocop (~>
|
139
|
-
rubocop-rspec (~>
|
160
|
+
rubocop (~> 1.15.0)
|
161
|
+
rubocop-rspec (~> 2.3.0)
|
140
162
|
ruby-prof
|
141
163
|
rubygems-tasks
|
142
164
|
saharspec (= 0.0.4)
|
@@ -147,4 +169,4 @@ DEPENDENCIES
|
|
147
169
|
yard-junk (~> 0.0.7)
|
148
170
|
|
149
171
|
BUNDLED WITH
|
150
|
-
|
172
|
+
2.2.0
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Infoboxer
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/infoboxer.svg)](http://badge.fury.io/rb/infoboxer)
|
4
|
-
|
4
|
+
![Build Status](https://github.com/molybdenum-99/infoboxer/workflows/CI/badge.svg?branch=master)
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/molybdenum-99/infoboxer/badge.svg?branch=master&service=github)](https://coveralls.io/github/molybdenum-99/infoboxer?branch=master)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/molybdenum-99/infoboxer/badges/gpa.svg)](https://codeclimate.com/github/molybdenum-99/infoboxer)
|
7
7
|
[![Infoboxer Gitter](https://badges.gitter.im/molybdenum-99/infoboxer.svg)](https://gitter.im/molybdenum-99/infoboxer)
|
data/lib/infoboxer.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Main client module for entire infoboxer functionality. If you're lucky,
|
2
4
|
# there's no other classes/modules you need to instantiate or call
|
3
5
|
# directly. You just do:
|
@@ -45,7 +47,7 @@
|
|
45
47
|
#
|
46
48
|
module Infoboxer
|
47
49
|
# @private
|
48
|
-
WIKIA_API_URL = 'http://%s.wikia.com/api.php'
|
50
|
+
WIKIA_API_URL = 'http://%s.wikia.com/api.php'
|
49
51
|
|
50
52
|
WIKIMEDIA_PROJECTS = {
|
51
53
|
wikipedia: 'wikipedia.org',
|
@@ -69,10 +71,10 @@ module Infoboxer
|
|
69
71
|
|
70
72
|
# Includeable version of {Infoboxer.wiki}
|
71
73
|
def wiki(api_url, **options)
|
72
|
-
wikis[api_url] ||= MediaWiki.new(api_url, options)
|
74
|
+
wikis[api_url] ||= MediaWiki.new(api_url, **options)
|
73
75
|
end
|
74
76
|
|
75
|
-
class << self
|
77
|
+
class << self # rubocop:disable Lint/EmptyClass -- that's for YARD!
|
76
78
|
# @!method wiki(api_url, options = {})
|
77
79
|
# Default method for creating MediaWiki API client.
|
78
80
|
#
|
@@ -167,7 +169,7 @@ module Infoboxer
|
|
167
169
|
define_method name do |lang = 'en', **options|
|
168
170
|
lang, options = 'en', lang if lang.is_a?(Hash)
|
169
171
|
|
170
|
-
wiki("https://#{lang}.#{domain}/w/api.php", options)
|
172
|
+
wiki("https://#{lang}.#{domain}/w/api.php", **options)
|
171
173
|
end
|
172
174
|
end
|
173
175
|
|
@@ -226,7 +228,7 @@ module Infoboxer
|
|
226
228
|
# Includeable version of {Infoboxer.wikia}
|
227
229
|
def wikia(*domains)
|
228
230
|
options = domains.last.is_a?(Hash) ? domains.pop : {}
|
229
|
-
wiki(WIKIA_API_URL % domains.reverse.join('.'), options)
|
231
|
+
wiki(WIKIA_API_URL % domains.reverse.join('.'), **options)
|
230
232
|
end
|
231
233
|
|
232
234
|
# Sets user agent string globally. Default user agent is
|
data/lib/infoboxer/core_ext.rb
CHANGED
data/lib/infoboxer/media_wiki.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'mediawiktory'
|
2
4
|
require 'addressable/uri'
|
3
5
|
|
@@ -25,7 +27,7 @@ module Infoboxer
|
|
25
27
|
# You can set yours as an option to {Infoboxer.wiki} and its shortcuts,
|
26
28
|
# or to {#initialize}
|
27
29
|
UA = "Infoboxer/#{Infoboxer::VERSION} "\
|
28
|
-
'(https://github.com/molybdenum-99/infoboxer; zverok.offline@gmail.com)'
|
30
|
+
'(https://github.com/molybdenum-99/infoboxer; zverok.offline@gmail.com)'
|
29
31
|
|
30
32
|
class << self
|
31
33
|
# User agent getter/setter.
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Infoboxer
|
2
4
|
class MediaWiki
|
3
5
|
# DSL for defining "traits" for some site.
|
@@ -57,7 +59,7 @@ module Infoboxer
|
|
57
59
|
# [English Wikipedia traits](https://github.com/molybdenum-99/infoboxer/blob/master/lib/infoboxer/definitions/en.wikipedia.org.rb)
|
58
60
|
# for example implementation.
|
59
61
|
def for(domain, &block)
|
60
|
-
Traits.domains[domain]
|
62
|
+
Traits.domains[domain]&.instance_eval(&block) ||
|
61
63
|
Class.new(self, &block).domain(domain)
|
62
64
|
end
|
63
65
|
|
@@ -114,6 +116,7 @@ module Infoboxer
|
|
114
116
|
|
115
117
|
def ns_aliases(base)
|
116
118
|
return [base] if @site_info.empty?
|
119
|
+
|
117
120
|
main = @site_info['namespaces'].values.detect { |n| n['canonical'] == base }
|
118
121
|
[base, main['*']] +
|
119
122
|
@site_info['namespacealiases']
|
data/lib/infoboxer/navigation.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'selector'
|
2
4
|
|
3
5
|
module Infoboxer
|
@@ -157,11 +159,10 @@ module Infoboxer
|
|
157
159
|
]
|
158
160
|
.map { |sym| [sym, :"_#{sym}"] }
|
159
161
|
.each do |sym, underscored|
|
160
|
-
|
161
|
-
|
162
|
-
|
162
|
+
define_method(sym) do |*args, &block|
|
163
|
+
send(underscored, Selector.new(*args, &block))
|
164
|
+
end
|
163
165
|
end
|
164
|
-
end
|
165
166
|
|
166
167
|
# Checks if node has any parent matching selectors.
|
167
168
|
def parent?(*selectors, &block)
|
@@ -217,7 +218,6 @@ module Infoboxer
|
|
217
218
|
lookup_siblings
|
218
219
|
lookup_next_siblings lookup_prev_siblings
|
219
220
|
].map { |sym| [sym, :"_#{sym}"] }.each do |sym, underscored|
|
220
|
-
|
221
221
|
define_method(sym) do |*args, &block|
|
222
222
|
send(underscored, Selector.new(*args, &block))
|
223
223
|
end
|