Renderers can be viewed as a map with the following keys:
Table 2. Renderer properties
Key | Type | Description |
---|---|---|
name | xs:string | Used to identify the renderer |
description | xs:string | About the renderer |
type | xs:string | "xqdoca:global" or "xqdoca:module" |
uri | xs:string | The name of the output it creates |
output | xs:string | Serialization parameters for the output |
function | function(*) | The function that implements the rendering |
The listing below shows some example renderers:
map { "output": "html5", "name": "index", "uri": "index.html", "function": Q{quodatum:build.xqdoc-html}index-html2#2, "type": Q{https://github.com/Quodatum/xqdoca}global, "description": "Index of sources" } map { "output": "json", "name": "swagger1", "uri": "swagger.json", "function": Q{quodatum:xqdoca.generator.swagger}swagger#2, "type": Q{https://github.com/Quodatum/xqdoca}global, "description": "Swagger file (JSON format) from restxq annotations." } map { "output": "xml", "name": "xqparse", "uri": "xqparse.xml", "function": Q{quodatum:xqdoca.mod-html}xqparse#3, "type": Q{https://github.com/Quodatum/xqdoca}module, "description": "xqparse file for the source module" }
All outputs are created below the target folder specified in the
$options
map. For module style outputs, numbered sub-folders
are created for each source module and the uri
value is resolved
relative to this folder.
Functions annotated as global renderers need
to have arity=2 and signature ($model
as
map(*)
, $opts
as
map(*))
.
Functions annotated as module renderers need
to have arity=3 and signature ($file
as
map(*)
, $opts
as
map(*)
, $model
as
map(*))
.