Extension:Wiki2LaTeX/Documentation/Hooks
This page describes all available hooks.
Core and UI-functions [edit]
w2lRegisterOptions [edit]
Usage: Used to tell W2L some new Form-Parameters which should be loaded into the parser.
Callback Definition:
function fnMyHook(&$core) { ... }
Attach Hook:
$wgHooks['w2lRegisterOptions'][] = 'fnMyHook';
Examples: contrib/mathpazo.php
w2lFormOptions [edit]
Usage: Adds new HTML-Code to the LaTeX-Form.
Callback Definition:
function fnMyHook(&$core, &$output) { ... }
Attach Hook:
$wgHooks['w2lFormOptions'][] = 'fnMyHook';
Examples: contrib/mathpazo.php
Parser [edit]
w2lInitParserFinish [edit]
Called at the end of initiating parser
Callback Definition:
function fnMyHook(&$parser) { ... }
Attach Hook:
$wgHooks['w2lInitParserFinish'][] = 'fnMyHook';
Examples:
w2lBeginParse [edit]
Called at the beginning of parsing.
Callback Definition:
function fnMyHook(&$parser, &$text) { ... }
Attach Hook:
$wgHooks['w2lBeginParse'][] = 'fnMyHook';
Examples:
w2lBeforeCut [edit]
Called before the article is cut (noinclude and such.)
Callback Definition:
function fnMyHook(&$parser, &$text) { ... }
Attach Hook:
$wgHooks['w2lBeforeCut'][] = 'fnMyHook';
Examples:
w2lPreProcess [edit]
Called after processing noincludes and such.
Callback Definition:
function fnMyHook(&$parser, &$text) { ... }
Attach Hook:
$wgHooks['w2lPreProcess'][] = 'fnMyHook';
Examples:
w2lBeforeStrip [edit]
Called before stripping comments
Callback Definition:
function fnMyHook(&$parser, $text) { ... }
Attach Hook:
$wgHooks['w2lBeforeStrip'][] = 'fnMyHook';
Examples:
w2lBeforeExpansion [edit]
Called before expanding templates and parser functions
Callback Definition:
function fnMyHook(&$parser, &$text) { ... }
Attach Hook:
$wgHooks['w2lBeforeExpansion'][] = 'fnMyHook';
Examples:
w2lBeforeExtractTags [edit]
Called before extracting xml-style parser extension tags
Callback Definition:
function fnMyHook(&$parser, &$text) { ... }
Attach Hook:
$wgHooks['w2lBeforeExtractTags'][] = 'fnMyHook';
Examples:
w2lBeforeInternalParse [edit]
Called before starting internal parsing (lists, links, tables and such)
Callback Definition:
function fnMyHook(&$parser, &$text) { ... }
Attach Hook:
$wgHooks['w2lBeforeInternalParse'][] = 'fnMyHook';
Examples:
w2lBeforeMask [edit]
Called before escaping some LaTeX-command-characters
Callback Definition:
function fnMyHook(&$parser, &$text) { ... }
Attach Hook:
$wgHooks['w2lBeforeMask'][] = 'fnMyHook';
Examples:
w2lBeforeTables [edit]
Called before parsing tables
Callback Definition:
function fnMyHook(&$parser, &$text) { ... }
Attach Hook:
$wgHooks['w2lBeforeTables'][] = 'fnMyHook';
Examples:
w2lTables [edit]
Called while parsing tables
Callback Definition:
function fnMyHook(&$parser, &$text) { ... }
Attach Hook:
$wgHooks['w2lTables'][] = 'fnMyHook';
Examples:
w2lParseLists [edit]
Asks, if some function wants to change the LaTeX-environments used for lists.
Callback Definition:
function fnMyHook(&$parser, &$list_ul_env, &$list_ol_env) { ... }
Attach Hook:
$wgHooks['w2lParseLists'][] = 'fnMyHook';
Examples: contrib/paralist.php
w2lInternalLinks [edit]
Asks, if some function wants to change how to display Links.
Callback Definition:
function fnMyHook(&$parser, &$link, &$linktext, &$linked_page) { ... }
Attach Hook:
$wgHooks['w2lInternalLinks'][] = 'fnMyHook';
Examples: contrib/linkify.php
w2lHTMLReplace [edit]
Replace_array contains all simple HTML-Tags, which can be replaced by str_replace. You can add or remove entries. Working with $text you can also parse more complex HTMl-Tags.
Callback Definition:
function fnMyHook(&$parser, &$replace_array, &$text) { ... }
Attach Hook:
$wgHooks['w2lHTMLReplace'][] = 'fnMyHook';
Examples:
w2lHeadings [edit]
Called for Headings. $heading is the heading itself. Setting $heading_command makes w2l use this command. Only set it to f.e. section, as Braces and the Backslash gets added later on.
Callback Definition:
function fnMyHook(&$parser, &$heading, &$level, &$heading_command) { ... }
Attach Hook:
$wgHooks['w2lHTMLReplace'][] = 'fnMyHook';
Examples: contrib/komascript.php
w2lInternalFinish [edit]
Called at the end of internal parsing
Callback Definition:
function fnMyHook(&$parser, &$text) { ... }
Attach Hook:
$wgHooks['w2lInternalFinish'][] = 'fnMyHook';
Examples:
w2lFinish [edit]
Called at the end of parsing process. $text is now complete LaTeX.
Callback Definition:
function fnMyHook(&$parser, &$text) { ... }
Attach Hook:
$wgHooks['w2lFinish'][] = 'fnMyHook';
Examples: contrib/mathpazo.php
Extensions [edit]
w2lRefTag [edit]
Called by the ref-extension to allow for other footnote-command than the plain \footnote{}.
Callback Definition:
function fnMyHook(&$parser, &$command, &$input) { ... }
Attach Hook:
$wgHooks['w2lRefTag'][] = 'fnMyHook';
Examples: contrib/ref.php
w2lReferencesTag [edit]
Called by the references-extension to ask, whether some other function wants to show some LaTeX-code. Useful, if you want to use endnotes.
Callback Definition:
function fnMyHook(&$parser, &$input, &$output, &$argv) { ... }
Attach Hook:
$wgHooks['w2lReferencesTag'][] = 'fnMyHook';
Examples: contrib/ref.php
