class MediaWiktory::Wikipedia::Actions::Expandtemplates
Expands all templates within wikitext.
Usage:
“`ruby api.expandtemplates.title(value).perform # returns string with raw output # or api.expandtemplates.title(value).response # returns output parsed and wrapped into Response
object “`
See {Base} for generic explanation of working with MediaWiki actions and {MediaWiktory::Wikipedia::Response} for working with action responses.
All action's parameters are documented as its public methods, see below.
Public Instance Methods
@private
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 55 def _prop(value) defined?(super) && super || ["wikitext", "categories", "properties", "volatile", "ttl", "modules", "jsconfigvars", "encodedjsconfigvars", "parsetree"].include?(value.to_s) && merge(prop: value.to_s, replace: false) end
@private
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 124 def _templatesandboxcontentformat(value) defined?(super) && super || ["application/json", "text/x-wiki", "text/javascript", "text/css", "text/plain"].include?(value.to_s) && merge(templatesandboxcontentformat: value.to_s) end
@private
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 111 def _templatesandboxcontentmodel(value) defined?(super) && super || ["GadgetDefinition", "SecurePoll", "MassMessageListContent", "JsonSchema", "wikitext", "javascript", "json", "css", "text", "Scribunto"].include?(value.to_s) && merge(templatesandboxcontentmodel: value.to_s) end
@private
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 82 def _templatesandboxprefix(value) merge(templatesandboxprefix: value.to_s, replace: false) end
Generate XML parse tree (replaced by prop=parsetree).
@return [self]
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 69 def generatexml() merge(generatexml: 'true') end
Whether to include HTML comments in the output.
@return [self]
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 62 def includecomments() merge(includecomments: 'true') end
Which pieces of information to get.
@param values [Array<String>] Allowed values: “wikitext” (The expanded wikitext), “categories” (Any categories present in the input that are not represented in the wikitext output), “properties” (Page properties defined by expanded magic words in the wikitext), “volatile” (Whether the output is volatile and should not be reused elsewhere within the page), “ttl” (The maximum time after which caches of the result should be invalidated), “modules” (Any ResourceLoader modules that parser functions have requested be added to the output. Either jsconfigvars or encodedjsconfigvars must be requested jointly with modules), “jsconfigvars” (Gives the JavaScript configuration variables specific to the page), “encodedjsconfigvars” (Gives the JavaScript configuration variables specific to the page as a JSON string), “parsetree” (The XML parse tree of the input). @return [self]
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 50 def prop(*values) values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" } end
Revision ID, for {{REVISIONID}} and similar variables.
@param value [Integer] @return [self]
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 42 def revid(value) merge(revid: value.to_s) end
Content format of templatesandboxtext.
@param value [String] One of “application/json”, “text/x-wiki”, “text/javascript”, “text/css”, “text/plain”. @return [self]
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 119 def templatesandboxcontentformat(value) _templatesandboxcontentformat(value) or fail ArgumentError, "Unknown value for templatesandboxcontentformat: #{value}" end
Content model of templatesandboxtext.
@param value [String] One of “GadgetDefinition”, “SecurePoll”, “MassMessageListContent”, “JsonSchema”, “wikitext”, “javascript”, “json”, “css”, “text”, “Scribunto”. @return [self]
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 106 def templatesandboxcontentmodel(value) _templatesandboxcontentmodel(value) or fail ArgumentError, "Unknown value for templatesandboxcontentmodel: #{value}" end
Template sandbox prefix, as with Special:TemplateSandbox.
@param values [Array<String>] @return [self]
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 77 def templatesandboxprefix(*values) values.inject(self) { |res, val| res._templatesandboxprefix(val) } end
Parse
the page using this page content in place of the page named by templatesandboxtitle.
@param value [String] @return [self]
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 98 def templatesandboxtext(value) merge(templatesandboxtext: value.to_s) end
Parse
the page using templatesandboxtext in place of the contents of the page named here.
@param value [String] @return [self]
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 90 def templatesandboxtitle(value) merge(templatesandboxtitle: value.to_s) end
Wikitext to convert.
@param value [String] @return [self]
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 34 def text(value) merge(text: value.to_s) end
Title of page.
@param value [String] @return [self]
# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 26 def title(value) merge(title: value.to_s) end