Tinderbox v9 Icon

document()


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

Operator Has Optional Arguments: 

 Function  [other Function type actions]

 Document  [operators of similar scope]

 Document configuration  [other Document configuration operators]

 Baseline

 9.6.0

 [More on optional operator arguments]


Syntax note: Operators without any defined mandatory arguments may omit their empty closing parentheses


document()

document

document() or document returns a dictionary of useful properties of the current document. The properties of the document are exposed this way (in this order in the dictionary):

Importantly, The document() Dictionary object is read-only.

The operator returns the document Dictionary object as a single string:

$Text = document(); 

Although trailing parentheses are not needed, when calling the 'bare' operator, add parentheses—i.e. document()— may help the user and parse not mistake the operator document for the literal string "document".

As reading the Dictionary data as a single string can be hard, a neater and more easily understood method is use the document.keys() method.

It is possible to address the document() Dictionary directly for a specific key value using the document[keyStr] method.

However, calling document() with no other handling, returns the entire, unformatted Dictionary contents. To split the items onto separate lines as discrete key:value pairs:

$MyString = document.format("\n"); 

To get the three values (without their keys) on separate lines:

$MyString = document.format("\n").replace("\n[^:]+:","\n").replace("^[^:]+:","");