Documentation for template authors

The robot writer uses Pug templates, with a number of helper functions and mixins.

For further documentation see the Murasaki docs


Documentation for API consumers

Endpoints

/lead/json
Preview the newslead object (for debugging)
/lead/html
Use the lead and the template to generate an HTML blob.
/lead/chart
Retrieve url's for all charts in the newslead. Charts will be rendered if they do not already exist.

All API endpoints take POST requests.

The html endpoint

The request body should follow this general pattern:

{
  lead,
  template: {
    type,
    [type]: content
  },
  translations
}

type can be either "string" or "key".

translations can be a translation dictionary, or the name(s) of one or more build-in dicionaries.

{
  "lead": {"a": "world"},
  "template": {
    "type": "string",
    "string": "p Hello #{a}!"
  }
}
will produce:
<p>Hello world!</p>
{
  "lead": {"municipality": "Moss kommune"},
  "template": {
    "type": "string",
    "string": "p Everything is fine in #{t(municipality)}.",
  }
  "translations": ["norway"]
}
will produce:
<p>Everything is fine in Moss municipality.</p>

URL parameters