protected function processChapterStyles(&$xmlDoc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "")
{
if ($this->isFinalized || $externalReferences === EPub::EXTERNAL_REF_IGNORE) {
return false;
}
// process inlined CSS styles in style tags.
$styles = $xmlDoc->getElementsByTagName("style");
$styleCount = $styles->length;
for ($styleIdx = 0; $styleIdx < $styleCount; $styleIdx++) {
$style = $styles->item($styleIdx);
$styleData = preg_replace('#[/\\*\\s]*\\<\\!\\[CDATA\\[[\\s\\*/]*#im', "", $style->nodeValue);
$styleData = preg_replace('#[/\\*\\s]*\\]\\]\\>[\\s\\*/]*#im', "", $styleData);
$this->processCSSExternalReferences($styleData, $externalReferences, $baseDir, $htmlDir);
$style->nodeValue = "\n" . trim($styleData) . "\n";
}
return true;
}