コード例 #1
0
 /**
  * Parse input into nodes
  *
  * @param  net.daringfireball.markdown.Input $lines
  * @return net.daringfireball.markdown.Node
  */
 public function parse($lines)
 {
     $result = new CodeBlock();
     while ($lines->hasMoreLines()) {
         $line = $lines->nextLine();
         if ("\t" === $line->chr()) {
             $result->add(new Text(substr($line, 1)));
         } else {
             if (0 === strncmp($line, '    ', 4)) {
                 $result->add(new Text(substr($line, 4)));
             } else {
                 $lines->resetLine($line);
                 break;
             }
         }
     }
     return $result;
 }
コード例 #2
0
 /**
  * Parse input into nodes
  *
  * @param  net.daringfireball.markdown.Input $lines
  * @return net.daringfireball.markdown.Node
  */
 public function parse($lines)
 {
     $result = new CodeBlock($this->language);
     while ($lines->hasMoreLines()) {
         $line = $lines->nextLine();
         if (0 === strncmp($line, '```', 3)) {
             break;
         } else {
             $result->add(new Text($line));
         }
     }
     return $result;
 }