Ruby-MediaWiki/Documentation: Unterschied zwischen den Versionen

Aus C3D2
Wechseln zu: Navigation, Suche
(I can even document myself :-))
 
(I can even document myself :-))
Zeile 17: Zeile 17:
 
Delete this article
 
Delete this article
  
* '''reason:''' [String] Delete reason===MediaWiki::Article#protect===
+
* '''reason:''' [String] Delete reason
 +
===MediaWiki::Article#protect===
 
Protect this article
 
Protect this article
  
* '''reason:''' [String] Protect reason===MediaWiki::Article#reload===
+
* '''reason:''' [String] Protect reason
 +
===MediaWiki::Article#reload===
 
Reload Article#text, should be done by Article#initialize.
 
Reload Article#text, should be done by Article#initialize.
  
Zeile 28: Zeile 30:
 
Send the modified Article#text to the MediaWiki.
 
Send the modified Article#text to the MediaWiki.
  
* '''summary:''' [String] Change summary* '''minor_edit:''' [Boolean] This is a Minor Edit* '''watch_this:''' [Boolean] Watch this article===MediaWiki::Article#unprotect===
+
* '''summary:''' [String] Change summary
 +
* '''minor_edit:''' [Boolean] This is a Minor Edit
 +
* '''watch_this:''' [Boolean] Watch this article
 +
===MediaWiki::Article#unprotect===
 
Unprotect this article
 
Unprotect this article
  
* '''reason:''' [String] Unprotect reason===MediaWiki::Article#what_links_here===
+
* '''reason:''' [String] Unprotect reason
 +
===MediaWiki::Article#what_links_here===
 
What articles link to this article?
 
What articles link to this article?
  
* '''result:''' [Array] of [String] Article names===MediaWiki::Article#xhtml===
+
* '''result:''' [Array] of [String] Article names
 +
===MediaWiki::Article#xhtml===
 
Get the XHTML, will invoke Article#xhtml_reload if not already cached
 
Get the XHTML, will invoke Article#xhtml_reload if not already cached
  
* '''result:''' [REXML::Element] html root element===MediaWiki::Article#xhtml_reload===
+
* '''result:''' [REXML::Element] html root element
 +
===MediaWiki::Article#xhtml_reload===
 
Reload the xhtml, will be automatically done by Article#xhtml if not already cached.
 
Reload the xhtml, will be automatically done by Article#xhtml if not already cached.
  
Zeile 43: Zeile 51:
 
Create a new Article instance
 
Create a new Article instance
  
* '''wiki:''' [Wiki] instance to be used to theive the MiniBrowser* '''name:''' [String] Article name* '''section:''' [Fixnum] Optional article section number* '''load_text:''' [Boolean] Invoke Article#reload to retrieve Article#text==MediaWiki::Category==
+
* '''wiki:''' [Wiki] instance to be used to theive the MiniBrowser
 +
* '''name:''' [String] Article name
 +
* '''section:''' [Fixnum] Optional article section number
 +
* '''load_text:''' [Boolean] Invoke Article#reload to retrieve Article#text
 +
==MediaWiki::Category==
 
The Category class represents MediaWiki categories.
 
The Category class represents MediaWiki categories.
  
Zeile 49: Zeile 61:
 
Which articles belong to this category?
 
Which articles belong to this category?
  
* '''result:''' [Array] of [String] Article names===MediaWiki::Category#reload===
+
* '''result:''' [Array] of [String] Article names
 +
===MediaWiki::Category#reload===
 
Reload the XML, will be invoked by Category#articles, if not already cached.
 
Reload the XML, will be invoked by Category#articles, if not already cached.
  
Zeile 55: Zeile 68:
 
Create a new Category instance
 
Create a new Category instance
  
* '''wiki:''' [Wiki] instance to be used to theive the MiniBrowser* '''name:''' [String] Category name, to be prefixed with "Category:" when being fetched==MediaWiki::MiniBrowser==
+
* '''wiki:''' [Wiki] instance to be used to theive the MiniBrowser
 +
* '''name:''' [String] Category name, to be prefixed with "Category:" when being fetched
 +
==MediaWiki::MiniBrowser==
 
===MediaWiki::MiniBrowser#add_cookie===
 
===MediaWiki::MiniBrowser#add_cookie===
 
===MediaWiki::MiniBrowser#cookies===
 
===MediaWiki::MiniBrowser#cookies===
Zeile 71: Zeile 86:
 
Returns the pages listed on "Special:Allpages"
 
Returns the pages listed on "Special:Allpages"
  
* '''result:''' [Array] of [String] Articlenames===MediaWiki::Wiki#article===
+
* '''result:''' [Array] of [String] Articlenames
 +
===MediaWiki::Wiki#article===
 
Return a new Article instance with given name, will be constructed with [self] (for MiniBrowser usage)
 
Return a new Article instance with given name, will be constructed with [self] (for MiniBrowser usage)
  
* '''name:''' [String] Article name* '''section:''' [Fixnum] Optional section number===MediaWiki::Wiki#article_url===
+
* '''name:''' [String] Article name
 +
* '''section:''' [Fixnum] Optional section number
 +
===MediaWiki::Wiki#article_url===
 
Construct the URL to a specific article
 
Construct the URL to a specific article
  
Zeile 81: Zeile 99:
 
Often called by Article, Category, ...
 
Often called by Article, Category, ...
  
* '''name:''' [String] Article name* '''section:''' [Fixnum] Optional section number===MediaWiki::Wiki#category===
+
* '''name:''' [String] Article name
 +
* '''section:''' [Fixnum] Optional section number
 +
===MediaWiki::Wiki#category===
 
Return a new Category instance with given name, will be constructed with [self] (for MiniBrowser usage)
 
Return a new Category instance with given name, will be constructed with [self] (for MiniBrowser usage)
  
* '''name:''' [String] Category name (to be prepended with "Category:")===MediaWiki::Wiki#login===
+
* '''name:''' [String] Category name (to be prepended with "Category:")
 +
===MediaWiki::Wiki#login===
 
Log in into MediaWiki
 
Log in into MediaWiki
  
 
This is '''not''' HTTP authentication (put HTTP-Auth into [url] of Wiki#initialize!)
 
This is '''not''' HTTP authentication (put HTTP-Auth into [url] of Wiki#initialize!)
  
* '''user:''' [String] MediaWiki username* '''password:''' [String] MediaWiki passwordMay raise an exception if cannot authenticate
+
* '''user:''' [String] MediaWiki username
 +
* '''password:''' [String] MediaWiki password
 +
May raise an exception if cannot authenticate
  
 
===MediaWiki::Wiki::new===
 
===MediaWiki::Wiki::new===
 
Initialize a new Wiki instance.
 
Initialize a new Wiki instance.
  
* '''url:''' [String] URL-Path to index.php (without index.php), may containt <tt>user:password</tt> combination.* '''user:''' [String] If not nil, log in with that MediaWiki username (see Wiki#login)* '''password:''' [String] If not nil, log in with that MediaWiki password (see Wiki#login)
+
* '''url:''' [String] URL-Path to index.php (without index.php), may containt <tt>user:password</tt> combination.
 +
* '''user:''' [String] If not nil, log in with that MediaWiki username (see Wiki#login)
 +
* '''password:''' [String] If not nil, log in with that MediaWiki password (see Wiki#login)

Version vom 14. Dezember 2005, 02:10 Uhr

Ruby-MediaWiki Documentation

MediaWiki

MediaWiki::dotfile

dotfile function reads the user's MediaWiki config and creates a Wiki instance.

The filename is determined by the environment variable MEDIAWIKI_RC or defaults to ~/.mediawikirc .

A configured wiki can be chosen with the MEDIAWIKI_WIKI environment variable, or defaults to the wiki pointed by default.

A robot may set [myrealm] to retrieve a second result output: a section with this name in the current wiki's configuration file for configuration of specific robot tasks.

MediaWiki::Article

The Article class represents MediaWiki articles.

MediaWiki::Article#delete

Delete this article

  • reason: [String] Delete reason

MediaWiki::Article#protect

Protect this article

  • reason: [String] Protect reason

MediaWiki::Article#reload

Reload Article#text, should be done by Article#initialize.

MediaWiki::Article#submit

Push the Submit button

Send the modified Article#text to the MediaWiki.

  • summary: [String] Change summary
  • minor_edit: [Boolean] This is a Minor Edit
  • watch_this: [Boolean] Watch this article

MediaWiki::Article#unprotect

Unprotect this article

  • reason: [String] Unprotect reason

MediaWiki::Article#what_links_here

What articles link to this article?

  • result: [Array] of [String] Article names

MediaWiki::Article#xhtml

Get the XHTML, will invoke Article#xhtml_reload if not already cached

  • result: [REXML::Element] html root element

MediaWiki::Article#xhtml_reload

Reload the xhtml, will be automatically done by Article#xhtml if not already cached.

MediaWiki::Article::new

Create a new Article instance

  • wiki: [Wiki] instance to be used to theive the MiniBrowser
  • name: [String] Article name
  • section: [Fixnum] Optional article section number
  • load_text: [Boolean] Invoke Article#reload to retrieve Article#text

MediaWiki::Category

The Category class represents MediaWiki categories.

MediaWiki::Category#articles

Which articles belong to this category?

  • result: [Array] of [String] Article names

MediaWiki::Category#reload

Reload the XML, will be invoked by Category#articles, if not already cached.

MediaWiki::Category::new

Create a new Category instance

  • wiki: [Wiki] instance to be used to theive the MiniBrowser
  • name: [String] Category name, to be prefixed with "Category:" when being fetched

MediaWiki::MiniBrowser

MediaWiki::MiniBrowser#add_cookie

MediaWiki::MiniBrowser#cookies

MediaWiki::MiniBrowser#get_content

MediaWiki::MiniBrowser#post_content

MediaWiki::MiniBrowser::new

MediaWiki::Table

MediaWiki::Table#text

MediaWiki::Table::new

MediaWiki::Table::parse

takes the wiki markup of a table and returns a 2-dimensional array representing the rows and columns of the table TODO: fill member variables according to parsed tables

MediaWiki::Wiki

MediaWiki::Wiki#allpages

Returns the pages listed on "Special:Allpages"

  • result: [Array] of [String] Articlenames

MediaWiki::Wiki#article

Return a new Article instance with given name, will be constructed with [self] (for MiniBrowser usage)

  • name: [String] Article name
  • section: [Fixnum] Optional section number

MediaWiki::Wiki#article_url

Construct the URL to a specific article

Uses the [url] the Wiki instance was constructed with, appends "index.php", the name parameter and, optionally, the section.

Often called by Article, Category, ...

  • name: [String] Article name
  • section: [Fixnum] Optional section number

MediaWiki::Wiki#category

Return a new Category instance with given name, will be constructed with [self] (for MiniBrowser usage)

  • name: [String] Category name (to be prepended with "Category:")

MediaWiki::Wiki#login

Log in into MediaWiki

This is not HTTP authentication (put HTTP-Auth into [url] of Wiki#initialize!)

  • user: [String] MediaWiki username
  • password: [String] MediaWiki password

May raise an exception if cannot authenticate

MediaWiki::Wiki::new

Initialize a new Wiki instance.

  • url: [String] URL-Path to index.php (without index.php), may containt user:password combination.
  • user: [String] If not nil, log in with that MediaWiki username (see Wiki#login)
  • password: [String] If not nil, log in with that MediaWiki password (see Wiki#login)