# List of Module Namespaces

 TODO: This list is under construction and will eventually contain all namespaces used in context modules. (See: To-Do List)

To avoid clashes with existing and future commands, any module should adhere to the following rules:

• Namespace identifiers (their name parameter) should have more than two characters (at least yours [1]),
• the namespace should be registered here for others to know.
Namespace Name Main file Description
algorithmic algorithmic t-algorithmic Write algorithms.
animation animation t-animation Interface for fieldstack based animation.
annotation annotation t-annotation Annotate text blocks.
cyrnum cyrnum t-cyrillicnumbers Cyrillic numerals, counters.
fancybreak fancybreak t-fancybreak Inserting thought breaks (transitions).
fx fixme t-fixme Todo notes.
fullpage fullpage t-fullpage Set equal margin without \setuplayout.
letterspace letterspace t-letterspace Define letterspacing macros.
rb ruby t-ruby Highlight text with ruby markup.
RST RST t-rst Convert/typeset reStructuredText.
TRL transliterate t-transliterator Transliteration from non-Latin scripts.
visualcounter visualcounter t-visualcounter Display counters using a graphic
Reserved module namespaces.

# Generating a Namespace for Your Module

Context provides the user command \definenamespace that generates a valid namespace for variables and takes care of defining a setup command as well. Suppose you have a module called My Module (preferably in a file t-mymodule.mkiv) and want to reserve the namespace mymod. The following snippet will get you a setup command \setupMyMod.

\definenamespace[mymod] [
type=module,
name=MyMod,
setup=list,
]


Through \setupMyMod you can now set the variables that you are planning to use in your module – it is already a mature command that conforms to the overall context style and can take a parameter list, a list of key-value pairs or both as arguments. Any parameter defined that way can now be retrieved via another command that got auto-generated, \MyModparameter.

% setting a parameter within the namespace
\setupMyMod[
yamp=Yet another module parameter,
]

% command sequence that does something with the parameter
\def\blueparameter{\setupcolors[state=start]\colored[blue]\MyModparameter{yamp}}

% deploying the new user command
\starttext
\blueparameter
\stoptext


Wondering why your namespace, albeit defined as mymod initially, is always referred to as MyMod, i.e. the value of the parameter name as given in the definition? Internally the namespaces are represented as ordinary command sequences with a prefix. This prefix is composed from first the usual four @-signs, second the namespace identifier, and third the key id from the argument list. In the example this results in a macro \@@@@ + mymod + yamp. Thus, \MyModparameter{yamp} would be equivalent to calling:

\unprotect
\@@@@mymodyamp
\protect


# Namespace Configuration

\definenamespace accepts a number of options that determine what commands will be available. At the time of this writing (2010-09-27), this is rather new stuff and so far not guaranteed to stay in context unmodified.

Option Parameters and their description (NS is a namespace dummy)
name string: The identifier that will be used to reference setups and parameters; e. g. a value of NS causes the macros \defineNS and \setupNS to be created.
parent string: a namespace identifier. Should be the same as the identifier of the module’s namespace.
type module: creates the namespace prefixed with quadruple @; other values are planned to be added in the future for internal purposes.
setup list or boolean: initiates the creation of a setup according to the name argument, e. g. \setupNS. The specified value influences the behaviour of the setup:
 yes first argument of the setup accepts one parameter (\setupNS[one][..,..=..,..]); list first argument of the setup accepts a comma separated list (\setupNS[one,two,three][..,..=..,..]).
command list or boolean: creates auxiliary macros and the proper command to define further commands within the new namespace (\defineNS).

For a name parameter NS, the values of the \setupNS command will be retrievable via \NSparameter{parametername}. Additionally, access is provided by \namedNSparameter and \detokenizedNSparameter. The \defineNS[command][..,..=..,..] can be used to create instances of a generic macro with local setups. Works like ordinary Context \definesomething commands and allows for inheritance (\defineNS[command][othercommand]). Of course, if command is set to list, the first argument of \defineNS will take comma separated values.

comment string: meta-information, see related commands below.
version number: meta-information, see related commands.
style boolean: enables special handling for text color and style attributes.

If set to yes, a macro \dosetNSattributes will be created. It receives the values for the style and color arguments as supplied to the \setupNS macro which itself gets created via the setup key (see above).

Optional settings for module namespaces.

# Related Commands

## \listnamespaces

Prints all namespaces defined in tabular form along with additional information. Example:

\definenamespace[Newns][
name=Newns,
type=module,
setup=list,
parent=NS,
style=yes,
version=3.141,
comment=this space has been named,
]

\starttext
\listnamespaces
\stoptext


# Further Information

C O N T E X T G A R D E N