本文整理汇总了PHP中ezcDocumentElementVisitorConverter::setSkipPostDecoration方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcDocumentElementVisitorConverter::setSkipPostDecoration方法的具体用法?PHP ezcDocumentElementVisitorConverter::setSkipPostDecoration怎么用?PHP ezcDocumentElementVisitorConverter::setSkipPostDecoration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcDocumentElementVisitorConverter
的用法示例。
在下文中一共展示了ezcDocumentElementVisitorConverter::setSkipPostDecoration方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
{
// Locate optional attribution elements, and transform them below the
// recursive quote visiting.
$xpath = new DOMXPath($node->ownerDocument);
$attributionNodes = $xpath->query('*[local-name() = "attribution"]', $node);
$attributions = array();
foreach ($attributionNodes as $attribution) {
$attributions[] = $attribution->cloneNode(true);
$attribution->parentNode->removeChild($attribution);
}
// Recursively decorate blockquote, after all attribution nodes are
// removed
ezcDocumentDocbookToRstConverter::$indentation += 4;
$root = $converter->visitChildren($node, $root);
// Append attribution nodes, if any
foreach ($attributions as $attribution) {
$converter->setSkipPostDecoration(true);
$attributionLine = '-- ' . trim($converter->visitChildren($attribution, ''));
$converter->setSkipPostDecoration(false);
$root .= ezcDocumentDocbookToRstConverter::wordWrap($attributionLine) . "\n\n";
}
ezcDocumentDocbookToRstConverter::$indentation -= 4;
return $root;
}
示例2: 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)
{
if (ezcDocumentDocbookToRstConverter::$indentation > 0) {
$converter->triggerError(E_WARNING, "Indented section found, cannot be represented in RST.");
}
// Reset indenteation level, ever we reach a new section
ezcDocumentDocbookToRstConverter::$indentation = 0;
if ($node->tagName === 'title') {
// Get actual title string by recursing into the title node
$converter->setSkipPostDecoration(true);
$title = trim($converter->visitChildren($node, ''));
$converter->setSkipPostDecoration(false);
// Get RST title decoration characters
if (!isset($converter->options->headerTypes[$this->level])) {
$converter->triggerError(E_ERROR, "No characters for title of level {$this->level} defined.");
return $root . $title;
}
if (strlen($marker = $converter->options->headerTypes[$this->level]) > 1) {
return $root . sprintf("\n%s\n%s\n%s\n\n", $marker = str_repeat($marker[0], strlen($title)), $title, $marker);
} else {
return $root . sprintf("\n%s\n%s\n\n", $title, str_repeat($marker, strlen($title)));
}
} else {
++$this->level;
// Set internal cross reference target if section has an ID assigned
if ($node->hasAttribute('ID')) {
$root .= '.. _' . $node->getAttribute('ID') . ":\n\n";
}
// Recurse
$root = $converter->visitChildren($node, $root);
// Reduce header level back to original state after recursion
--$this->level;
}
return $root;
}
示例3: 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)
{
$converter->setSkipPostDecoration(true);
$comment = $converter->visitChildren($node, '');
$converter->setSkipPostDecoration(false);
$root .= '.. ' . trim(ezcDocumentDocbookToRstConverter::wordWrap($comment, 3)) . "\n\n";
return $root;
}
示例4: 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)
{
$converter->setSkipPostDecoration(true);
$citationContent = trim($converter->visitChildren($node, ''));
$converter->setSkipPostDecoration(false);
$number = $converter->appendCitation($citationContent);
// Add autonumbered citation reference
$root .= sprintf('[CIT%03d]_ ', $number);
return $root;
}
示例5: 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)
{
$converter->setSkipPostDecoration(true);
$footnoteContent = trim($converter->visitChildren($node, ''));
$converter->setSkipPostDecoration(false);
$number = $converter->appendFootnote($footnoteContent);
// Add autonumbered footnote reference
$root .= '[#]_ ';
return $root;
}