Module:Road data/parser/hooks/doc explained

This module includes hook functions that provide extra functionality to and its associated string modules.

Basics

Each hook is simply a function stored in the p package table exported by this module. Each function accepts two arguments:

KY["KY 1966"] =

Hooks may modify the argument table by simply setting a new key as equal to a computed value. Modifying existing values is allowed, but discouraged.

The return value of a hook is an ordinary format string, which may be computed within the function or pulled from the parameters argument. Generally, if the hook does not compute the format string to be returned, the hook should return parameters.default, which should equal a format string.

Hooks

split

This hook determines the format string to be used by the parser based on whether the route number is above or below a particular number.

Parameters:

splitlen

This hook operates in a similar fashion to split, but tests the length of the route number instead of its value.

Parameters:

between

This hook determines the format string to be used by the parser based on whether the route number is between two given numbers.

Parameters:

mask

This hook adds an argument to the args table based on the result of applying a supplied mask to a particular argument.

Parameters:

padroute

This hook zero-pads the route number so that the route number has a particular number of digits.

Parameters:

pagename

This hook is similar to running an to match the title of an article to a specified value in order to display certain content. Particularly useful for images with Fair-use rationales.

Parameters:

lowercase

This hook converts the route "number" to lowercase.

Parameters:

startswith

This hook determines whether a particular argument starts with any of the given patterns, and returns the value associated with the matching pattern.

Parameters: