xref: /plugin/doi/syntax/isbn.php (revision 17101be411563598a3f2f83cf104a5211ddaee03)
126b57c75SAndreas Gohr<?php
226b57c75SAndreas Gohr
326b57c75SAndreas Gohr/**
426b57c75SAndreas Gohr * DokuWiki Plugin doi (Syntax Component)
526b57c75SAndreas Gohr *
626b57c75SAndreas Gohr * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
726b57c75SAndreas Gohr * @author  Andreas Gohr <gohr@cosmocode.de>
826b57c75SAndreas Gohr */
9307c6980SAndreas Gohrclass syntax_plugin_doi_isbn extends syntax_plugin_doi_doi
1026b57c75SAndreas Gohr{
1126b57c75SAndreas Gohr
1226b57c75SAndreas Gohr    /** @inheritDoc */
1326b57c75SAndreas Gohr    public function connectTo($mode)
1426b57c75SAndreas Gohr    {
1526b57c75SAndreas Gohr        $this->Lexer->addSpecialPattern('\[\[isbn>[^\]]+\]\]', $mode, 'plugin_doi_isbn');
1626b57c75SAndreas Gohr    }
1726b57c75SAndreas Gohr
1826b57c75SAndreas Gohr    /** @inheritDoc */
1926b57c75SAndreas Gohr    public function handle($match, $state, $pos, Doku_Handler $handler)
2026b57c75SAndreas Gohr    {
2119099051SAndreas Gohr        $isbn = substr($match, 7, -2);
22*17101be4SAndreas Gohr        return [
23*17101be4SAndreas Gohr            'id' => $isbn,
24*17101be4SAndreas Gohr        ];
2526b57c75SAndreas Gohr    }
2626b57c75SAndreas Gohr
2726b57c75SAndreas Gohr    /** @inheritDoc */
28307c6980SAndreas Gohr    protected function getResolver()
2926b57c75SAndreas Gohr    {
30307c6980SAndreas Gohr        $class = '\\dokuwiki\\plugin\\doi\\Resolver\\Isbn'.$this->getConf('isbnresolver').'Resolver';
31307c6980SAndreas Gohr        return new $class();
3226b57c75SAndreas Gohr    }
3326b57c75SAndreas Gohr
3426b57c75SAndreas Gohr
3526b57c75SAndreas Gohr}
3626b57c75SAndreas Gohr
37