/** * @param DOMNode $currentNode */ public function visit(DOMNode $currentNode) { /** @var DOMElement $currentNode */ DomHelper::verifyDomElementArgument($currentNode, "currentNode"); $this->getJsonFormatBuilder()->pushNode(new JsonFormatRootNode()); $this->iterate($currentNode->childNodes); }
/** * @param DOMNode $currentNode */ public function visit(DOMNode $currentNode) { /** @var DOMElement $currentNode */ DomHelper::verifyDomElementArgument($currentNode, "currentNode"); $href = $currentNode->getAttribute('href'); $this->getJsonFormatBuilder()->add(new JsonFormatLinkNode($currentNode->textContent, $href)); }
/** * @param DOMNode $currentNode */ public function visit(DOMNode $currentNode) { /** @var DOMElement $currentNode */ DomHelper::verifyDomElementArgument($currentNode, "currentNode"); /** @noinspection PhpUndefinedMethodInspection - we check that in can visit method */ $src = $currentNode->childNodes->item(0)->getAttribute('src'); $this->getJsonFormatBuilder()->add(new JsonFormatImageNode($src)); }
/** * @param DOMNode $currentNode */ public function visit(DOMNode $currentNode) { /** @var DOMElement $currentNode */ DomHelper::verifyDomElementArgument($currentNode, "currentNode"); $author = $currentNode->childNodes->item(1)->textContent; $text = $currentNode->childNodes->item(0)->childNodes->item(0)->childNodes->item(1)->textContent; $quoteNode = new JsonFormatQuoteNode($author, $text); $this->getJsonFormatBuilder()->add($quoteNode); }
/** * @param DOMNode $currentNode */ public function visit(DOMNode $currentNode) { /** @var DOMElement $currentNode */ DomHelper::verifyDomElementArgument($currentNode, "currentNode"); $figcaption = $currentNode->childNodes->item(2); $img = $currentNode->childNodes->item(0)->childNodes->item(1)->childNodes->item(0); /** @var DOMElement $img */ $src = $img->getAttribute('src'); $caption = DomHelper::getTextValue($figcaption); $imageFigure = new JsonFormatImageFigureNode($src, $caption); $this->getJsonFormatBuilder()->add($imageFigure); }
/** * @param DOMNode $currentNode */ public function visit(DOMNode $currentNode) { /** @var DOMElement $currentNode */ DomHelper::verifyDomElementArgument($currentNode, "currentNode"); $table = new JsonFormatInfoboxNode(); $this->getJsonFormatBuilder()->pushNode($table); for ($i = 0; $i < $currentNode->childNodes->length; $i++) { $childNode = $currentNode->childNodes->item($i); $this->tryVisitTBody($childNode); $this->tryVisitRow($childNode); } $this->getJsonFormatBuilder()->popNode($table); }
/** * @param DOMNode $currentNode */ public function visit(DOMNode $currentNode) { /** @var DOMElement $currentNode */ DomHelper::verifyDomElementArgument($currentNode, "currentNode"); if ($this->verifyFirstChildHasClass($currentNode, "mw-headline")) { $text = DomHelper::getTextValue($currentNode->childNodes->item(0), ['#text', 'a', 'b', 'i', 'u', 'h1', 'h2', 'h3', 'h4', 'p', 'span'], ['editsection']); $section = new JsonFormatSectionNode(intval($currentNode->tagName[1]), $text); $this->getJsonFormatBuilder()->pushSection($section); } else { $text = $currentNode->textContent; $this->getJsonFormatBuilder()->appendText($text); } }
/** * @param DOMNode $currentNode */ public function visit(DOMNode $currentNode) { /** @var DOMElement $currentNode */ DomHelper::verifyDomElementArgument($currentNode, "currentNode"); $list = new JsonFormatListNode(DomHelper::isElement($currentNode, 'ol')); $this->getJsonFormatBuilder()->pushNode($list); for ($i = 0; $i < $currentNode->childNodes->length; $i++) { $childNode = $currentNode->childNodes->item($i); if (DomHelper::isElement($childNode, 'li')) { $this->visitListItem($childNode); } } $this->getJsonFormatBuilder()->popNode($list); }
/** * @param DOMNode $currentNode */ public function visit(DOMNode $currentNode) { /** @var DOMElement $currentNode */ DomHelper::verifyDomElementArgument($currentNode, "currentNode"); if (strpos($currentNode->getAttribute('id'), 'flytab') !== false) { // current div contains <tabview> tabs (ajax tabs) // each tab treated as section $this->parseTabview($currentNode); } else { if ($currentNode->getAttribute('class') == 'tabber') { // current div contains <tabber> tabs (embedded tabs) // each tab treated as section $this->parseTabber($currentNode); } else { // this is not div with tabs // so, we will just visit child nodes $this->iterate($currentNode->childNodes); } } }
/** * @param DOMNode $currentNode */ public function visit(DOMNode $currentNode) { /** @var DOMElement $currentNode */ DomHelper::verifyDomElementArgument($currentNode, "currentNode"); $this->iterate($currentNode->childNodes); }
/** * @param DOMNode $currentNode */ public function visit(DOMNode $currentNode) { /** @var DOMElement $currentNode */ DomHelper::verifyDomElementArgument($currentNode, "currentNode"); $this->getJsonFormatBuilder()->appendText("\n"); }