From 813e7734df9aa8146486918d31d009942b2295fe Mon Sep 17 00:00:00 2001 From: asajedi Date: Tue, 5 Oct 2021 13:15:57 +0200 Subject: [PATCH] Handle choice tag with abbr and expan This handles choice tag with abbr element which is used in transcripted text and expan element which is used in edited text version. --- src/Controller/Tei2SolrController.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Controller/Tei2SolrController.php b/src/Controller/Tei2SolrController.php index 976c62b..7591451 100755 --- a/src/Controller/Tei2SolrController.php +++ b/src/Controller/Tei2SolrController.php @@ -1001,6 +1001,13 @@ class Tei2SolrController extends AbstractController $eText .= ''; $tText .= ''; $note = false; + } elseif (isset($abbr) && !empty($abbr)) { + $tText .= $abbr; + $abbr = ''; + } + elseif (isset($expan) && !empty($expan)) { + $eText .= $expan; + $expan = ''; } else { $eText .= $childElement->data; if (isset($renditions) && !empty($renditions)) { @@ -1131,6 +1138,14 @@ class Tei2SolrController extends AbstractController $del .= ']'; } } + } elseif ('abbr' === $childElement->nodeName && 'choice' === $childElement->parentNode->nodeName) { + if (isset($childElement->firstChild) && $childElement->firstChild->nodeName === '#text') { + $abbr = $childElement->firstChild->data;; + } + } elseif ('expan' === $childElement->nodeName && 'choice' === $childElement->parentNode->nodeName) { + if (isset($childElement->firstChild) && $childElement->firstChild->nodeName === '#text') { + $expan = $childElement->firstChild->data; + } } elseif ('handShift' === $childElement->nodeName && 'signed' === $childElement->parentNode->nodeName) { if (!empty($childElement->attributes)) { $pattern = '/^#[a-z_]*$/i'; -- GitLab