PHP 클래스 luya\TagParser

This is an additional concept to markdown, where you can inject your custom tags to parse. All tags must be an instance of luya\tag\BaseTag and implement the parse($value, $sub) method in order to convert the input to your tag. Read more in the Guide [[concept-tags.md]]. The identifier of the tag is not related to your tag, so you can configure the same tag as different names with multiple purposes. To inject a created tag just use: php TagParser::inject('tagname', ['class' => 'path\to\TagClass']); To parse text with or without markdown use: php TagParser::convert('Hello tagnamevalue'); TagParser::convertWithMarkdown('**Hello** tagnamevalue');
부터: 1.0.0-rc1
저자: Basil Suter ([email protected])
상속: extends yii\base\Object
파일 보기 프로젝트 열기: luyadev/luya 1 사용 예제들

공개 메소드들

메소드 설명
convert ( string $text ) : string Convert the CMS-Tags into HTML-Tags.
convertWithMarkdown ( string $text ) : string Convert the CMS-Tags into HTMl-Tags and additional convert GFM Markdown into Html as well. The main purpose of this method to fix the conflict between markdown and tag parser when using urls.
getInstantiatedTagObjects ( ) : array Generate the instance for all registered tags.
inject ( string $name, string | array $config ) Inject a new tag with a given name and a configurable array config.

비공개 메소드들

메소드 설명
addTag ( $identifier, $tagObjectConfig )
evalTag ( $tag, $context )
getInstance ( )
hasTag ( $tag )
instantiatTag ( $tag )
processText ( $text )

메소드 상세

convert() 공개 정적인 메소드

Convert the CMS-Tags into HTML-Tags.
public static convert ( string $text ) : string
$text string The content where the CMS-Tags should be found and convert into Html-Tags.
리턴 string The converted output of $text.

convertWithMarkdown() 공개 정적인 메소드

Convert the CMS-Tags into HTMl-Tags and additional convert GFM Markdown into Html as well. The main purpose of this method to fix the conflict between markdown and tag parser when using urls.
public static convertWithMarkdown ( string $text ) : string
$text string The content where the CMS-Tags should be found and convert into Html-Tags and Markdown Tags.
리턴 string the COnverted output of $text.

getInstantiatedTagObjects() 공개 정적인 메소드

The main purpose of this method is to return all tag objects in admin context to provide help informations from the tags.
public static getInstantiatedTagObjects ( ) : array
리턴 array An array with all tag object available.

inject() 공개 정적인 메소드

Inject a new tag with a given name and a configurable array config.
public static inject ( string $name, string | array $config )
$name string The name of the tag on what the tag should be found. Must be [a-z] chars.
$config string | array The configurable object context can be either a string with a class or a configurable array base on yii\base\Object concept.