Arbortext Command Language > Callbacks > doc_add_callback > insert_tag Callback Type
  
insert_tag Callback Type
Function prototype:
function funcname (doc, tagname, op)
insert_tag is called before the markup specified by tagname is inserted into a document, by either the insert_tag command, the insert_graphic command, or a markup menu item. If the function inserts the markup itself, for example, using the insert_tag function, it should return -1.
Arguments
doc is the identifier of the document associated with this function.
tagname is the markup specified.
If the document type definition for your document instance includes the NAMECASE GENERAL NO setting, then the tagname parameter will be case sensitive.
op is the function callback operation. Callbacks are called twice in succession with op specifying the stage of callback operation.
1. op == 1 first call — The returned argument specifies whether the execution should continue or be stopped:
0 — Continue callback processing.
-1 — Stop further callback processing.
2. op == 2 second call — Occurs unless the processing was stopped during the first call. The returned argument allows or prevents basic Arbortext Editor processing after all callbacks have been called:
0 — Basic Arbortext Editor processing allowed.
-1 — Basic Arbortext Editor processing prevented.
* 
The insert_graphic command also uses the insert_tag callback to bring up a file chooser dialog box to locate a graphic file to reference. The insert_tag callback then inserts the graphic tag with the appropriate graphic reference. If you add your own insert_tag callback after the standard callback performed by the insert_graphic command, then it gets called after the graphic tag is inserted. To call your own callback before the tag is inserted, you need to prepend your callback to the list of callbacks by following the example:
doc_add_callback(0, 'insert_tag', 'my_insert_tag', 'PREPEND')