Add dependency checking for included files.
[htmlpurifier-web.git] / xhtml-compiler / XHTMLCompiler / DOMFilter / MarkLeadParagraphs.php
blob7475fa0da956aa2665fbc5224922abcfa180925f
1 <?php
3 /**
4 * Attaches class="lead" to all leading paragraphs for typography.
5 */
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 $nodes = $this->query("//html:p[local-name(preceding-sibling::*[1])!='p']");
19 foreach ($nodes as $node) {
20 $node->setAttribute('class', $this->className);