Operator Type:
Operator Scope of Action:
Operator Purpose:
Operator First Added:
Operator Altered:
Function [other Function type actions]
Document [operators of similar scope]
Document configuration [other Document configuration operators]
9.0.0
9.2.0
document
document[key]
returns a dictionary of useful properties of the current document. The properties of the document are exposed this way:
- url: the local file:// URL of the current TBX file.
- path: the POSIX file path of the current TBX file
- name: the full name of the current TBX including the file extension
- user-attributes: a list of all the user attributes currently defined in the document
- link-types: a list of discrete link types currently defined in the document
The values for the above properties can be accessed individually by supplying the relevant key. Quotes around the key are optional, both forms are illustrated below:
$MyURL = document["url"];
$MyFile = document[path];
$MyString = document[name];
$MyList = document[user-attributes];
$MyList = document[link-types];
All properties return a string value but the are more usable when passed to attributes (or variables) of the precise data types shown.
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("^[^:]+:","");
However, a neater and more easily understood method is use the Dictionary.keys method and iterate thus:
$MyString =;
document.keys.each[aKey]{
$MyString = $MyString + document[aKey] + "\n";
};