10a016d04SGreg Roach<?php 20a016d04SGreg Roach/** 30a016d04SGreg Roach * webtrees: online genealogy 4*1062a142SGreg Roach * Copyright (C) 2018 webtrees development team 50a016d04SGreg Roach * This program is free software: you can redistribute it and/or modify 60a016d04SGreg Roach * it under the terms of the GNU General Public License as published by 70a016d04SGreg Roach * the Free Software Foundation, either version 3 of the License, or 80a016d04SGreg Roach * (at your option) any later version. 90a016d04SGreg Roach * This program is distributed in the hope that it will be useful, 100a016d04SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 110a016d04SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 120a016d04SGreg Roach * GNU General Public License for more details. 130a016d04SGreg Roach * You should have received a copy of the GNU General Public License 140a016d04SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 150a016d04SGreg Roach */ 160a016d04SGreg Roachnamespace Fisharebest\Webtrees\CommonMark; 170a016d04SGreg Roach 180a016d04SGreg Roachuse League\CommonMark\Block\Parser\BlockParserInterface; 190a016d04SGreg Roachuse League\CommonMark\Block\Renderer\BlockRendererInterface; 200a016d04SGreg Roachuse League\CommonMark\Extension\Extension; 210a016d04SGreg Roachuse Webuni\CommonMark\TableExtension\Table; 220a016d04SGreg Roachuse Webuni\CommonMark\TableExtension\TableCell; 230a016d04SGreg Roachuse Webuni\CommonMark\TableExtension\TableCellRenderer; 240a016d04SGreg Roachuse Webuni\CommonMark\TableExtension\TableRenderer; 250a016d04SGreg Roachuse Webuni\CommonMark\TableExtension\TableRow; 260a016d04SGreg Roachuse Webuni\CommonMark\TableExtension\TableRowRenderer; 270a016d04SGreg Roachuse Webuni\CommonMark\TableExtension\TableRows; 280a016d04SGreg Roachuse Webuni\CommonMark\TableExtension\TableRowsRenderer; 290a016d04SGreg Roach 300a016d04SGreg Roach/** 310a016d04SGreg Roach * Convert webtrees 1.x census-assistant markup into tables. 320a016d04SGreg Roach * Note that webtrees 2.0 generates markdown tables directly. 330a016d04SGreg Roach * 340a016d04SGreg Roach * Based on the table parser from webuni/commonmark-table-extension. 350a016d04SGreg Roach */ 360a016d04SGreg Roachclass CensusTableExtension extends Extension { 370a016d04SGreg Roach /** 380a016d04SGreg Roach * Returns a list of block parsers to add to the existing list 390a016d04SGreg Roach * 400a016d04SGreg Roach * @return BlockParserInterface[] 410a016d04SGreg Roach */ 420a016d04SGreg Roach public function getBlockParsers() { 430a016d04SGreg Roach return [ 440a016d04SGreg Roach new CensusTableParser, 450a016d04SGreg Roach ]; 460a016d04SGreg Roach } 470a016d04SGreg Roach 480a016d04SGreg Roach /** 490a016d04SGreg Roach * Returns a list of block renderers to add to the existing list 500a016d04SGreg Roach * 510a016d04SGreg Roach * The list keys are the block class names which the corresponding value (renderer) will handle. 520a016d04SGreg Roach * 530a016d04SGreg Roach * @return BlockRendererInterface[] 540a016d04SGreg Roach */ 550a016d04SGreg Roach public function getBlockRenderers() { 560a016d04SGreg Roach return [ 570a016d04SGreg Roach Table::class => new TableRenderer, 580a016d04SGreg Roach TableRows::class => new TableRowsRenderer, 590a016d04SGreg Roach TableRow::class => new TableRowRenderer, 600a016d04SGreg Roach TableCell::class => new TableCellRenderer, 610a016d04SGreg Roach ]; 620a016d04SGreg Roach } 630a016d04SGreg Roach 640a016d04SGreg Roach /** 650a016d04SGreg Roach * @return string 660a016d04SGreg Roach */ 670a016d04SGreg Roach public function getName() { 680a016d04SGreg Roach return 'censustabletable'; 690a016d04SGreg Roach } 700a016d04SGreg Roach} 71