本文整理汇总了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;
}