-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Compilation of a style is done by those lines, called at each render() of CSL data.
Lines 213 to 214 in 5a0c199
| $this->styleSheetXml = new SimpleXMLElement($this->styleSheet); | |
| $this->parse($this->styleSheetXml); |
This design do not allow to use a CiteProc to render one item at a time, for example in a complex PHP page aggregating multiple references. In another web language, for example Java, a compiled CiteProc should have been shared in a cache at server level, so that each request should not have to recompile the CSL style at each call. Even in PHP, such compiled CiteProc could be cached with APCu or MemCache.
A little experiment shows that compilation can’t be done easily in the constructor of a CiteProc, a Context object seems needed in lots of places, carrying information accross nodes of the CSL style, but carrying also, the mode requested by user in render(), and the data itself. This could be a huge refactoring, but maybe a goal for for a V3, to think about separation between the style compiled and the data.