Tracked it down a little further.
{{ object.title|raw }} yields the correct results when called inside the page template (which lists all objects), but when used inside of a partial template and input via {% include 'flex/' ~ type ~ '/object/' object_layout ~ '/ics.twig' with { object: object_context } %} it somehow seems to be escaped again.
Adding{% autoescape false %} … {% endautoescape %} around the include tag does not help.
Trying to use the render tag as in the html templates does not work somehow it yields an error: ERROR: Layout 'list-export-ical' for flex object 'events' was not found.
If I include the same template via {% include ... %} it is found …
File structure:
user/
├─ themes/
│ ├─ mytheme/
│ │ ├─ templates/
│ │ │ ├─ flex/
│ │ │ │ ├─ events/
│ │ │ │ │ ├─ collection/
│ │ │ │ │ │ ├─ export-ical.ics.twig
│ │ │ │ │ ├─ object/
│ │ │ │ │ │ ├─ list-export-ical.ics.twig
│ │ │ ├─ flex-objects-events.ics.twig
pages/
├─ share/
│ ├─ icscalendar/
│ │ ├─ flex-objects-events.md
When requesting route /share/icscalendar.ics flex-objects-events.ics.twig is called which loads the events directory collection and includes export-ical.ics.twig (for outputting the whole ics calendar) which in turn includes list-export-ical.ics.twig inside a loop over all objects of the events collection and renders one single event.
When I use {% render %} inside of export-ical.ics.twig the above mentioned error is thrown.