1*f46768a8SSungbin Jeon<?php 2*f46768a8SSungbin Jeon 3*f46768a8SSungbin Jeon/* 4*f46768a8SSungbin Jeon * This file is part of the league/commonmark package. 5*f46768a8SSungbin Jeon * 6*f46768a8SSungbin Jeon * (c) Colin O'Dell <colinodell@gmail.com> 7*f46768a8SSungbin Jeon * (c) Rezo Zero / Ambroise Maupate 8*f46768a8SSungbin Jeon * 9*f46768a8SSungbin Jeon * For the full copyright and license information, please view the LICENSE 10*f46768a8SSungbin Jeon * file that was distributed with this source code. 11*f46768a8SSungbin Jeon */ 12*f46768a8SSungbin Jeon 13*f46768a8SSungbin Jeondeclare(strict_types=1); 14*f46768a8SSungbin Jeon 15*f46768a8SSungbin Jeonnamespace DokuWiki\Plugin\Commonmark\Extension; 16*f46768a8SSungbin Jeon 17*f46768a8SSungbin Jeonuse League\CommonMark\ConfigurableEnvironmentInterface; 18*f46768a8SSungbin Jeonuse League\CommonMark\Event\DocumentParsedEvent; 19*f46768a8SSungbin Jeonuse League\CommonMark\Extension\ExtensionInterface; 20*f46768a8SSungbin Jeonuse League\CommonMark\Extension\Footnote\Event\AnonymousFootnotesListener; 21*f46768a8SSungbin Jeonuse League\CommonMark\Extension\Footnote\Event\GatherFootnotesListener; 22*f46768a8SSungbin Jeonuse League\CommonMark\Extension\Footnote\Event\NumberFootnotesListener; 23*f46768a8SSungbin Jeonuse League\CommonMark\Extension\Footnote\Node\Footnote; 24*f46768a8SSungbin Jeonuse League\CommonMark\Extension\Footnote\Node\FootnoteBackref; 25*f46768a8SSungbin Jeonuse League\CommonMark\Extension\Footnote\Node\FootnoteContainer; 26*f46768a8SSungbin Jeonuse League\CommonMark\Extension\Footnote\Node\FootnoteRef; 27*f46768a8SSungbin Jeonuse League\CommonMark\Extension\Footnote\Parser\AnonymousFootnoteRefParser; 28*f46768a8SSungbin Jeonuse League\CommonMark\Extension\Footnote\Parser\FootnoteParser; 29*f46768a8SSungbin Jeonuse League\CommonMark\Extension\Footnote\Parser\FootnoteRefParser; 30*f46768a8SSungbin Jeonuse Dokuwiki\Plugin\Commonmark\Extension\Renderer\Inline\FootnoteBackrefRenderer; 31*f46768a8SSungbin Jeonuse Dokuwiki\Plugin\Commonmark\Extension\Renderer\Block\FootnoteContainerRenderer; 32*f46768a8SSungbin Jeonuse Dokuwiki\Plugin\Commonmark\Extension\Renderer\Inline\FootnoteRefRenderer; 33*f46768a8SSungbin Jeonuse Dokuwiki\Plugin\Commonmark\Extension\Renderer\Block\FootnoteRenderer; 34*f46768a8SSungbin Jeon 35*f46768a8SSungbin Jeonfinal class FootnotetoDokuwikiExtension implements ExtensionInterface 36*f46768a8SSungbin Jeon{ 37*f46768a8SSungbin Jeon public function register(ConfigurableEnvironmentInterface $environment) 38*f46768a8SSungbin Jeon { 39*f46768a8SSungbin Jeon $environment->addBlockParser(new FootnoteParser(), 51); 40*f46768a8SSungbin Jeon $environment->addInlineParser(new AnonymousFootnoteRefParser(), 35); 41*f46768a8SSungbin Jeon $environment->addInlineParser(new FootnoteRefParser(), 51); 42*f46768a8SSungbin Jeon 43*f46768a8SSungbin Jeon $environment->addBlockRenderer(FootnoteContainer::class, new FootnoteContainerRenderer()); 44*f46768a8SSungbin Jeon $environment->addBlockRenderer(Footnote::class, new FootnoteRenderer()); 45*f46768a8SSungbin Jeon $environment->addInlineRenderer(FootnoteBackref::class, new FootnoteBackrefRenderer()); 46*f46768a8SSungbin Jeon $environment->addInlineRenderer(FootnoteRef::class, new FootnoteRefRenderer()); 47*f46768a8SSungbin Jeon 48*f46768a8SSungbin Jeon $environment->addEventListener(DocumentParsedEvent::class, [new AnonymousFootnotesListener(), 'onDocumentParsed']); 49*f46768a8SSungbin Jeon $environment->addEventListener(DocumentParsedEvent::class, [new NumberFootnotesListener(), 'onDocumentParsed']); 50*f46768a8SSungbin Jeon $environment->addEventListener(DocumentParsedEvent::class, [new GatherFootnotesListener(), 'onDocumentParsed']); 51*f46768a8SSungbin Jeon } 52*f46768a8SSungbin Jeon} 53