本文整理匯總了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;
}