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