1<?php 2 3namespace dokuwiki\plugin\prosemirror\parser; 4 5class QuoteNode extends Node 6{ 7 /** @var Node[] */ 8 protected $subnodes = []; 9 10 protected $parent; 11 12 public function __construct($data, Node $parent) 13 { 14 $this->parent = &$parent; 15 16 $previousNode = null; 17 foreach ($data['content'] as $nodeData) { 18 try { 19 $newNode = self::getSubNode($nodeData, $this, $previousNode); 20 } catch (\Throwable $e) { 21 error_log("************ Unknown Node type: " . $nodeData['type'] . " ************"); 22 throw $e; 23 } 24 $this->subnodes[] = $newNode; 25 $previousNode = $newNode; 26 } 27 } 28 29 public function toSyntax() 30 { 31 $doc = '>'; 32 $subnodes = []; 33 foreach ($this->subnodes as $subnode) { 34 $subnodes[] = $subnode->toSyntax(); 35 } 36 return $doc . implode("\n>", $subnodes); 37 } 38} 39