示例#1
0
 /**
  * Transform directive to HTML
  *
  * Create a XHTML structure at the directives position in the document.
  *
  * @param DOMDocument $document
  * @param DOMElement $root
  * @return void
  */
 public function toXhtml(DOMDocument $document, DOMElement $root)
 {
     $box = $document->createElement('div');
     $box->setAttribute('class', 'figure');
     $root->appendChild($box);
     parent::toXhtml($document, $box);
     $text = '';
     foreach ($this->node->nodes as $node) {
         $text .= $node->token->content;
     }
     $text = trim($text);
     $paragraph = $document->createElement('p', htmlspecialchars($text));
     $box->appendChild($paragraph);
 }
示例#2
0
 /**
  * Converts the Image directive to an <img/> tag.
  *
  * This method takes an image directive and converts it into its HTML representation and stores a reference in the
  * Asset manager of the Converter.
  *
  * @see ConverterInterface::getAssets() for the asset manager
  *
  * @param \DOMDocument $document
  * @param \DOMElement $root
  *
  * @return void
  */
 public function toXhtml(\DOMDocument $document, \DOMElement $root)
 {
     $this->storeAsset();
     parent::toXhtml($document, $root);
 }