Class: MediaWiktory::Wikipedia::Actions::Visualeditor

Inherits:
Get
  • Object
show all
Defined in:
lib/mediawiktory/wikipedia/actions/visualeditor.rb

Overview

Returns HTML5 for a page from the Parsoid service.

Usage:

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 Response for working with action responses.

All action's parameters are documented as its public methods, see below.

Instance Method Summary collapse

Methods inherited from Get

#perform

Methods inherited from Base

#inspect, #merge, #name, #perform, #response, #to_h, #to_param, #to_url

Methods included from GlobalParams

#assert, #assertuser, #centralauthtoken, #curtimestamp, #errorformat, #errorlang, #errorsuselocal, #maxage, #maxlag, #origin, #requestid, #responselanginfo, #servedby, #smaxage, #uselang

Instance Method Details

#editintro(value) ⇒ self

Edit intro to add to notices.

Parameters:

  • value (String)

Returns:

  • (self)


84
85
86
# File 'lib/mediawiktory/wikipedia/actions/visualeditor.rb', line 84

def editintro(value)
  merge(editintro: value.to_s)
end

#format(value) ⇒ self

Parameters:

  • value (String)

    One of "json", "jsonfm".

Returns:

  • (self)


34
35
36
# 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) ⇒ self

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

Parameters:

  • value (String)

Returns:

  • (self)


76
77
78
# File 'lib/mediawiktory/wikipedia/actions/visualeditor.rb', line 76

def oldid(value)
  merge(oldid: value.to_s)
end

#paction(value) ⇒ self

Action to perform.

Parameters:

  • value (String)

    One of "parse", "metadata", "wikitext", "parsefragment", "getlanglinks".

Returns:

  • (self)


47
48
49
# 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) ⇒ self

The page to perform actions on.

Parameters:

  • value (String)

Returns:

  • (self)


26
27
28
# File 'lib/mediawiktory/wikipedia/actions/visualeditor.rb', line 26

def page(value)
  merge(page: value.to_s)
end

#pstself

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

Returns:

  • (self)


91
92
93
# File 'lib/mediawiktory/wikipedia/actions/visualeditor.rb', line 91

def pst()
  merge(pst: 'true')
end

#section(value) ⇒ self

The section on which to act.

Parameters:

  • value (String)

Returns:

  • (self)


68
69
70
# File 'lib/mediawiktory/wikipedia/actions/visualeditor.rb', line 68

def section(value)
  merge(section: value.to_s)
end

#wikitext(value) ⇒ self

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

Parameters:

  • value (String)

Returns:

  • (self)


60
61
62
# File 'lib/mediawiktory/wikipedia/actions/visualeditor.rb', line 60

def wikitext(value)
  merge(wikitext: value.to_s)
end