Cut the aubergines and onion into 1 cm (½ inch) chunks. Heat the oil in a nonstick frying pan until very hot, add the aubergine and fry for about 15 minutes until very soft. Add a little boiling water to prevent sticking if necessary.
Meanwhile, place the onion and celery in a saucepan with a little water or wine. Cook for 5 minutes until tender but still firm.
Add the tomatoes, thyme, cayenne pepper and aubergine and onions. Cook for 15 minutes, stirring occasionally. Add the capers, olives, wine vinegar, sugar and cocoa powder (if using) and cook for 2–3 minutes.
Season with pepper and serve garnished with almonds and parsley. Serve hot or cold as a side dish, starter or a main dish, with polenta and hot crusty bread, if liked.