Module: Infoboxer
- Defined in:
- lib/infoboxer.rb,
lib/infoboxer/tree.rb,
lib/infoboxer/parser.rb,
lib/infoboxer/version.rb,
lib/infoboxer/tree/ref.rb,
lib/infoboxer/templates.rb,
lib/infoboxer/tree/html.rb,
lib/infoboxer/tree/list.rb,
lib/infoboxer/tree/node.rb,
lib/infoboxer/tree/text.rb,
lib/infoboxer/media_wiki.rb,
lib/infoboxer/navigation.rb,
lib/infoboxer/tree/image.rb,
lib/infoboxer/tree/nodes.rb,
lib/infoboxer/tree/table.rb,
lib/infoboxer/parser/html.rb,
lib/infoboxer/parser/util.rb,
lib/infoboxer/tree/inline.rb,
lib/infoboxer/parser/image.rb,
lib/infoboxer/parser/table.rb,
lib/infoboxer/parser/inline.rb,
lib/infoboxer/templates/set.rb,
lib/infoboxer/tree/compound.rb,
lib/infoboxer/tree/document.rb,
lib/infoboxer/tree/linkable.rb,
lib/infoboxer/tree/template.rb,
lib/infoboxer/tree/wikilink.rb,
lib/infoboxer/parser/context.rb,
lib/infoboxer/templates/base.rb,
lib/infoboxer/media_wiki/page.rb,
lib/infoboxer/parser/template.rb,
lib/infoboxer/tree/paragraphs.rb,
lib/infoboxer/media_wiki/traits.rb,
lib/infoboxer/navigation/lookup.rb,
lib/infoboxer/parser/paragraphs.rb,
lib/infoboxer/navigation/sections.rb,
lib/infoboxer/navigation/selector.rb,
lib/infoboxer/navigation/shortcuts.rb,
lib/infoboxer/definitions/en.wikipedia.org.rb
Overview
Main client module for entire infoboxer functionality. If you're lucky, there's no other classes/modules you need to instantiate or call directly. You just do:
Infoboxer.wp.get('List of radio telescopes')
# or
Infoboxer.wikiquote.get('Vonnegut')
...and have fully navigable Wiki information.
Please read wiki for extensive showcases and usage recommendations.
Here's main components list, which also can serve as a TOC for Infoboxer's functionality (we suggest to read their docs in this order):
- Tree -- nodes, of which Wikipedia AST is consisting; you'll be interested in basic Tree::Node functionality, as well as node classes list (which is useful for navigation);
- Navigation -- how to navigate the tree you have, basic way (children, parents, siblings) and hi-level shortcuts way (like all unnumbered list items in second level-3 section);
- Templates -- the most advanced data extraction from wikipedia definitely needs your undestanding of this (rather complicated) topic.
You also may be interested in (though may be never need to use them directly):
Defined Under Namespace
Modules: Navigation, Templates, Tree Classes: MediaWiki, Parser
Constant Summary collapse
- VERSION =
'0.1.1'
Class Method Summary collapse
-
.commons(options = {}) ⇒ MediaWiki
Shortcut for creating WikiMedia Commons client.
-
.species(options = {}) ⇒ MediaWiki
Shortcut for creating Wikispecies client.
-
.user_agent=(ua) ⇒ Object
Sets user agent string globally.
-
.wiki(api_url, options = {}) ⇒ MediaWiki
Default method for creating MediaWiki API client.
-
.wikia(*domains) ⇒ MediaWiki
Performs request to wikia.com wikis.
-
.wikibooks(lang = 'en', options = {}) ⇒ MediaWiki
Shortcut for creating Wikibooks client.
-
.wikinews(lang = 'en', options = {}) ⇒ MediaWiki
Shortcut for creating Wikinews client.
-
.wikipedia(lang = 'en', options = {}) ⇒ MediaWiki
(also: wp)
Shortcut for creating Wikipedia client.
-
.wikiquote(lang = 'en', options = {}) ⇒ MediaWiki
Shortcut for creating Wikiquote client.
-
.wikisource(lang = 'en', options = {}) ⇒ MediaWiki
Shortcut for creating Wikisource client.
-
.wikiversity(lang = 'en', options = {}) ⇒ MediaWiki
Shortcut for creating Wikiversity client.
-
.wikivoyage(lang = 'en', options = {}) ⇒ MediaWiki
Shortcut for creating Wikivoyage client.
-
.wiktionary(lang = 'en', options = {}) ⇒ MediaWiki
Shortcut for creating Wiktionary client.
Class Method Details
.commons(options = {}) ⇒ MediaWiki
Shortcut for creating WikiMedia Commons client.
|
# File 'lib/infoboxer.rb', line 84
|
.species(options = {}) ⇒ MediaWiki
Shortcut for creating Wikispecies client.
|
# File 'lib/infoboxer.rb', line 120
|
.user_agent=(ua) ⇒ Object
Sets user agent string globally. Default user agent is Infoboxer::MediaWiki::UA.
User agent can also be rewriten as an option to wiki method (and its shortcuts like wikipedia), or by using Infoboxer::MediaWiki#initialize explicitly.
180 181 182 |
# File 'lib/infoboxer.rb', line 180 def user_agent=(ua) MediaWiki.user_agent = ua end |
.wiki(api_url, options = {}) ⇒ MediaWiki
Default method for creating MediaWiki API client.
73 74 75 |
# File 'lib/infoboxer.rb', line 73 def wiki(api_url, = {}) MediaWiki.new(api_url, || {}) end |
.wikia(*domains) ⇒ MediaWiki .wikia(*domains, options) ⇒ MediaWiki
Performs request to wikia.com wikis.
168 169 170 171 |
# File 'lib/infoboxer.rb', line 168 def wikia(*domains) = domains.last.is_a?(Hash) ? domains.pop : {} wiki(WIKIA_API_URL % domains.reverse.join('.'), ) end |
.wikibooks(lang = 'en', options = {}) ⇒ MediaWiki
|
# File 'lib/infoboxer.rb', line 90
|
.wikinews(lang = 'en', options = {}) ⇒ MediaWiki
|
# File 'lib/infoboxer.rb', line 115
|
.wikipedia(lang = 'en', options = {}) ⇒ MediaWiki Also known as: wp
Shortcut for creating Wikipedia client.
|
# File 'lib/infoboxer.rb', line 77
|
.wikiquote(lang = 'en', options = {}) ⇒ MediaWiki
|
# File 'lib/infoboxer.rb', line 95
|
.wikisource(lang = 'en', options = {}) ⇒ MediaWiki
Shortcut for creating Wikisource client. See wikipedia for params explanation.
|
# File 'lib/infoboxer.rb', line 105
|
.wikiversity(lang = 'en', options = {}) ⇒ MediaWiki
Shortcut for creating Wikiversity client. See wikipedia for params explanation.
|
# File 'lib/infoboxer.rb', line 100
|
.wikivoyage(lang = 'en', options = {}) ⇒ MediaWiki
Shortcut for creating Wikivoyage client. See wikipedia for params explanation.
|
# File 'lib/infoboxer.rb', line 110
|
.wiktionary(lang = 'en', options = {}) ⇒ MediaWiki
Shortcut for creating Wiktionary client. See wikipedia for params explanation.
131 132 133 134 135 136 137 138 139 |
# File 'lib/infoboxer.rb', line 131 WIKIMEDIA_PROJECTS.each do |name, domain| define_method name do |lang = 'en', = {}| if lang.is_a?(Hash) lang, = 'en', lang end wiki("http://#{lang}.#{domain}/w/api.php", ) end end |