diff --git a/src/Service/TranscriptionService.php b/src/Service/TranscriptionService.php index bca3fc6c1ab88096df3c8e9222af26d8fcf82279..54d8f3007d9f555fd1550649ab778b719cbce8ee 100644 --- a/src/Service/TranscriptionService.php +++ b/src/Service/TranscriptionService.php @@ -61,12 +61,32 @@ class TranscriptionService extends CommonTransformService { $htmlEl = $doc->span(); $htmlEl->appendChild($doc->text(' [')); + $this->transformAllChildren($teiEl, $htmlEl, $doc); $italic = $doc->span(); $italic->setAttribute('class', 'italic'); - $italic->appendChild($doc->text(' Str.')); - $htmlEl->appendChild($italic); + if (empty($teiEl->attributes)) { + $italic->appendChild($doc->text(' Str.')); + } else { + foreach ($teiEl->attributes as $attribute) { + if ('hand' === $attribute->nodeName) { + if (strpos($attribute->nodeValue, 'scrb') !== false) { + $valueArr = explode('scrb', $attribute->nodeValue); + if (isset($valueArr[1])) { + $valueArr = explode('_', ltrim($valueArr[1], '_')); + if (count($valueArr) === 2) { + $italic->appendChild($doc->text(' str Schrhd.' . $valueArr[0] . ' ' . $valueArr[1])); + } + } + } else { + $italic->appendChild($doc->text(' str. ' . str_replace('_', ' ', trim($attribute->nodeValue, '#')))); + } + } + } + } + + $htmlEl->appendChild($italic); $htmlEl->appendChild($doc->text('] ')); return $htmlEl; }