Extension:Wiki2LaTeX/Documentation/Hooks

From MediaWiki.org
Jump to: navigation, search

This page describes all available hooks.

Contents

[edit] Core and UI-functions

[edit] 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

[edit] 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

[edit] Parser

[edit] w2lInitParserFinish

Called at the end of initiating parser

Callback Definition:

function fnMyHook(&$parser) { ... }

Attach Hook:

$wgHooks['w2lInitParserFinish'][] = 'fnMyHook';

Examples:

[edit] w2lBeginParse

Called at the beginning of parsing.

Callback Definition:

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

Attach Hook:

$wgHooks['w2lBeginParse'][] = 'fnMyHook';

Examples:

[edit] w2lBeforeCut

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

Callback Definition:

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

Attach Hook:

$wgHooks['w2lBeforeCut'][] = 'fnMyHook';

Examples:

[edit] w2lPreProcess

Called after processing noincludes and such.

Callback Definition:

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

Attach Hook:

$wgHooks['w2lPreProcess'][] = 'fnMyHook';

Examples:

[edit] w2lBeforeStrip

Called before stripping comments

Callback Definition:

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

Attach Hook:

$wgHooks['w2lBeforeStrip'][] = 'fnMyHook';

Examples:

[edit] w2lBeforeExpansion

Called before expanding templates and parser functions

Callback Definition:

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

Attach Hook:

$wgHooks['w2lBeforeExpansion'][] = 'fnMyHook';

Examples:

[edit] w2lBeforeExtractTags

Called before extracting xml-style parser extension tags

Callback Definition:

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

Attach Hook:

$wgHooks['w2lBeforeExtractTags'][] = 'fnMyHook';

Examples:

[edit] w2lBeforeInternalParse

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

Callback Definition:

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

Attach Hook:

$wgHooks['w2lBeforeInternalParse'][] = 'fnMyHook';

Examples:

[edit] w2lBeforeMask

Called before escaping some LaTeX-command-characters

Callback Definition:

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

Attach Hook:

$wgHooks['w2lBeforeMask'][] = 'fnMyHook';

Examples:

[edit] w2lBeforeTables

Called before parsing tables

Callback Definition:

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

Attach Hook:

$wgHooks['w2lBeforeTables'][] = 'fnMyHook';

Examples:

[edit] w2lTables

Called while parsing tables

Callback Definition:

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

Attach Hook:

$wgHooks['w2lTables'][] = 'fnMyHook';

Examples:


[edit] 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

[edit] 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

[edit] 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:


[edit] 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

[edit] w2lInternalFinish

Called at the end of internal parsing

Callback Definition:

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

Attach Hook:

$wgHooks['w2lInternalFinish'][] = 'fnMyHook';

Examples:

[edit] 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

[edit] Extensions

[edit] 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

[edit] 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

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox