Module document.documentregistry
This is a registry for document providers
Functions
DocumentRegistry:hasProvider (file, include_aux) | Returns true if file has provider. |
DocumentRegistry:getProvider (file, include_aux) | Returns the preferred registered document handler or fallback provider. |
DocumentRegistry:getProviders (file) | Returns the registered document handlers. |
DocumentRegistry:getExtensions () | Get mapping of file extensions to providers |
DocumentRegistry:setProvider (file, all) | Sets the preferred registered document handler. |
DocumentRegistry:openDocument (file, provider) | Returns a new Document instance on success |
DocumentRegistry:closeDocument (file) | Does NOT finalize a Document instance, call its :close() instead if that's what you're looking for! (i.e., nothing but Document:close should call this!) |
DocumentRegistry:getReferenceCount (file) | Queries the current refcount for a given file |
Issues
DocumentRegistry:getProviders-todo4 | some implementation based on mime types? |
Functions
- DocumentRegistry:hasProvider (file, include_aux)
-
Returns true if file has provider.
Parameters:
- file string
- include_aux boolean include auxiliary (non-document) providers
Returns:
-
boolean
- DocumentRegistry:getProvider (file, include_aux)
-
Returns the preferred registered document handler or fallback provider.
Parameters:
- file string
- include_aux boolean include auxiliary (non-document) providers
Returns:
-
table
provider
- DocumentRegistry:getProviders (file)
-
Returns the registered document handlers.
Parameters:
- file string
Returns:
-
table
providers, or nil
- DocumentRegistry:getExtensions ()
-
Get mapping of file extensions to providers
Returns:
-
table
mapping file extensions to a list of providers
- DocumentRegistry:setProvider (file, all)
-
Sets the preferred registered document handler.
Parameters:
- file string
- all boolean
- DocumentRegistry:openDocument (file, provider)
-
Returns a new Document instance on success
Parameters:
- file
- provider force a GC, so that any previous document used memory can be reused immediately by this new document without having to wait for the next regular gc. The second call may help reclaming more memory.
- DocumentRegistry:closeDocument (file)
-
Does NOT finalize a Document instance, call its :close() instead if that's what you're looking for!
(i.e., nothing but Document:close should call this!)
Parameters:
- file
- DocumentRegistry:getReferenceCount (file)
-
Queries the current refcount for a given file
Parameters:
- file