MediaWiki  REL1_19
CLIParser Class Reference

CLI script to easily parse some wikitext. More...

Inheritance diagram for CLIParser:
Collaboration diagram for CLIParser:

List of all members.

Public Member Functions

 __construct ()
 Default constructor.
 execute ()
 Do the actual work.
 render ($wikitext)

Protected Member Functions

 getTitle ()
 Title object to use for CLI parsing.
 initParser ()
 parse ($wikitext)
 Wikitext ()
 Get wikitext from a the file passed as argument or STDIN.

Protected Attributes

 $parser

Detailed Description

CLI script to easily parse some wikitext.

Wikitext can be given by stdin or using a file. The wikitext will be parsed using 'CLIParser' as a title. This can be overriden with --title option.

Example1:

 $ php parse.php --title foo
 ''[[foo]]''^D
 <p><i><strong class="selflink">foo</strong></i>
 </p>

Example2:

 $ echo "'''bold'''" > /tmp/foo.txt
 $ php parse.php /tmp/foo.txt
 <p><b>bold</b>
 </p>$

Example3:

 $ cat /tmp/foo | php parse.php
 <p><b>bold</b>
 </p>$
Author:
Antoine Musso <hashar at="" free="" dot="" fr>="">
Note:
GNU General Public License 2.0 or later

Definition at line 36 of file parse.php.


Constructor & Destructor Documentation

Default constructor.

Children should call this *first* if implementing their own constructors

Reimplemented from Maintenance.

Definition at line 39 of file parse.php.

References Maintenance\addArg(), and Maintenance\addOption().

Here is the call graph for this function:


Member Function Documentation

Do the actual work.

All child classes will need to implement this

Reimplemented from Maintenance.

Definition at line 46 of file parse.php.

References initParser(), print, and render().

Here is the call graph for this function:

CLIParser::getTitle ( ) [protected]

Title object to use for CLI parsing.

Default title is 'CLIParser', it can be overriden with the option --title <Your:Title>

Returns:
Title object

Definition at line 88 of file parse.php.

References $title, Maintenance\getOption(), and Title\newFromText().

Referenced by parse().

Here is the call graph for this function:

Here is the caller graph for this function:

CLIParser::initParser ( ) [protected]

Definition at line 75 of file parse.php.

References $wgParserConf.

Referenced by execute().

Here is the caller graph for this function:

CLIParser::parse ( wikitext) [protected]
Parameters:
string$wikitextWikitext to parse
Returns:
ParserOutput

Definition at line 100 of file parse.php.

References getTitle().

Referenced by render().

Here is the call graph for this function:

Here is the caller graph for this function:

CLIParser::render ( wikitext)
Parameters:
string$wikitextWikitext to get rendered
Returns:
string HTML Rendering

Definition at line 55 of file parse.php.

References parse().

Referenced by execute().

Here is the call graph for this function:

Here is the caller graph for this function:

CLIParser::Wikitext ( ) [protected]

Get wikitext from a the file passed as argument or STDIN.

Returns:
string Wikitext

Definition at line 63 of file parse.php.

References Maintenance\error(), and Maintenance\getArg().

Here is the call graph for this function:


Member Data Documentation

CLIParser::$parser [protected]

Definition at line 37 of file parse.php.


The documentation for this class was generated from the following file: