Module: MediaWiktory::Wikipedia::Modules::Extracts
- Defined in:
- lib/mediawiktory/wikipedia/modules/extracts.rb
Overview
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 Actions::Query and its submodules):
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.
Instance Method Summary collapse
-
#chars(value) ⇒ self
How many characters to return.
-
#continue(value) ⇒ self
When more results are available, use this to continue.
-
#intro ⇒ self
Return only content before the first section.
-
#limit(value) ⇒ self
How many extracts to return.
-
#plaintext ⇒ self
Return extracts as plain text instead of limited HTML.
-
#sectionformat(value) ⇒ self
How to format sections in plaintext mode:.
-
#sentences(value) ⇒ self
How many sentences to return.
Instance Method Details
#chars(value) ⇒ self
How many characters to return. Actual text returned might be slightly longer.
25 26 27 |
# File 'lib/mediawiktory/wikipedia/modules/extracts.rb', line 25 def chars(value) merge(exchars: value.to_s) end |
#continue(value) ⇒ self
When more results are available, use this to continue.
76 77 78 |
# File 'lib/mediawiktory/wikipedia/modules/extracts.rb', line 76 def continue(value) merge(excontinue: value.to_s) end |
#intro ⇒ self
Return only content before the first section.
48 49 50 |
# File 'lib/mediawiktory/wikipedia/modules/extracts.rb', line 48 def intro() merge(exintro: 'true') end |
#limit(value) ⇒ self
How many extracts to return. (Multiple extracts can only be returned if exintro is set to true.)
41 42 43 |
# File 'lib/mediawiktory/wikipedia/modules/extracts.rb', line 41 def limit(value) merge(exlimit: value.to_s) end |
#plaintext ⇒ self
Return extracts as plain text instead of limited HTML.
55 56 57 |
# File 'lib/mediawiktory/wikipedia/modules/extracts.rb', line 55 def plaintext() merge(explaintext: 'true') end |
#sectionformat(value) ⇒ self
How to format sections in plaintext mode:
63 64 65 |
# File 'lib/mediawiktory/wikipedia/modules/extracts.rb', line 63 def sectionformat(value) _sectionformat(value) or fail ArgumentError, "Unknown value for sectionformat: #{value}" end |
#sentences(value) ⇒ self
How many sentences to return.
33 34 35 |
# File 'lib/mediawiktory/wikipedia/modules/extracts.rb', line 33 def sentences(value) merge(exsentences: value.to_s) end |