Constructor
new ve.dm.InternalListNodeGroup()
#
Named, documented class for the individual items in the nodes property of the
ve.dm.InternalList class.
Practically, this represents a list of ve.dm.MWReferenceNode nodes that belong to the
same group.
Named, documented class for the individual items in the nodes property of the
ve.dm.InternalList class.
Properties
firstNodesprivate
#
Properties:
| Name | Type | Description |
|---|---|---|
firstNodes |
Array.<(ve.dm.Node|undefined)> | When Practically, this is the first occurrence of a reused reference (with the same group and name) in a document. That document position dictates the reference's footnote number and the order in which references are rendered in their reference list. Note this is possibly a sparse array with elements missing in case initialization happened
out of order. Skip these and use |
indexOrderprivate
#
Properties:
| Name | Type | Description |
|---|---|---|
indexOrder |
Array.<number> | Sorted to reflect the order of first appearance in the
document. Values are indexes for the Practically, this usually starts as a simple [ 0, 1, 2, … ] array but changes when references are added, reused, moved, and removed. |
keyedNodesprivate
#
Properties:
| Name | Type | Description |
|---|---|---|
keyedNodes |
Object.<string, Array.<ve.dm.Node>> | Indexed by the internal listKey. Practically, one of these arrays can contain multiple elements when a reference (with the same group and same name) is reused. The arrays can never be empty. |
Methods
appendNode(listKey, newNode)private
#
Parameters:
| Name | Type | Description |
|---|---|---|
listKey |
string | |
newNode |
ve.dm.Node | New node to append to the end of the list of nodes with the same key |
appendNodeWithKnownIndex(listKey, newNode, listIndex)
#
Parameters:
| Name | Type | Description |
|---|---|---|
listKey |
string | |
newNode |
ve.dm.Node | Reference node to add |
listIndex |
number | Existing listIndex; ignored when this is not the first node for this key |
buildReflistNumbering() → {Array.<ve.dm.InternalListNodeGroup.RefInfo>}
#
Calculate the numbering that will be assigned to each reference in the internal list group.
Returns:
getAllReuses(listKey) → {Array.<ve.dm.Node>|undefined}
#
undefined}
#
Parameters:
| Name | Type | Description |
|---|---|---|
listKey |
string |
Returns:
All reference nodes (1 or more, never 0) that (re)use the same key. Undefined when the key is unknown.
- Type
-
Array.<ve.dm.Node>
|
undefined
getAllReusesByListIndex(listIndex) → {Array.<ve.dm.Node>|undefined}
#
undefined}
#
Parameters:
| Name | Type | Description |
|---|---|---|
listIndex |
number |
Returns:
All reference nodes (1 or more, never 0) that (re)use the same listIndex. Undefined when the listIndex is unknown.
- Type
-
Array.<ve.dm.Node>
|
undefined
getFirstNode(listKey) → {ve.dm.Node|undefined}
#
undefined}
#
Parameters:
| Name | Type | Description |
|---|---|---|
listKey |
string |
Returns:
Undefined in case there are no known nodes with this key
- Type
-
ve.dm.Node
|
undefined
getFirstNodeByListIndex(listIndex) → {ve.dm.Node|undefined}
#
undefined}
#
Parameters:
| Name | Type | Description |
|---|---|---|
listIndex |
number |
Returns:
Undefined in case there are no known nodes with this listIndex
- Type
-
ve.dm.Node
|
undefined
getFirstNodesInIndexOrder() → {Array.<ve.dm.Node>}
#
getListIndex(listKey) → {number|undefined}private
#
undefined}private
#
Parameters:
| Name | Type | Description |
|---|---|---|
listKey |
string |
Returns:
Corresponding listIndex for the given listKey
- Type
-
number
|
undefined
getListKeyForListIndex(listIndex) → {string|undefined}private
#
undefined}private
#
Parameters:
| Name | Type | Description |
|---|---|---|
listIndex |
number |
Returns:
Corresponding listKey for the given listIndex
- Type
-
string
|
undefined
getSortedReflistNumbering() → {Array.<ve.dm.InternalListNodeGroup.RefInfo>}
#
Returns:
getUniqueListKey(oldListKey, [prefix]) → {string}
#
Generate a unique, human-readable list key that can be used instead of an item's internal list key. Calls with the same oldListKey will return the same value again.
Practically, this is used to auto-generate unique names for previously unnamed references,
e.g. name=":0" and so on.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
oldListKey |
string | Current list key (typically something like "auto/0") to associate the generated list key with |
||
prefix |
string |
optional |
"literal/:" | Prefix for the generated key. Must match the prefix used in
|
Returns:
Generated unique list key, or existing unique key associated with oldListKey
- Type
- string
Generate a unique, human-readable list key that can be used instead of an item's internal list key.
insertNodeInDocumentOrder(listKey, newNode, [listIndex])
#
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
listKey |
string | ||
newNode |
ve.dm.Node | Reference node to insert at document position |
|
listIndex |
number |
optional |
Existing listIndex; ignored when this is not the first node for this key |
isEmpty() → {boolean}
#
isKnownMainListKey(newListKey) → {boolean}private
#
Parameters:
| Name | Type | Description |
|---|---|---|
newListKey |
string |
Returns:
- Type
- boolean
sortGroupIndexes()
#
Sort the indexOrder array within a group object.
Items are sorted by the start offset of their firstNode, unless that node has the 'placeholder' attribute, in which case it moved to the end of the list, where it should be ignored.
unsetNode(listKey, node)
#
Parameters:
| Name | Type | Description |
|---|---|---|
listKey |
string | |
node |
ve.dm.Node | Reference node to remove |
Type Definitions
RefInfo
#
Type:
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
internalListIndex |
number | list index of the |
|
label |
string | Rendered footnote number including any sub-reference number. |
|
mainListIndex |
number |
optional |
List index of a sub-reference's parent, or omitted for a main reference. |
topLevelNumber |
number | Main footnote number. For a sub-reference, this is the number of the parent. |
|
subrefNumber |
number |
optional |
Sub-reference footnote number, or omitted for a main reference. |
subrefs |
Array.<ve.dm.InternalListNodeGroup.RefInfo> |
optional |
Only included in the "buildReflistStructure" output flavor. This is a list of sub-references on a main ref, in document order. |