diff --git a/src/Controller/Tei2SolrController.php b/src/Controller/Tei2SolrController.php index 5ff9d7dc324420a7e3540711d19d395cff1e16a7..976c62b088d1c30e8e6aacb5085b85d3280424c9 100755 --- a/src/Controller/Tei2SolrController.php +++ b/src/Controller/Tei2SolrController.php @@ -1087,14 +1087,22 @@ class Tei2SolrController extends AbstractController $pattern = '/^#[a-z_]*$/i'; foreach ($childElement->attributes as $attribute) { if ('hand' === $attribute->nodeName) { - $match = preg_match($pattern, $attribute->nodeValue, $matches); - if ($match) { - $add = 'erg. ' . str_replace('_', ' ', trim($attribute->nodeValue, '#')) . '⟩ '; + if (strpos($attribute->nodeValue, 'scrb') !== false) { + $add = $this->transformAddScrb($attribute->nodeValue); + } else { + $match = preg_match($pattern, $attribute->nodeValue, $matches); + if ($match) { + $add = 'erg. ' . str_replace('_', ' ', trim($attribute->nodeValue, '#')) . ''; + } } } } } else { - $add = 'erg.⟩ '; + $add = 'erg.'; + } + + if (!empty($add)) { + $add .= '⟩ '; } } } elseif ('del' === $childElement->nodeName) { @@ -1102,11 +1110,25 @@ class Tei2SolrController extends AbstractController if (!empty($childElement->attributes)) { foreach ($childElement->attributes as $attribute) { if ('hand' === $attribute->nodeName) { - $del = 'str. ' . str_replace('_', ' ', trim($attribute->nodeValue, '#')) . ']'; + if (strpos($attribute->nodeValue, 'scrb') !== false) { + $valueArr = explode('scrb', $attribute->nodeValue); + if (isset($valueArr[1])) { + $valueArr = explode('_', ltrim($valueArr[1], '_')); + if (count($valueArr) === 2) { + $del = 'str Schrhd.' . $valueArr[0] . ' ' . $valueArr[1] . ''; + } + } + } else { + $del = 'str. ' . str_replace('_', ' ', trim($attribute->nodeValue, '#')) . ''; + } } } } else { - $del = 'str.]'; + $del = 'str.'; + } + + if (!empty($del)) { + $del .= ']'; } } } elseif ('handShift' === $childElement->nodeName && 'signed' === $childElement->parentNode->nodeName) { @@ -1305,6 +1327,18 @@ class Tei2SolrController extends AbstractController return $elementText; } + private function transformAddScrb($attributeValue): ?string + { + $valueArr = explode('scrb', $attributeValue); + if (isset($valueArr[1])) { + $valueArr = explode('_', ltrim($valueArr[1], '_')); + if (count($valueArr) === 2) { + return 'str Schrhd.' . $valueArr[0] . ' ' . $valueArr[1] . ''; + } + } + return null; + } + /** * @Route("gitlab") */