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

_prop(value) click to toggle source

@private

Calls superclass method
# 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
_templatesandboxcontentformat(value) click to toggle source

@private

Calls superclass method
# 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
_templatesandboxcontentmodel(value) click to toggle source

@private

Calls superclass method
# 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
_templatesandboxprefix(value) click to toggle source

@private

# File lib/mediawiktory/wikipedia/actions/expandtemplates.rb, line 82
def _templatesandboxprefix(value)
  merge(templatesandboxprefix: value.to_s, replace: false)
end
generatexml() click to toggle source

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
includecomments() click to toggle source

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
prop(*values) click to toggle source

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
revid(value) click to toggle source

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
templatesandboxcontentformat(value) click to toggle source

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
templatesandboxcontentmodel(value) click to toggle source

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
templatesandboxprefix(*values) click to toggle source

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
templatesandboxtext(value) click to toggle source

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
templatesandboxtitle(value) click to toggle source

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
text(value) click to toggle source

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(value) click to toggle source

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