コード例 #1
0
ファイル: Markdown.php プロジェクト: kisphp/markdown-parser
 /**
  * @param string $lineContent
  *
  * @return string
  */
 protected function getObjectTypeByContent($lineContent, $lineNumber)
 {
     if (empty($lineContent) || trim($lineContent) === '') {
         return BlockTypes::BLOCK_EMPTY;
     }
     if ($this->getAvailableTypesByContent($lineContent) === false) {
         return BlockTypes::BLOCK_PARAGRAPH;
     }
     $blockPlugins = $this->factory->getBlockPlugins();
     $possibleTypes = $blockPlugins[$lineContent[0]];
     foreach ($possibleTypes as $type) {
         $blockObject = $this->factory->create($type);
         if ($blockObject->validateLineType($lineNumber) === true) {
             return $type;
         }
     }
     return BlockTypes::BLOCK_PARAGRAPH;
 }
コード例 #2
0
 /**
  * @param string $lineContent
  *
  * @return string
  */
 protected function parseInlineBlockTemplates($lineContent)
 {
     return $this->factory->create(BlockTypes::BLOCK_CODE_INJECTOR)->setContent($lineContent)->parse();
 }