Extension:Wiki2LaTeX/Documentation/Hooks

This page describes all available hooks.

w2lRegisterOptions
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
Usage: Adds new HTML-Code to the LaTeX-Form.

Callback Definition: function fnMyHook(&$core, &$output) { ... }

Attach Hook: $wgHooks['w2lFormOptions'][] = 'fnMyHook';

Examples: contrib/mathpazo.php

w2lInitParserFinish
Called at the end of initiating parser

Callback Definition: function fnMyHook(&$parser) { ... }

Attach Hook: $wgHooks['w2lInitParserFinish'][] = 'fnMyHook';

Examples:

w2lBeginParse
Called at the beginning of parsing.

Callback Definition: function fnMyHook(&$parser, &$text) { ... }

Attach Hook: $wgHooks['w2lBeginParse'][] = 'fnMyHook';

Examples:

w2lBeforeCut
Called before the article is cut (noinclude and such.)

Callback Definition: function fnMyHook(&$parser, &$text) { ... }

Attach Hook: $wgHooks['w2lBeforeCut'][] = 'fnMyHook';

Examples:

w2lPreProcess
Called after processing noincludes and such.

Callback Definition: function fnMyHook(&$parser, &$text) { ... }

Attach Hook: $wgHooks['w2lPreProcess'][] = 'fnMyHook';

Examples:

w2lBeforeStrip
Called before stripping comments

Callback Definition: function fnMyHook(&$parser, $text) { ... }

Attach Hook: $wgHooks['w2lBeforeStrip'][] = 'fnMyHook';

Examples:

w2lBeforeExpansion
Called before expanding templates and parser functions

Callback Definition: function fnMyHook(&$parser, &$text) { ... }

Attach Hook: $wgHooks['w2lBeforeExpansion'][] = 'fnMyHook';

Examples:

w2lBeforeExtractTags
Called before extracting xml-style parser extension tags

Callback Definition: function fnMyHook(&$parser, &$text) { ... }

Attach Hook: $wgHooks['w2lBeforeExtractTags'][] = 'fnMyHook';

Examples:

w2lBeforeInternalParse
Called before starting internal parsing (lists, links, tables and such)

Callback Definition: function fnMyHook(&$parser, &$text) { ... }

Attach Hook: $wgHooks['w2lBeforeInternalParse'][] = 'fnMyHook';

Examples:

w2lBeforeMask
Called before escaping some LaTeX-command-characters

Callback Definition: function fnMyHook(&$parser, &$text) { ... }

Attach Hook: $wgHooks['w2lBeforeMask'][] = 'fnMyHook';

Examples:

w2lBeforeTables
Called before parsing tables

Callback Definition: function fnMyHook(&$parser, &$text) { ... }

Attach Hook: $wgHooks['w2lBeforeTables'][] = 'fnMyHook';

Examples:

w2lTables
Called while parsing tables

Callback Definition: function fnMyHook(&$parser, &$text) { ... }

Attach Hook: $wgHooks['w2lTables'][] = 'fnMyHook';

Examples:

w2lParseLists
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
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
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
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
Called at the end of internal parsing

Callback Definition: function fnMyHook(&$parser, &$text) { ... }

Attach Hook: $wgHooks['w2lInternalFinish'][] = 'fnMyHook';

Examples:

w2lFinish
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

w2lRefTag
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
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