xref: /webtrees/app/CommonMark/XrefNode.php (revision e93a8df2f8d797005750082cc3766c0e80799688)
1eec99f1aSGreg Roach<?php
2eec99f1aSGreg Roach
3eec99f1aSGreg Roach/**
4eec99f1aSGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
6eec99f1aSGreg Roach * This program is free software: you can redistribute it and/or modify
7eec99f1aSGreg Roach * it under the terms of the GNU General Public License as published by
8eec99f1aSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9eec99f1aSGreg Roach * (at your option) any later version.
10eec99f1aSGreg Roach * This program is distributed in the hope that it will be useful,
11eec99f1aSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12eec99f1aSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13eec99f1aSGreg Roach * GNU General Public License for more details.
14eec99f1aSGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16eec99f1aSGreg Roach */
17eec99f1aSGreg Roach
18eec99f1aSGreg Roachdeclare(strict_types=1);
19eec99f1aSGreg Roach
20eec99f1aSGreg Roachnamespace Fisharebest\Webtrees\CommonMark;
21eec99f1aSGreg Roach
22eec99f1aSGreg Roachuse Fisharebest\Webtrees\GedcomRecord;
236f595250SGreg Roachuse League\CommonMark\Node\Node;
24eec99f1aSGreg Roach
25eec99f1aSGreg Roach/**
26eec99f1aSGreg Roach * Convert XREFs within markdown text to links
27eec99f1aSGreg Roach */
286f595250SGreg Roachclass XrefNode extends Node
29eec99f1aSGreg Roach{
30c4943cffSGreg Roach    private GedcomRecord $record;
31eec99f1aSGreg Roach
32c4943cffSGreg Roach    /**
33c4943cffSGreg Roach     * @param GedcomRecord $record
34c4943cffSGreg Roach     */
35eec99f1aSGreg Roach    public function __construct(GedcomRecord $record)
36eec99f1aSGreg Roach    {
37eec99f1aSGreg Roach        parent::__construct();
38eec99f1aSGreg Roach
39eec99f1aSGreg Roach        $this->record = $record;
40eec99f1aSGreg Roach    }
41eec99f1aSGreg Roach
426f595250SGreg Roach    /**
436f595250SGreg Roach     * @return GedcomRecord
446f595250SGreg Roach     */
45eec99f1aSGreg Roach    public function record(): GedcomRecord
46eec99f1aSGreg Roach    {
47eec99f1aSGreg Roach        return $this->record;
48eec99f1aSGreg Roach    }
49eec99f1aSGreg Roach}
50