本文整理汇总了PHP中League\CommonMark\Cursor::advanceBySpaceOrTab方法的典型用法代码示例。如果您正苦于以下问题:PHP Cursor::advanceBySpaceOrTab方法的具体用法?PHP Cursor::advanceBySpaceOrTab怎么用?PHP Cursor::advanceBySpaceOrTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类League\CommonMark\Cursor
的用法示例。
在下文中一共展示了Cursor::advanceBySpaceOrTab方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: matchesNextLine
public function matchesNextLine(Cursor $cursor)
{
if (!$cursor->isIndented() && $cursor->getFirstNonSpaceCharacter() === '>') {
$cursor->advanceToFirstNonSpace();
$cursor->advance();
$cursor->advanceBySpaceOrTab();
return true;
}
return false;
}
示例2: parse
/**
* @param ContextInterface $context
* @param Cursor $cursor
*
* @return bool
*/
public function parse(ContextInterface $context, Cursor $cursor)
{
if ($cursor->isIndented()) {
return false;
}
if ($cursor->getFirstNonSpaceCharacter() !== '>') {
return false;
}
$cursor->advanceToFirstNonSpace();
$cursor->advance();
$cursor->advanceBySpaceOrTab();
$context->addBlock(new BlockQuote());
return true;
}
示例3: calculateListMarkerPadding
/**
* @param Cursor $cursor
* @param int $markerLength
*
* @return int
*/
private function calculateListMarkerPadding(Cursor $cursor, $markerLength)
{
$start = $cursor->saveState();
$spacesStartCol = $cursor->getColumn();
while ($cursor->getColumn() - $spacesStartCol < 5) {
if (!$cursor->advanceBySpaceOrTab()) {
break;
}
}
$blankItem = $cursor->peek() === null;
$spacesAfterMarker = $cursor->getColumn() - $spacesStartCol;
if ($spacesAfterMarker >= 5 || $spacesAfterMarker < 1 || $blankItem) {
$cursor->restoreState($start);
$cursor->advanceBySpaceOrTab();
return $markerLength + 1;
}
return $markerLength + $spacesAfterMarker;
}