xref: /plugin/commonmark/src/Dokuwiki/Plugin/Commonmark/Extension/TableExtension.php (revision 94a075ee9c5821074e0d7b2c07e7e230fefe6cd9)
1656793f4SSungbin Jeon<?php
2656793f4SSungbin Jeon
3656793f4SSungbin Jeondeclare(strict_types=1);
4656793f4SSungbin Jeon
5656793f4SSungbin Jeon/*
6656793f4SSungbin Jeon * This file is part of the clockoon/dokuwiki-commonmark-plugin package.
7656793f4SSungbin Jeon *
8656793f4SSungbin Jeon * (c) Sungbin Jeon <clockoon@gmail.com>
9656793f4SSungbin Jeon *
10656793f4SSungbin Jeon * Original code based on the followings:
11656793f4SSungbin Jeon * - CommonMark JS reference parser (https://bitly.com/commonmark-js) (c) John MacFarlane
12656793f4SSungbin Jeon * - league/commonmark (https://github.com/thephpleague/commonmark) (c) Colin O'Dell <colinodell@gmail.com>
13656793f4SSungbin Jeon * - Commonmark Table extension  (c) Martin Hasoň <martin.hason@gmail.com>, Webuni s.r.o. <info@webuni.cz>, Colin O'Dell <colinodell@gmail.com>
14656793f4SSungbin Jeon *
15656793f4SSungbin Jeon * For the full copyright and license information, please view the LICENSE
16656793f4SSungbin Jeon * file that was distributed with this source code.
17656793f4SSungbin Jeon */
18656793f4SSungbin Jeon
19656793f4SSungbin Jeonnamespace DokuWiki\Plugin\Commonmark\Extension;
20656793f4SSungbin Jeon
21*94a075eeSSungbin Jeonuse League\CommonMark\Environment\EnvironmentBuilderInterface;
22656793f4SSungbin Jeonuse League\CommonMark\Extension\ExtensionInterface;
23656793f4SSungbin Jeonuse League\CommonMark\Extension\Table\TableParser;
24656793f4SSungbin Jeonuse League\CommonMark\Extension\Table\Table;
25656793f4SSungbin Jeonuse League\CommonMark\Extension\Table\TableCell;
26656793f4SSungbin Jeonuse League\CommonMark\Extension\Table\TableRow;
27656793f4SSungbin Jeonuse League\CommonMark\Extension\Table\TableSection;
28656793f4SSungbin Jeonuse Dokuwiki\Plugin\Commonmark\Extension\Renderer\Block\TableRenderer;
29656793f4SSungbin Jeonuse Dokuwiki\Plugin\Commonmark\Extension\Renderer\Block\TableSectionRenderer;
30656793f4SSungbin Jeonuse Dokuwiki\Plugin\Commonmark\Extension\Renderer\Block\TableRowRenderer;
31656793f4SSungbin Jeonuse Dokuwiki\Plugin\Commonmark\Extension\Renderer\Block\TableCellRenderer;
32656793f4SSungbin Jeon
33656793f4SSungbin Jeonfinal class TableExtension implements ExtensionInterface
34656793f4SSungbin Jeon{
35*94a075eeSSungbin Jeon    public function register(EnvironmentBuilderInterface $environment): void
36656793f4SSungbin Jeon    {
37656793f4SSungbin Jeon        $environment
38656793f4SSungbin Jeon            ->addBlockParser(new TableParser())
39656793f4SSungbin Jeon
40656793f4SSungbin Jeon            ->addBlockRenderer(Table::class, new TableRenderer())
41656793f4SSungbin Jeon            ->addBlockRenderer(TableSection::class, new TableSectionRenderer())
42656793f4SSungbin Jeon            ->addBlockRenderer(TableRow::class, new TableRowRenderer())
43656793f4SSungbin Jeon            ->addBlockRenderer(TableCell::class, new TableCellRenderer())
44656793f4SSungbin Jeon        ;
45656793f4SSungbin Jeon    }
46656793f4SSungbin Jeon}
47