class MediaWiktory::Wikipedia::Actions::Visualeditor

Returns HTML5 for a page from the Parsoid service.

Usage:

“`ruby api.visualeditor.page(value).perform # returns string with raw output # or api.visualeditor.page(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

_format(value) click to toggle source

@private

Calls superclass method MediaWiktory::Wikipedia::Actions::GlobalParams#_format
# File lib/mediawiktory/wikipedia/actions/visualeditor.rb, line 39
def _format(value)
  defined?(super) && super || ["json", "jsonfm"].include?(value.to_s) && merge(format: value.to_s)
end
_paction(value) click to toggle source

@private

Calls superclass method
# File lib/mediawiktory/wikipedia/actions/visualeditor.rb, line 52
def _paction(value)
  defined?(super) && super || ["parse", "metadata", "wikitext", "parsefragment", "getlanglinks"].include?(value.to_s) && merge(paction: value.to_s)
end
editintro(value) click to toggle source

Edit intro to add to notices.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/visualeditor.rb, line 84
def editintro(value)
  merge(editintro: value.to_s)
end
format(value) click to toggle source

@param value [String] One of “json”, “jsonfm”. @return [self]

# File lib/mediawiktory/wikipedia/actions/visualeditor.rb, line 34
def format(value)
  _format(value) or fail ArgumentError, "Unknown value for format: #{value}"
end
oldid(value) click to toggle source

The revision number to use (defaults to latest revision).

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/visualeditor.rb, line 76
def oldid(value)
  merge(oldid: value.to_s)
end
paction(value) click to toggle source

Action to perform.

@param value [String] One of “parse”, “metadata”, “wikitext”, “parsefragment”, “getlanglinks”. @return [self]

# File lib/mediawiktory/wikipedia/actions/visualeditor.rb, line 47
def paction(value)
  _paction(value) or fail ArgumentError, "Unknown value for paction: #{value}"
end
page(value) click to toggle source

The page to perform actions on.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/visualeditor.rb, line 26
def page(value)
  merge(page: value.to_s)
end
pst() click to toggle source

Pre-save transform wikitext before sending it to Parsoid (paction=parsefragment).

@return [self]

# File lib/mediawiktory/wikipedia/actions/visualeditor.rb, line 91
def pst()
  merge(pst: 'true')
end
section(value) click to toggle source

The section on which to act.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/visualeditor.rb, line 68
def section(value)
  merge(section: value.to_s)
end
wikitext(value) click to toggle source

Wikitext to send to Parsoid to convert to HTML (paction=parsefragment).

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/visualeditor.rb, line 60
def wikitext(value)
  merge(wikitext: value.to_s)
end