-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
…lly-recommended extensions
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
language: php | ||
|
||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
- 7.3 | ||
- hhvm | ||
|
||
env: | ||
matrix: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the league/commonmark-extras package. | ||
* | ||
* (c) Colin O'Dell <colinodell@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace League\CommonMark\Extras; | ||
|
||
use League\CommonMark\Ext\Autolink\AutolinkExtension; | ||
use League\CommonMark\Ext\SmartPunct\SmartPunctExtension; | ||
use League\CommonMark\Extension\ExtensionInterface; | ||
|
||
final class CommonMarkExtrasExtension implements ExtensionInterface | ||
{ | ||
/** @var ExtensionInterface[] */ | ||
private $extensions = []; | ||
|
||
public function __construct() | ||
{ | ||
$this->extensions = [ | ||
new SmartPunctExtension(), | ||
new AutolinkExtension(), | ||
]; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getBlockParsers() | ||
{ | ||
$ret = []; | ||
foreach ($this->extensions as $extension) { | ||
foreach ($extension->getBlockParsers() as $parser) { | ||
$ret[] = $parser; | ||
} | ||
} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
colinodell
Author
Member
|
||
|
||
return $ret; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getInlineParsers() | ||
{ | ||
|
||
$ret = []; | ||
foreach ($this->extensions as $extension) { | ||
foreach ($extension->getInlineParsers() as $parser) { | ||
$ret[] = $parser; | ||
} | ||
} | ||
|
||
return $ret; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getInlineProcessors() | ||
{ | ||
$ret = []; | ||
foreach ($this->extensions as $extension) { | ||
foreach ($extension->getInlineProcessors() as $processor) { | ||
$ret[] = $processor; | ||
} | ||
} | ||
|
||
return $ret; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getDocumentProcessors() | ||
{ | ||
$ret = []; | ||
foreach ($this->extensions as $extension) { | ||
foreach ($extension->getDocumentProcessors() as $processor) { | ||
$ret[] = $processor; | ||
} | ||
} | ||
|
||
return $ret; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getBlockRenderers() | ||
{ | ||
$ret = []; | ||
foreach ($this->extensions as $extension) { | ||
foreach ($extension->getBlockRenderers() as $class => $renderer) { | ||
$ret[$class] = $renderer; | ||
} | ||
} | ||
|
||
return $ret; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getInlineRenderers() | ||
{ | ||
|
||
$ret = []; | ||
foreach ($this->extensions as $extension) { | ||
foreach ($extension->getInlineRenderers() as $class => $renderer) { | ||
$ret[$class] = $renderer; | ||
} | ||
} | ||
|
||
return $ret; | ||
} | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
perhaps add also
yield
support to commonmark (flatten iterators to array),so you could do here just: