The quantum of doczar documentation. Every Component has its own directory and html page in the final output. Codifies type, expected location and useful information about a unit of data or functionality. The ultimate goal is to produce and render a Finalization.

constructor

Component ( ) {

Arguments

| doczar:ComponentCache context

Each new Component is a member of a specific ComponentCache.

| doczar:Parser:Path path

The type of the new Component, expressed as an Array of Arrays in the form [ [ delimiter, name ], ...]

Static Properties

class Finalization

This is how a Component presents itself to the Handlebars rendering engine.

Member Properties

| Object < String , doczar:Component , > argsByName

A map of named items from argument to their Component instances.

| Array argument

An Array of Component instances representing function arguments for this Component. If our ctype is not "member" or "property" these arguments are rendered as belonging to a constructor function. (Further document this constructor by providing @spare constructor)

| String ctype

The "component type" of this Component, better known as the word after the @. One of property, member, spare, module, class, argument, returns, callback, default.

| Array doc

An Array of String markdown documents that have been applied to this Component.

| doczar:Component.Finalization | undefined final

After finalization, final is an Object designed to be passed to the template engine (Handlebars).

| Object < String , doczar:Component , > member

A map of property names to Component instances representing these types.

| Array path

The type of this Component expressed as an Array of Arrays in the form [ [ delimiter, name ], ...]

| String pathstr

path joined down to a String.

| Object < String , doczar:Component , > property

A map of property names to Component instances representing these types.

| Array < doczar:Component , > returns

An array of Component instances representing return values for this Component.

| Object < String , doczar:Component , > returnsByName

A map of named items from returns to their Component instances.

| Object < String , doczar:Component , > spare

A map of "spare document" names to Component instances representing these documents.

| Array < doczar:Component , > throws

An array of Component instances representing situations when code represented by this Component may throw an exception.

| Object < String , doczar:Component , > throwsByName

A map of named items from throws to their Component instances.

| Array valtype

The working type(s) of the value described by this Component. This is simply an Array of String type paths.

Methods

finalize ( ) {

Create a representative document ready for rendering and save it to final.

A tricky waltz prepares this Component's finalization for rendering.

Stage 0: Accumulation

Every child Component on this Component is compiled into two Arrays: One is an Array of Arrays grouping children by the name they were stored under, the other is a flat Array of all children. The hasChildren output Boolean and the isTotallyEmpty local Boolean are processed. Implicit documentation (if any) is converted to either a @summary or @details child Component. Finally, async.each calls finalize on every child Component before proceeding to Stage 2: Compilation.

Stage 1: Initialization

Occurs synchronously after Stage 0. Leaves are processed first, then downward toward the trunk. This Component's final property is partially filled. Simple flag properties are set. Empty containers are placed for all child types.

If this Component is a @spare then markdown is rendered now. Modifiers are processed into the finalization. The local Booleans ctype, isClassValtype and isJSONValtype are processed into the output Booleans isFunction, isCallback, isClasslike and isInline.

At this point, the finalize call returns. After a trip around the event loop, Stage 2 begins to process from the trunk outward to the leaves.

Stage 2: Compilation

Control briefly passes to #inherit to generate a new Object containing inherited properties. Every Component with a superclass digs recursively to base classes and builds new versions of several child sets. These inherited sets include local children too.

Every expected variety of child Component is enumerated and a source set picked from either the inheritence document (preferentially) or the local Component.

Arguments

, | doczar:Component inherit ( ) {

Gather children from superclasses and merge them, in order, into a document representing this Component's inheritence. Note: this Component's children will also be merged in, producing a pre-compiled inheritence result and not just the inherited children.

Returns

| doczar:Component

The assembled inheritence document is returned. It looks like an incomplete Component instance, containing only child Components.

submit ( ) {

Merge additional information into this Component.

Arguments

| doczar:Parser:Submission info

Document information hot off the Parser.

writeFiles ( ) {

Create a directory with mkdirp, write an index.html and recursively call for child Components.

Arguments

callback ( ) {

Arguments

| Error err

Filesystem errors and critical failures which hault document assembly will be returned.

Local Variables

local ALIAS_PROPS
| Object CONVERT_NAMES

For dumb reasons, some local child type names are simply converted to a plural name in the finalization. This should be refactored out soon.

| Array COPY_CHILDREN

A list of all local child type names to process into the finalization.

| Array NATURALIZE_CHILDREN

Some child Component types should never be marked as inherited.

| Array SORT_CHILDREN

A list of all child type names from the finalization that should be sorted after they are filled.

| Object SPECIAL_CTYPES

A handful of Component ctypes are important enough that they are finalized under their ctype instead of their child type. Stored as a truth map.

| Object SPLIT_FUNCTIONS

A handful of local child types should be split into different type names on the finalization depending on whether or not they are marked callable. These are mapped as { localName: [ "isFunction", "notFunction" ], }.