From ed9d8eaaf0feead94fa646d7b89b359b2b736172 Mon Sep 17 00:00:00 2001 From: siddique2 Date: Thu, 21 Oct 2021 09:45:26 +0200 Subject: [PATCH 1/2] Add Hi TEI Tag transformation for simple:italic case --- src/Service/TranscriptionService.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Service/TranscriptionService.php b/src/Service/TranscriptionService.php index e447c8c..2f680d7 100644 --- a/src/Service/TranscriptionService.php +++ b/src/Service/TranscriptionService.php @@ -119,4 +119,21 @@ class TranscriptionService extends HtmlService $htmlEl->setAttribute('class', 'salute'); return $htmlEl; } + + private function handleHi(DOMElement $el): DOMNode + { + $htmlEl = $this->p(); + if ('hi' === $el->nodeName && isset($el->attributes[0])) { + foreach ($el->attributes as $attribute) { + + $hi = explode(':', $attribute->value); + + if (isset($hi[1]) && !empty($hi[1]) && 'italic' === $hi[1]) { + + $htmlEl->setAttribute('class', 'italic'); + } + } + } + return $htmlEl; + } } -- GitLab From cd167cfc196bfe2eaf1f0226adae83518cb13898 Mon Sep 17 00:00:00 2001 From: siddique2 Date: Fri, 22 Oct 2021 09:36:11 +0200 Subject: [PATCH 2/2] Add Hi TEI Tag transformation for simple case --- assets/scss/support.scss | 11 +++++++++++ src/Service/TranscriptionService.php | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/assets/scss/support.scss b/assets/scss/support.scss index 36f6866..c27860e 100755 --- a/assets/scss/support.scss +++ b/assets/scss/support.scss @@ -82,3 +82,14 @@ section { .salute { padding-left: 1em; } + +.sup { + vertical-align: super; + font-size: smaller; +} + +.left { + display: inline; + text-align: left; +} + diff --git a/src/Service/TranscriptionService.php b/src/Service/TranscriptionService.php index 2f680d7..e1f0f70 100644 --- a/src/Service/TranscriptionService.php +++ b/src/Service/TranscriptionService.php @@ -122,7 +122,7 @@ class TranscriptionService extends HtmlService private function handleHi(DOMElement $el): DOMNode { - $htmlEl = $this->p(); + $htmlEl = $this->span(); if ('hi' === $el->nodeName && isset($el->attributes[0])) { foreach ($el->attributes as $attribute) { @@ -132,6 +132,13 @@ class TranscriptionService extends HtmlService $htmlEl->setAttribute('class', 'italic'); } + elseif (isset($hi[1]) && !empty($hi[1]) && 'underline' === $hi[1]) { + $htmlEl->setAttribute('class', 'underline'); + } + elseif (isset($hi[1]) && !empty($hi[1]) && 'centre' === $hi[1]) { + $htmlEl = $this->p(); + $htmlEl->setAttribute('class', 'left'); + } } } return $htmlEl; -- GitLab