xref: /plugin/commonmark/src/Dokuwiki/Plugin/Commonmark/Extension/TableExtension.php (revision 656793f4f4cb30e58bac0947cd075702e4171396)
1*656793f4SSungbin Jeon<?php
2*656793f4SSungbin Jeon
3*656793f4SSungbin Jeondeclare(strict_types=1);
4*656793f4SSungbin Jeon
5*656793f4SSungbin Jeon/*
6*656793f4SSungbin Jeon * This file is part of the clockoon/dokuwiki-commonmark-plugin package.
7*656793f4SSungbin Jeon *
8*656793f4SSungbin Jeon * (c) Sungbin Jeon <clockoon@gmail.com>
9*656793f4SSungbin Jeon *
10*656793f4SSungbin Jeon * Original code based on the followings:
11*656793f4SSungbin Jeon * - CommonMark JS reference parser (https://bitly.com/commonmark-js) (c) John MacFarlane
12*656793f4SSungbin Jeon * - league/commonmark (https://github.com/thephpleague/commonmark) (c) Colin O'Dell <colinodell@gmail.com>
13*656793f4SSungbin Jeon * - Commonmark Table extension  (c) Martin Hasoň <martin.hason@gmail.com>, Webuni s.r.o. <info@webuni.cz>, Colin O'Dell <colinodell@gmail.com>
14*656793f4SSungbin Jeon *
15*656793f4SSungbin Jeon * For the full copyright and license information, please view the LICENSE
16*656793f4SSungbin Jeon * file that was distributed with this source code.
17*656793f4SSungbin Jeon */
18*656793f4SSungbin Jeon
19*656793f4SSungbin Jeonnamespace DokuWiki\Plugin\Commonmark\Extension;
20*656793f4SSungbin Jeon
21*656793f4SSungbin Jeonuse League\CommonMark\ConfigurableEnvironmentInterface;
22*656793f4SSungbin Jeonuse League\CommonMark\Extension\ExtensionInterface;
23*656793f4SSungbin Jeonuse League\CommonMark\Extension\Table\TableParser;
24*656793f4SSungbin Jeonuse League\CommonMark\Extension\Table\Table;
25*656793f4SSungbin Jeonuse League\CommonMark\Extension\Table\TableCell;
26*656793f4SSungbin Jeonuse League\CommonMark\Extension\Table\TableRow;
27*656793f4SSungbin Jeonuse League\CommonMark\Extension\Table\TableSection;
28*656793f4SSungbin Jeonuse Dokuwiki\Plugin\Commonmark\Extension\Renderer\Block\TableRenderer;
29*656793f4SSungbin Jeonuse Dokuwiki\Plugin\Commonmark\Extension\Renderer\Block\TableSectionRenderer;
30*656793f4SSungbin Jeonuse Dokuwiki\Plugin\Commonmark\Extension\Renderer\Block\TableRowRenderer;
31*656793f4SSungbin Jeonuse Dokuwiki\Plugin\Commonmark\Extension\Renderer\Block\TableCellRenderer;
32*656793f4SSungbin Jeon
33*656793f4SSungbin Jeonfinal class TableExtension implements ExtensionInterface
34*656793f4SSungbin Jeon{
35*656793f4SSungbin Jeon    public function register(ConfigurableEnvironmentInterface $environment): void
36*656793f4SSungbin Jeon    {
37*656793f4SSungbin Jeon        $environment
38*656793f4SSungbin Jeon            ->addBlockParser(new TableParser())
39*656793f4SSungbin Jeon
40*656793f4SSungbin Jeon            ->addBlockRenderer(Table::class, new TableRenderer())
41*656793f4SSungbin Jeon            ->addBlockRenderer(TableSection::class, new TableSectionRenderer())
42*656793f4SSungbin Jeon            ->addBlockRenderer(TableRow::class, new TableRowRenderer())
43*656793f4SSungbin Jeon            ->addBlockRenderer(TableCell::class, new TableCellRenderer())
44*656793f4SSungbin Jeon        ;
45*656793f4SSungbin Jeon    }
46*656793f4SSungbin Jeon}
47