infoboxer 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/bin/infoboxer +1 -1
- data/lib/infoboxer/media_wiki.rb +7 -2
- data/lib/infoboxer/media_wiki/mediawiktory_patch.rb +3 -5
- data/lib/infoboxer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9b19c697cee8b3687f6be2750819cbd38c91508
|
4
|
+
data.tar.gz: 7db684f6b8b1bd1c0fff88c8a41240844fe0bda3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fb2a48e19eb445575f4bc3a622cee4b8a1e7567211d6e936cb5ddd150f0a12930a58e32ec16a658154b799dc4585d6bb3b7700decdf3bdda4d600f9455fc969
|
7
|
+
data.tar.gz: d5583aefd5734b8ae694e4d33d0b0a522349ae3a3df17d8b5ff1d7513576de3e073cd7c8b5a28026cd0ef3521375161df65cfc89dad43caff8190fd3ee48163d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Infoboxer's change log
|
2
2
|
|
3
|
+
## 0.2.4 (2016-04-16)
|
4
|
+
|
5
|
+
* `MediaWiki#get_h` works correctly with several synonymous pages now;
|
6
|
+
* `get` and `get_h` work better when some of required titles are downcase;
|
7
|
+
* Travis compatibility check restored.
|
8
|
+
|
3
9
|
## 0.2.3 (2016-03-02)
|
4
10
|
|
5
11
|
New and enchanced features:
|
data/bin/infoboxer
CHANGED
@@ -31,7 +31,7 @@ if wiki_url
|
|
31
31
|
|
32
32
|
DEFAULT_WIKI = Infoboxer.wiki(wiki_url)
|
33
33
|
puts "Default Wiki selected: #{wiki_url}.\nNow you can use `get('Pagename')`, `category('Categoryname')` and so on.\n\n"
|
34
|
-
[:raw, :get, :category, :search, :prefixsearch].each do |m|
|
34
|
+
[:raw, :get, :get_h, :category, :search, :prefixsearch].each do |m|
|
35
35
|
define_method(m){|*arg|
|
36
36
|
DEFAULT_WIKI.send(m, *arg)
|
37
37
|
}
|
data/lib/infoboxer/media_wiki.rb
CHANGED
@@ -60,6 +60,8 @@ module Infoboxer
|
|
60
60
|
#
|
61
61
|
# @return [Array<Hash>]
|
62
62
|
def raw(*titles)
|
63
|
+
return [] if titles.empty? # could emerge on "automatically" created page lists, should work
|
64
|
+
|
63
65
|
titles.each_slice(50).map{|part|
|
64
66
|
@client.query.
|
65
67
|
titles(*part).
|
@@ -67,7 +69,10 @@ module Infoboxer
|
|
67
69
|
redirects(true). # FIXME: should be done transparently by MediaWiktory?
|
68
70
|
perform.pages
|
69
71
|
}.inject(:concat). # somehow flatten(1) fails!
|
70
|
-
sort_by{|page|
|
72
|
+
sort_by{|page|
|
73
|
+
res_title = page.alt_titles.detect{|t| titles.map(&:downcase).include?(t.downcase)} # FIXME?..
|
74
|
+
titles.index(res_title) || 1_000
|
75
|
+
}
|
71
76
|
end
|
72
77
|
|
73
78
|
# Receive list of parsed MediaWiki pages for list of titles provided.
|
@@ -123,7 +128,7 @@ module Infoboxer
|
|
123
128
|
def get_h(*titles)
|
124
129
|
pages = [*get(*titles)]
|
125
130
|
titles.map{|t|
|
126
|
-
[t, pages.detect{|p| p.source.
|
131
|
+
[t, pages.detect{|p| p.source.alt_titles.map(&:downcase).include?(t.downcase)}]
|
127
132
|
}.to_h
|
128
133
|
end
|
129
134
|
|
@@ -3,10 +3,8 @@ require 'mediawiktory'
|
|
3
3
|
# FIXME: looks like pretty "core" functionality and should moved to mediawiktory itself
|
4
4
|
|
5
5
|
class MediaWiktory::Page
|
6
|
-
|
7
|
-
|
8
|
-
def queried_title
|
9
|
-
@queried_title || title
|
6
|
+
def alt_titles
|
7
|
+
@alt_titles ||= [title]
|
10
8
|
end
|
11
9
|
end
|
12
10
|
|
@@ -18,7 +16,7 @@ class MediaWiktory::Query::Response
|
|
18
16
|
if raw.query.redirects
|
19
17
|
raw.query.redirects.each do |redirect|
|
20
18
|
pg = @pages.detect{|p| p.title == redirect.to} or next
|
21
|
-
pg.
|
19
|
+
pg.alt_titles << redirect.from
|
22
20
|
end
|
23
21
|
end
|
24
22
|
end
|
data/lib/infoboxer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infoboxer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Shepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|