rst_paragraph_directive.php 803 B

123456789101112131415161718192021222324252627
  1. <?php
  2. class ezcDocumentTestParagraphDirective extends ezcDocumentRstDirective
  3. {
  4. public function toDocbook( DOMDocument $document, DOMElement $root )
  5. {
  6. $article = $this->parseTokens(
  7. $this->node->tokens,
  8. new ezcDocumentRstDocbookVisitor( new ezcDocumentRst(), $this->path )
  9. )->documentElement;
  10. for ( $i = 0; $i < $article->childNodes->length; ++$i )
  11. {
  12. $child = $article->childNodes->item( $i );
  13. if ( isset( $this->node->options['class'] ) &&
  14. ( $child->nodeType === XML_ELEMENT_NODE ) )
  15. {
  16. $child->setAttribute( 'Role', trim( $this->node->options['class'] ) );
  17. }
  18. $root->appendChild( $document->importNode( $child, true ) );
  19. }
  20. }
  21. }
  22. ?>