PHP 클래스 Gregwar\RST\Parser

파일 보기 프로젝트 열기: gregwar/rst 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$buffer The buffer is an array containing current lines that are parsed
$currentLine Current line
$directive Current directive to be applied on next node
$directives Current directives
$document Current document
$environment Environment
$filename File name
$includeAllowed Allow include directives?
$includeRoot Behaves like PHP's open_basedir
$isCode Is the current node code ?
$lineInfo
$listFlow
$listLine
$specialLetter Current level of special lines (==== and so)
$state Current state

공개 메소드들

메소드 설명
__construct ( $environment = null, $kernel = null )
createSpan ( $span ) : Span Create a span, which is a text with inline style
getCurrentLine ( ) Gets the current line
getDocument ( ) : Gregwar\RST\Document Get the current document
getEnvironment ( ) : Environment Get the current environment
getFilename ( ) Gets the current filename
getIncludeAllowed ( ) : boolean
getIncludeRoot ( ) : string
getKernel ( ) : Kernel Get the current kernel
getSubParser ( ) : Parser Get a parser with the same environment that this one
includeFileAllowed ( $path ) : boolean Is this file allowed to be included?
includeFiles ( $document ) Include all files described in $document and returns the new string of the given document with includes processed
initDirectives ( ) Initializing built-in directives
initReferences ( ) Initializing references
parse ( string $document ) : Gregwar\RST\Document Parse a document and return a Document instance
parseFile ( string $file ) : Gregwar\RST\Document Parses a given file and return a Document instance
parseLink ( string $line ) : boolean Try to parse a link definition
parseLocal ( string $document ) : Gregwar\RST\Document
pushListLine ( string $line, boolean $flush = false ) : boolean Push a line to the current list node buffer
registerDirective ( Gregwar\RST\Directive $directive ) Register a new directive handler
setIncludePolicy ( boolean $allow, string $directory = null ) : self Allow/disallow includes, or restrict them to a directory

보호된 메소드들

메소드 설명
directiveAddOption ( string $line ) Try to add an option line to the current directive, returns true if sucess and false if failure
findTableChars ( string $line ) : array | boolean Finding the table chars
flush ( ) Flushes the current buffer to create a node
getCurrentDirective ( ) : Gregwar\RST\Directive Gets the current directive
init ( )
initDirective ( string $line ) : false Get current directive if the buffer contains one
isBlockLine ( string $line ) : boolean A line is a code line if it's empty or if it begins with a trimable caracter, for instance:
isComment ( string $line ) : boolean Is this line a comment ?
isDirective ( string $line ) : boolean Is this line a directive ?
isListLine ( string $line ) : boolean Is the given line a list line ?
isSpecialLine ( string $line ) : boolean Tell if a line is a special separating line for title and separators, returns the depth of the special line
parseLine ( string &$line ) Process one line
parseLines ( string $document ) Process all the lines of a document string
parseListLine ( string $line ) : array Parses a list line
parseTableLine ( string $line ) : mixed If the given line is a table line, this will returns the parts of the given line, i.e the offset of the separators
prepareCode ( ) : boolean Tells if the current buffer is announcing a block of code

메소드 상세

__construct() 공개 메소드

public __construct ( $environment = null, $kernel = null )

createSpan() 공개 메소드

Create a span, which is a text with inline style
public createSpan ( $span ) : Span
$span the content string
리턴 Span a span object

directiveAddOption() 보호된 메소드

Try to add an option line to the current directive, returns true if sucess and false if failure
protected directiveAddOption ( string $line )
$line string

findTableChars() 보호된 메소드

Finding the table chars
protected findTableChars ( string $line ) : array | boolean
$line string
리턴 array | boolean

flush() 보호된 메소드

Flushes the current buffer to create a node
protected flush ( )

getCurrentDirective() 보호된 메소드

Gets the current directive
protected getCurrentDirective ( ) : Gregwar\RST\Directive
리턴 Gregwar\RST\Directive

getCurrentLine() 공개 메소드

Gets the current line
public getCurrentLine ( )

getDocument() 공개 메소드

Get the current document
public getDocument ( ) : Gregwar\RST\Document
리턴 Gregwar\RST\Document the document

getEnvironment() 공개 메소드

Get the current environment
public getEnvironment ( ) : Environment
리턴 Environment the parser environment

getFilename() 공개 메소드

Gets the current filename
public getFilename ( )

getIncludeAllowed() 공개 메소드

public getIncludeAllowed ( ) : boolean
리턴 boolean

getIncludeRoot() 공개 메소드

public getIncludeRoot ( ) : string
리턴 string

getKernel() 공개 메소드

Get the current kernel
public getKernel ( ) : Kernel
리턴 Kernel the kernel

getSubParser() 공개 메소드

Get a parser with the same environment that this one
public getSubParser ( ) : Parser
리턴 Parser a new parser with the same environment

includeFileAllowed() 공개 메소드

Is this file allowed to be included?
public includeFileAllowed ( $path ) : boolean
$path
리턴 boolean

includeFiles() 공개 메소드

Include all files described in $document and returns the new string of the given document with includes processed
public includeFiles ( $document )

init() 보호된 메소드

protected init ( )

initDirective() 보호된 메소드

.. |variable| name:: data :option: value :otherOption: otherValue
protected initDirective ( string $line ) : false
$line string
리턴 false if this is not a directive, else an array containing : - variable: the variable name of the directive - name: the directive name - data: the data of the directive - options: an array of all the options and their values

initDirectives() 공개 메소드

Initializing built-in directives
public initDirectives ( )

initReferences() 공개 메소드

Initializing references
public initReferences ( )

isBlockLine() 보호된 메소드

This is a block because there is a space in the front of the caracters This is still part of the block, even if there is an empty line
protected isBlockLine ( string $line ) : boolean
$line string the line text
리턴 boolean true if the line is still in a block

isComment() 보호된 메소드

Is this line a comment ?
protected isComment ( string $line ) : boolean
$line string the line
리턴 boolean true if it's a comment

isDirective() 보호된 메소드

Is this line a directive ?
protected isDirective ( string $line ) : boolean
$line string the line
리턴 boolean true if it's a directive

isListLine() 보호된 메소드

Is the given line a list line ?
protected isListLine ( string $line ) : boolean
$line string
리턴 boolean true if the given line is a list line

isSpecialLine() 보호된 메소드

Tell if a line is a special separating line for title and separators, returns the depth of the special line
protected isSpecialLine ( string $line ) : boolean
$line string
리턴 boolean

parse() 공개 메소드

Parse a document and return a Document instance
public parse ( string $document ) : Gregwar\RST\Document
$document string The contents (string) of the document
리턴 Gregwar\RST\Document The created document

parseFile() 공개 메소드

Parses a given file and return a Document instance
public parseFile ( string $file ) : Gregwar\RST\Document
$file string the file name to parse
리턴 Gregwar\RST\Document $document the document instance

parseLine() 보호된 메소드

Process one line
protected parseLine ( string &$line )
$line string the line string

parseLines() 보호된 메소드

Process all the lines of a document string
protected parseLines ( string $document )
$document string the string (content) of the document

parseListLine() 보호된 메소드

Parses a list line
protected parseListLine ( string $line ) : array
$line string the string line
리턴 array containing: - true if the list is ordered, false else - the depth of the list - the text of the first line without the tick

parseLocal() 공개 메소드

public parseLocal ( string $document ) : Gregwar\RST\Document
$document string
리턴 Gregwar\RST\Document The created document

parseTableLine() 보호된 메소드

====================== ========= =========== 0 23 33 +---------------------+---------+-----------+ 1 23 33
protected parseTableLine ( string $line ) : mixed
$line string
리턴 mixed

prepareCode() 보호된 메소드

Tells if the current buffer is announcing a block of code
protected prepareCode ( ) : boolean
리턴 boolean

pushListLine() 공개 메소드

Push a line to the current list node buffer
public pushListLine ( string $line, boolean $flush = false ) : boolean
$line string
$flush boolean
리턴 boolean

registerDirective() 공개 메소드

Register a new directive handler
public registerDirective ( Gregwar\RST\Directive $directive )
$directive Gregwar\RST\Directive a directive handler

setIncludePolicy() 공개 메소드

Allow/disallow includes, or restrict them to a directory
public setIncludePolicy ( boolean $allow, string $directory = null ) : self
$allow boolean
$directory string
리턴 self

프로퍼티 상세

$buffer 보호되어 있는 프로퍼티

The buffer is an array containing current lines that are parsed
protected $buffer

$currentLine 보호되어 있는 프로퍼티

Current line
protected $currentLine

$directive 보호되어 있는 프로퍼티

Current directive to be applied on next node
protected $directive

$directives 보호되어 있는 프로퍼티

Current directives
protected $directives

$document 보호되어 있는 프로퍼티

Current document
protected $document

$environment 보호되어 있는 프로퍼티

Environment
protected $environment

$filename 보호되어 있는 프로퍼티

File name
protected $filename

$includeAllowed 보호되어 있는 프로퍼티

Allow include directives?
protected $includeAllowed

$includeRoot 보호되어 있는 프로퍼티

Behaves like PHP's open_basedir
protected $includeRoot

$isCode 보호되어 있는 프로퍼티

Is the current node code ?
protected $isCode

$lineInfo 보호되어 있는 프로퍼티

protected $lineInfo

$listFlow 보호되어 있는 프로퍼티

protected $listFlow

$listLine 보호되어 있는 프로퍼티

protected $listLine

$specialLetter 보호되어 있는 프로퍼티

Current level of special lines (==== and so)
protected $specialLetter

$state 보호되어 있는 프로퍼티

Current state
protected $state