1<?php
2
3namespace dokuwiki\plugin\prosemirror\parser;
4
5class FootnoteNode extends Node
6{
7    /** @var TextNode[] */
8    protected $subnodes = [];
9
10    protected $parent;
11
12    public function __construct($data, Node $parent)
13    {
14        $this->parent = &$parent;
15        $json = $data['attrs']['contentJSON'];
16        $contentDoc = json_decode($json, true);
17        foreach ($contentDoc['content'] as $subnode) {
18            $this->subnodes[] = self::getSubNode($subnode, $this);
19        }
20    }
21
22    public function toSyntax()
23    {
24        $doc = '';
25        foreach ($this->subnodes as $subnode) {
26            $doc .= $subnode->toSyntax() . "\n\n";
27        }
28        return "((\n" . rtrim(ltrim($doc, "\n")) . "\n))";
29    }
30}
31