wikiscript 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe20e2b58b4703144ef8a83d1cb41edf92f5ef3e
4
- data.tar.gz: ae8a0d31b16099c33fee4ac450b27433852b8fb8
3
+ metadata.gz: aa972f9f2c4580091fb3dac93cf76f94f6054ba1
4
+ data.tar.gz: 138954a7a0281032b68aae0f29b9d239c9f7f90a
5
5
  SHA512:
6
- metadata.gz: 61fe785e9ea9150f6a5711ff0038cb135aba18f719abf26d6783bf50c465678f7376c315bcce3091b325d8ac9ca4714e084f93503e21dae583cddb9c904863d5
7
- data.tar.gz: c437c92ba5df517d21231060044ab690aba2b1b11a368d37018c65eb493cea467bbd3331f161f217c1764fc24025fcf97a57ab3889e5aa2fc6b53d57e460f13b
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) - by Victor Shepelev et al - pure-Ruby Wikipedia (and generic MediaWiki) client and parser, targeting information extraction
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
@@ -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
- ## o.text ## "force" download / fetch
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 ||= download_text # cache text (from request)
36
+ @text ||= get # cache text (from request)
31
37
  end
32
38
 
33
- def download_text
34
- Client.new.text( @title, lang: @lang )
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 )
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Wikiscript
3
- VERSION = '0.3.0'
3
+ VERSION = '0.3.1'
4
4
 
5
5
  def self.banner
6
6
  "wikiscript/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikiscript
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer