10a016d04SGreg Roach<?php 23976b470SGreg Roach 30a016d04SGreg Roach/** 40a016d04SGreg Roach * webtrees: online genealogy 58fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team 60a016d04SGreg Roach * This program is free software: you can redistribute it and/or modify 70a016d04SGreg Roach * it under the terms of the GNU General Public License as published by 80a016d04SGreg Roach * the Free Software Foundation, either version 3 of the License, or 90a016d04SGreg Roach * (at your option) any later version. 100a016d04SGreg Roach * This program is distributed in the hope that it will be useful, 110a016d04SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 120a016d04SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 130a016d04SGreg Roach * GNU General Public License for more details. 140a016d04SGreg Roach * You should have received a copy of the GNU General Public License 150a016d04SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 160a016d04SGreg Roach */ 17fcfa147eSGreg Roach 18e7f56f2aSGreg Roachdeclare(strict_types=1); 19e7f56f2aSGreg Roach 200a016d04SGreg Roachnamespace Fisharebest\Webtrees\CommonMark; 210a016d04SGreg Roach 224a1f1d43SGreg Roachuse League\CommonMark\ConfigurableEnvironmentInterface; 23*eec99f1aSGreg Roachuse League\CommonMark\Extension\ExtensionInterface; 24600daa5dSGreg Roachuse League\CommonMark\Extension\Table\Table; 25600daa5dSGreg Roachuse League\CommonMark\Extension\Table\TableCell; 26600daa5dSGreg Roachuse League\CommonMark\Extension\Table\TableCellRenderer; 27600daa5dSGreg Roachuse League\CommonMark\Extension\Table\TableRenderer; 28600daa5dSGreg Roachuse League\CommonMark\Extension\Table\TableRow; 29600daa5dSGreg Roachuse League\CommonMark\Extension\Table\TableRowRenderer; 30600daa5dSGreg Roachuse League\CommonMark\Extension\Table\TableSection; 31600daa5dSGreg Roachuse League\CommonMark\Extension\Table\TableSectionRenderer; 320a016d04SGreg Roach 330a016d04SGreg Roach/** 340a016d04SGreg Roach * Convert webtrees 1.x census-assistant markup into tables. 350a016d04SGreg Roach * Note that webtrees 2.0 generates markdown tables directly. 360a016d04SGreg Roach * 374a1f1d43SGreg Roach * Based on the table parser from league/commonmark-ext-table. 380a016d04SGreg Roach */ 394a1f1d43SGreg Roachclass CensusTableExtension implements ExtensionInterface 40c1010edaSGreg Roach{ 414a1f1d43SGreg Roach public function register(ConfigurableEnvironmentInterface $environment): void 42c1010edaSGreg Roach { 434a1f1d43SGreg Roach $environment 444a1f1d43SGreg Roach ->addBlockParser(new CensusTableParser()) 454a1f1d43SGreg Roach ->addBlockRenderer(Table::class, new TableRenderer()) 464a1f1d43SGreg Roach ->addBlockRenderer(TableSection::class, new TableSectionRenderer()) 474a1f1d43SGreg Roach ->addBlockRenderer(TableRow::class, new TableRowRenderer()) 484a1f1d43SGreg Roach ->addBlockRenderer(TableCell::class, new TableCellRenderer()); 490a016d04SGreg Roach } 500a016d04SGreg Roach} 51