Template:Craft raw recursive/doc

This is a helper template to Template:Craft raw, which recursively determines the raw resources needed to craft the various components in a given item. It has two main parts, which are iterated until a stop condition is reached:


 * 1) use dpl to get the ingredients for the specified item
 * 2) call this template for each of those ingredients

A nested chain of template/dpl calls ends once the raw resources are reached.

Recursive ingredient collection
The template has one of the above statements for any item that is used as an ingredient in the production of another item (excluding the raw resources themselves; see the next section). If the given item (here "Computer") is an ingredient of the item that's being examined (here something has one or more "Computer" as an ingredient), then the dpl statement causes the ingredient list of "Computer" to be sent back into this template, item by item. A wrapping  trims unnecessary new line characters.

New components that are not raw materials should be added following this model.

Raw resource stop condition
Once a raw resource occurs, its name is simply output (along with some containing characters for later matching purposes). New raw materials should be added following this model.

Cleanup
)

A few regular expressions change a few of the containing characters to mathematical operations (division). The resulting "raw resource string" is then returned to the caller (usually Template:Craft raw) for formatting.