module MediaWiktory::Wikipedia::Modules::Extracts
Returns plain-text or limited HTML extracts of the given pages.
The “submodule” (MediaWiki API term) is included in action after setting some param, providing additional tweaking for this param. Example (for {MediaWiktory::Wikipedia::Actions::Query} and its submodules):
“`ruby api.query # returns Actions::Query
.prop(:revisions) # adds prop=revisions to action URL, and includes Modules::Revisions into action .limit(10) # method of Modules::Revisions, adds rvlimit=10 to URL
“`
All submodule's parameters are documented as its public methods, see below.
Public Instance Methods
@private
# File lib/mediawiktory/wikipedia/modules/extracts.rb, line 68 def _sectionformat(value) defined?(super) && super || ["plain", "wiki", "raw"].include?(value.to_s) && merge(exsectionformat: value.to_s) end
How many characters to return. Actual text returned might be slightly longer.
@param value [Integer] @return [self]
# File lib/mediawiktory/wikipedia/modules/extracts.rb, line 25 def chars(value) merge(exchars: value.to_s) end
When more results are available, use this to continue.
@param value [Integer] @return [self]
# File lib/mediawiktory/wikipedia/modules/extracts.rb, line 76 def continue(value) merge(excontinue: value.to_s) end
Return only content before the first section.
@return [self]
# File lib/mediawiktory/wikipedia/modules/extracts.rb, line 48 def intro() merge(exintro: 'true') end
How many extracts to return. (Multiple extracts can only be returned if exintro is set to true.)
@param value [Integer, “max”] @return [self]
# File lib/mediawiktory/wikipedia/modules/extracts.rb, line 41 def limit(value) merge(exlimit: value.to_s) end
Return extracts as plain text instead of limited HTML.
@return [self]
# File lib/mediawiktory/wikipedia/modules/extracts.rb, line 55 def plaintext() merge(explaintext: 'true') end
How to format sections in plaintext mode:
@param value [String] One of “plain” (No formatting), “wiki” (Wikitext-style formatting (== like this ==)), “raw” (This module's internal representation (section titles prefixed with <ASCII 1><ASCII 2><section level><ASCII 2><ASCII 1>)). @return [self]
# File lib/mediawiktory/wikipedia/modules/extracts.rb, line 63 def sectionformat(value) _sectionformat(value) or fail ArgumentError, "Unknown value for sectionformat: #{value}" end
How many sentences to return.
@param value [Integer] @return [self]
# File lib/mediawiktory/wikipedia/modules/extracts.rb, line 33 def sentences(value) merge(exsentences: value.to_s) end