4 * Attaches class="lead" to all leading paragraphs for typography.
6 class XHTMLCompiler_DOMFilter_MarkLeadParagraphs
extends XHTMLCompiler_DOMFilter
9 protected $name = 'MarkLeadParagraphs';
10 protected $className = 'lead';
12 public function __construct($class = false, $name = false) {
13 parent
::__construct($name);
14 if ($class) $this->className
= $class;
17 public function process(DOMDocument
$dom, $page, $manager) {
18 // possibly add some attribute which disables this behavior
19 $nodes = $this->query("//html:p[local-name(preceding-sibling::*[1])!='p']");
20 if ($nodes) $manager->addDependency(__FILE__
);
21 foreach ($nodes as $node) {
22 $node->setAttribute('class', $this->className
);