1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This is part of the league/commonmark package. |
7
|
|
|
* |
8
|
|
|
* (c) Martin Hasoň <[email protected]> |
9
|
|
|
* (c) Webuni s.r.o. <[email protected]> |
10
|
|
|
* (c) Colin O'Dell <[email protected]> |
11
|
|
|
* |
12
|
|
|
* For the full copyright and license information, please view the LICENSE |
13
|
|
|
* file that was distributed with this source code. |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace League\CommonMark\Extension\Table; |
17
|
|
|
|
18
|
|
|
use League\CommonMark\Environment\EnvironmentBuilderInterface; |
19
|
|
|
use League\CommonMark\Extension\ConfigurableExtensionInterface; |
20
|
|
|
use League\CommonMark\Renderer\HtmlDecorator; |
21
|
|
|
use League\Config\ConfigurationBuilderInterface; |
22
|
|
|
use Nette\Schema\Expect; |
23
|
|
|
|
24
|
|
|
final class TableExtension implements ConfigurableExtensionInterface |
25
|
|
|
{ |
26
|
142 |
|
public function configureSchema(ConfigurationBuilderInterface $builder): void |
27
|
|
|
{ |
28
|
142 |
|
$attributeArraySchema = Expect::arrayOf( |
29
|
142 |
|
Expect::type('string|string[]|bool'), // attribute value(s) |
30
|
142 |
|
'string' // attribute name |
31
|
142 |
|
)->mergeDefaults(false); |
32
|
|
|
|
33
|
142 |
|
$builder->addSchema('table', Expect::structure([ |
34
|
142 |
|
'wrap' => Expect::structure([ |
35
|
142 |
|
'enabled' => Expect::bool()->default(false), |
36
|
142 |
|
'tag' => Expect::string()->default('div'), |
37
|
142 |
|
'attributes' => Expect::arrayOf(Expect::string()), |
38
|
142 |
|
]), |
39
|
142 |
|
'alignment_attributes' => Expect::structure([ |
40
|
142 |
|
'left' => (clone $attributeArraySchema)->default(['align' => 'left']), |
41
|
142 |
|
'center' => (clone $attributeArraySchema)->default(['align' => 'center']), |
42
|
142 |
|
'right' => (clone $attributeArraySchema)->default(['align' => 'right']), |
43
|
142 |
|
]), |
44
|
142 |
|
'max_autocompleted_cells' => Expect::int()->min(0)->default(TableParser::DEFAULT_MAX_AUTOCOMPLETED_CELLS), |
|
|
|
|
45
|
142 |
|
])); |
46
|
|
|
} |
47
|
|
|
|
48
|
142 |
|
public function register(EnvironmentBuilderInterface $environment): void |
49
|
|
|
{ |
50
|
142 |
|
$tableRenderer = new TableRenderer(); |
51
|
142 |
|
if ($environment->getConfiguration()->get('table/wrap/enabled')) { |
52
|
2 |
|
$tableRenderer = new HtmlDecorator($tableRenderer, $environment->getConfiguration()->get('table/wrap/tag'), $environment->getConfiguration()->get('table/wrap/attributes')); |
53
|
|
|
} |
54
|
|
|
|
55
|
142 |
|
$environment |
56
|
142 |
|
->addBlockStartParser(new TableStartParser($environment->getConfiguration()->get('table/max_autocompleted_cells'))) |
57
|
|
|
|
58
|
142 |
|
->addRenderer(Table::class, $tableRenderer) |
59
|
142 |
|
->addRenderer(TableSection::class, new TableSectionRenderer()) |
60
|
142 |
|
->addRenderer(TableRow::class, new TableRowRenderer()) |
61
|
142 |
|
->addRenderer(TableCell::class, new TableCellRenderer($environment->getConfiguration()->get('table/alignment_attributes'))); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths