Пример #1
0
 /**
  * Convert a BBCode tag into Docbook
  *
  * Convert the given node into a Docbook structure, in the given root. For 
  * child elements in the node you may call the visitNode() method of the 
  * provided visitor.
  *
  * @param ezcDocumentBBCodeVisitor $visitor 
  * @param DOMElement $root 
  * @param ezcDocumentBBCodeNode $node 
  * @return void
  */
 public function toDocbook(ezcDocumentBBCodeVisitor $visitor, DOMElement $root, ezcDocumentBBCodeNode $node)
 {
     $markup = $root->ownerDocument->createElement('emphasis');
     if (strtolower($node->token->content) === 'b') {
         $markup->setAttribute('Role', 'strong');
     }
     $root->appendChild($markup);
     foreach ($node->nodes as $child) {
         $visitor->visitNode($markup, $child);
     }
 }
Пример #2
0
 /**
  * Convert a BBCode tag into Docbook
  *
  * Convert the given node into a Docbook structure, in the given root. For 
  * child elements in the node you may call the visitNode() method of the 
  * provided visitor.
  *
  * @param ezcDocumentBBCodeVisitor $visitor 
  * @param DOMElement $root 
  * @param ezcDocumentBBCodeNode $node 
  * @return void
  */
 public function toDocbook(ezcDocumentBBCodeVisitor $visitor, DOMElement $root, ezcDocumentBBCodeNode $node)
 {
     if ($node->token->parameters !== null) {
         // The actual URL is a parameter
         $url = $root->ownerDocument->createElement('ulink');
         $url->setAttribute('url', 'mailto:' . $node->token->parameters);
         $root->appendChild($url);
         foreach ($node->nodes as $child) {
             $visitor->visitNode($url, $child);
         }
     } else {
         // The URL is the contained text of the link
         $url = $root->ownerDocument->createElement('ulink');
         $root->appendChild($url);
         foreach ($node->nodes as $child) {
             $visitor->visitNode($url, $child);
         }
         $url->setAttribute('url', 'mailto:' . $url->textContent);
     }
 }
Пример #3
0
 /**
  * Convert a BBCode tag into Docbook
  *
  * Convert the given node into a Docbook structure, in the given root. For 
  * child elements in the node you may call the visitNode() method of the 
  * provided visitor.
  *
  * @param ezcDocumentBBCodeVisitor $visitor 
  * @param DOMElement $root 
  * @param ezcDocumentBBCodeNode $node 
  * @return void
  */
 public function toDocbook(ezcDocumentBBCodeVisitor $visitor, DOMElement $root, ezcDocumentBBCodeNode $node)
 {
     $quote = $root->ownerDocument->createElement('blockquote');
     $root->appendChild($quote);
     $attribution = null;
     if (!empty($node->token->parameters)) {
         if (!preg_match('(^"(?P<attribution>.*)$")', $node->token->parameters, $match)) {
             $visitor->triggerError(E_NOTICE, 'Attribution is required to be set in quotes.', $node->token->line, $node->token->position);
             $attribution = $node->token->parameters;
         } else {
             $attribution = $match['attribution'];
         }
     }
     if ($attribution) {
         $attribution = $root->ownerDocument->createElement('attribution', htmlspecialchars($attribution));
         $quote->appendChild($attribution);
     }
     $para = $root->ownerDocument->createElement('para');
     $quote->appendChild($para);
     foreach ($node->nodes as $child) {
         $visitor->visitNode($para, $child);
     }
 }
Пример #4
0
 /**
  * Convert a BBCode tag into Docbook
  *
  * Convert the given node into a Docbook structure, in the given root. For 
  * child elements in the node you may call the visitNode() method of the 
  * provided visitor.
  *
  * @param ezcDocumentBBCodeVisitor $visitor 
  * @param DOMElement $root 
  * @param ezcDocumentBBCodeNode $node 
  * @return void
  */
 public function toDocbook(ezcDocumentBBCodeVisitor $visitor, DOMElement $root, ezcDocumentBBCodeNode $node)
 {
     foreach ($node->nodes as $child) {
         $visitor->visitNode($root, $child);
     }
 }