League\CommonMark\Cursor::getLine PHP Method

getLine() public method

public getLine ( ) : string
return string
    public function getLine()
    {
        return $this->line;
    }

Usage Example

Beispiel #1
0
 /**
  * @param \League\CommonMark\ContextInterface $context
  * @param \League\CommonMark\Cursor $cursor
  *
  * @return bool
  */
 public function parse(\League\CommonMark\ContextInterface $context, \League\CommonMark\Cursor $cursor)
 {
     $line = $cursor->getLine();
     //either a line starting with 'example:' (expected to have a set of links)
     //or a line starting with [example] (a single link)
     //remove potential markdown formatting (except what we need)
     $check = preg_replace('#[^a-z:\\[\\]]#', '', strtolower($line));
     if (substr($check, 0, 8) != 'example:' and substr($check, 0, 9) != '[example]') {
         return false;
     }
     $context->addBlock(new ExampleElement($cursor->getLine(), $this->path));
     $cursor->advanceBy(strlen($line));
     $context->setBlocksParsed(true);
     return true;
 }
All Usage Examples Of League\CommonMark\Cursor::getLine