report.createStyleSheet
Create a style sheet from a style sheet template in red-ale's configuration.
Creates a style sheet from a style sheet template, with the options you give. It lives in red-ale's Configuration. A name
already used is a conflict; an unknown template is not-found. Option values are checked: CSS text that could pull in
anything outside the document (@import, url(, </style) is refused with report-option. Image options are kept in
the Configuration but not rendered.
Examples
Example: with no book.
JSON-RPC
Request:
{"jsonrpc":"2.0","id":1,"method":"report.createStyleSheet","params":{"name":"Roomy","template":"Plain","options":{"Tables":{"Table cell padding":6}}}}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"name": "Roomy",
"template": "Plain",
"predefined": false,
"options": [
"…"
]
}
}
Request:
{"jsonrpc":"2.0","id":2,"method":"report.createStyleSheet","params":{"name":"Roomy","template":"Plain"}}
Response:
{
"jsonrpc": "2.0",
"id": 2,
"error": {
"code": 2003,
"message": "a style sheet is already called \"Roomy\"",
"data": {
"kind": "styleSheet",
"name": "Roomy",
"help": "error/conflict"
}
}
}
Command line
red-ale exec --script - <<'EOF'
report.createStyleSheet {"name":"Roomy","template":"Plain","options":{"Tables":{"Table cell padding":6}}}
report.createStyleSheet {"name":"Roomy","template":"Plain"}
EOF
It fails with exit status 2, printing on standard error:
{
"error": {
"code": 2003,
"message": "a style sheet is already called \"Roomy\"",
"data": {
"kind": "styleSheet",
"name": "Roomy",
"help": "error/conflict"
}
}
}
MCP tool call
Tool call:
{"name":"report.createStyleSheet","arguments":{"name":"Roomy","template":"Plain","options":{"Tables":{"Table cell padding":6}}}}
Result:
{
"structuredContent": {
"name": "Roomy",
"template": "Plain",
"predefined": false,
"options": [
"…"
]
}
}
Tool call:
{"name":"report.createStyleSheet","arguments":{"name":"Roomy","template":"Plain"}}
Result:
{
"isError": true,
"structuredContent": {
"error": {
"code": 2003,
"name": "conflict",
"message": "a style sheet is already called \"Roomy\"",
"data": {
"kind": "styleSheet",
"name": "Roomy",
"help": "error/conflict"
}
}
}
}
Effect: write, on the Configuration only.
Params
Params of report.createStyleSheet.
name(string, required): The new style sheet's name.template(string, required): The style sheet template:CSS,Easy,Fancy,Footer,Head or TailorPlain.options(ReportOptions or null): Option values over the template's defaults.
Result
A style sheet with its options.
name(string, required): The style sheet's name.template(string, required): Its template's name.predefined(boolean, required): Whether it is one of GnuCash's six predefined style sheets, which can be changed and reset but not deleted.options(array of OptionInfo, required): Its options, with their defaults and values.