本文整理匯總了PHP中ezcDocumentElementVisitorConverter::finishParagraph方法的典型用法代碼示例。如果您正苦於以下問題:PHP ezcDocumentElementVisitorConverter::finishParagraph方法的具體用法?PHP ezcDocumentElementVisitorConverter::finishParagraph怎麽用?PHP ezcDocumentElementVisitorConverter::finishParagraph使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ezcDocumentElementVisitorConverter
的用法示例。
在下文中一共展示了ezcDocumentElementVisitorConverter::finishParagraph方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handle
/**
* Handle a node
*
* Handle / transform a given node, and return the result of the
* conversion.
*
* @param ezcDocumentElementVisitorConverter $converter
* @param DOMElement $node
* @param mixed $root
* @return mixed
*/
public function handle(ezcDocumentElementVisitorConverter $converter, DOMElement $node, $root)
{
// Find all anachors in paragraph, create pre paragraph RST anchors out
// of them and remove them from the paragraph.
$anchors = $node->getElementsByTagName('anchor');
$foundAnchors = false;
foreach ($anchors as $anchor) {
$root .= '.. _' . $anchor->getAttribute('ID') . ":\n";
$anchor->parentNode->removeChild($anchor);
$foundAnchors = true;
}
$root .= $foundAnchors ? "\n" : '';
// Visit paragraph contents
$contents = $converter->visitChildren($node, '');
// Remove all line breaks inside the paragraph.
$contents = trim(preg_replace('(\\s+)', ' ', $contents));
$root .= ezcDocumentDocbookToRstConverter::wordWrap($contents) . "\n\n";
$root = $converter->finishParagraph($root);
return $root;
}