wikiscript 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NOTES.md +22 -5
- data/lib/wikiscript.rb +1 -0
- data/lib/wikiscript/page.rb +16 -4
- data/lib/wikiscript/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa972f9f2c4580091fb3dac93cf76f94f6054ba1
|
4
|
+
data.tar.gz: 138954a7a0281032b68aae0f29b9d239c9f7f90a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74af5f6bd6b915a1887d9022763294f0e6e634415d1bbdf3b18ae9fc0f9a11b01812b904a42a4ed687a60cafbd50230afd8a804dab8bb6a8b28475f99437be2b
|
7
|
+
data.tar.gz: 44f92623eb560825a834de570b8cfc604a92bfb907b38c2390b2d3a52cc74bcf8f229d21369c27bd73c0b99a9db9c65f5df3bf9b6d304e9876694135e7517ddc
|
data/NOTES.md
CHANGED
@@ -3,15 +3,15 @@
|
|
3
3
|
|
4
4
|
## Alternatives
|
5
5
|
|
6
|
+
Wikipedia
|
6
7
|
|
7
|
-
|
8
|
-
- [wikipedia-client](https://rubygems.org/gems/wikipedia-client) - by Ken Pratt et al - ruby client for the Wikipedia API
|
8
|
+
- [wikipedia-client](https://rubygems.org/gems/wikipedia-client) by Ken Pratt et al - ruby client for the Wikipedia API
|
9
9
|
- <https://github.com/kenpratt/wikipedia-client>
|
10
10
|
- <https://www.rubydoc.info/gems/wikipedia-client>
|
11
11
|
|
12
12
|
<!-- break -->
|
13
13
|
|
14
|
-
- [infoboxer](https://rubygems.org/gems/infoboxer)
|
14
|
+
- [infoboxer](https://rubygems.org/gems/infoboxer) by Victor Shepelev et al - pure-Ruby Wikipedia (and generic MediaWiki) client and parser, targeting information extraction
|
15
15
|
- <https://github.com/molybdenum-99/infoboxer>
|
16
16
|
- <https://www.rubydoc.info/gems/infoboxer>
|
17
17
|
|
@@ -22,6 +22,25 @@ More
|
|
22
22
|
- <https://github.com/molybdenum-99/reality>
|
23
23
|
- https://github.com/molybdenum-99/mediawiktory
|
24
24
|
|
25
|
+
|
26
|
+
Wikidata
|
27
|
+
|
28
|
+
- [wikidata](https://rubygems.org/gems/wikidata) by Wil Gieseler
|
29
|
+
- <https://github.com/wilg/wikidata>
|
30
|
+
- <https://www.rubydoc.info/gems/wikidata>
|
31
|
+
|
32
|
+
<!-- break -->
|
33
|
+
|
34
|
+
- [wikidata-fetcher](https://rubygems.org/gems/wikidata-fetcher)
|
35
|
+
- <https://github.com/everypolitician/wikidata-fetcher>
|
36
|
+
|
37
|
+
<!-- break -->
|
38
|
+
|
39
|
+
- [mediawiki_api-wikidata](https://rubygems.org/gems/mediawiki_api-wikidata)
|
40
|
+
- <https://github.com/wmde/WikidataApiGem>
|
41
|
+
|
42
|
+
|
43
|
+
|
25
44
|
**Python**
|
26
45
|
|
27
46
|
- <https://pypi.org/project/wptools/> - Wikipedia tools (for Humans)
|
@@ -31,5 +50,3 @@ More
|
|
31
50
|
## Wikipedia
|
32
51
|
|
33
52
|
- Wikipedia API reference: <http://en.wikipedia.org/w/api.php>
|
34
|
-
|
35
|
-
|
data/lib/wikiscript.rb
CHANGED
@@ -92,6 +92,7 @@ module Wikiscript
|
|
92
92
|
def self.parse( text ) PageReader.parse( text ); end
|
93
93
|
def self.parse_table( text ) TableReader.parse_table( text ); end
|
94
94
|
|
95
|
+
def self.read( path ) Page.read( path ); end
|
95
96
|
def self.get( title, lang: Wikiscript.lang ) Page.get( title, lang: lang ); end
|
96
97
|
class << self
|
97
98
|
alias_method :fetch, :get
|
data/lib/wikiscript/page.rb
CHANGED
@@ -11,7 +11,13 @@ module Wikiscript
|
|
11
11
|
|
12
12
|
def self.get( title, lang: Wikiscript.lang ) ## todo/check: add a fetch/download alias - why? why not?
|
13
13
|
o = new( title: title, lang: lang )
|
14
|
-
|
14
|
+
o.get ## "force" refresh text (get/fetch/download)
|
15
|
+
o
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.read( path )
|
19
|
+
text = File.open( path, 'r:utf-8' ).read
|
20
|
+
o = new( text, title: "File:#{path}" ) ## use auto-generated File:<path> title path - why? why not?
|
15
21
|
o
|
16
22
|
end
|
17
23
|
|
@@ -27,12 +33,18 @@ module Wikiscript
|
|
27
33
|
end
|
28
34
|
|
29
35
|
def text
|
30
|
-
@text ||=
|
36
|
+
@text ||= get # cache text (from request)
|
31
37
|
end
|
32
38
|
|
33
|
-
|
34
|
-
|
39
|
+
|
40
|
+
def get ## "force" refresh text (get/fetch/download)
|
41
|
+
@text = Client.new.text( @title, lang: @lang )
|
42
|
+
@text
|
35
43
|
end
|
44
|
+
alias_method :fetch, :get
|
45
|
+
alias_method :download, :get
|
46
|
+
|
47
|
+
|
36
48
|
|
37
49
|
def parse ## todo/change: use/find a different name e.g. doc/elements/etc. - why? why not?
|
38
50
|
PageReader.parse( text )
|
data/lib/wikiscript/version.rb
CHANGED