1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Basic block and inline definitions

This commit is contained in:
Aidan Woods 2019-01-20 02:22:25 +00:00
parent 5a00cb7f07
commit c17868cac8
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9
2 changed files with 60 additions and 0 deletions

29
src/Components/Block.php Normal file
View File

@ -0,0 +1,29 @@
<?php
namespace Erusev\Parsedown\Components;
use Erusev\Parsedown\Component;
use Erusev\Parsedown\Parsing\Context;
use Erusev\Parsedown\State;
interface Block extends Component
{
/**
* @param Context $Context
* @param Block|null $Block
* @param State|null $State
* @return static|null
*/
public static function build(
Context $Context,
Block $Block = null,
State $State = null
);
/**
* Return true if the block was build encompassing the previous block
* $Block given to static::build, return false otherwise.
* @return bool
*/
public function acquiredPrevious();
}

31
src/Components/Inline.php Normal file
View File

@ -0,0 +1,31 @@
<?php
namespace Erusev\Parsedown\Components;
use Erusev\Parsedown\Component;
use Erusev\Parsedown\Parsing\Excerpt;
use Erusev\Parsedown\State;
interface Inline extends Component
{
/**
* @param Excerpt $Excerpt
* @param State $State
* @return static|null
*/
public static function build(Excerpt $Excerpt, State $State);
/**
* Number of characters consumed by the build action.
* @return int
* */
public function width();
/**
* Return an integer to declare that the inline should be treated as if it
* started from that position in the excerpt given to static::build.
* Return null to use the excerpt offset value.
* @return int|null
* */
public function modifyStartPositionTo();
}