Skip to content
Permalink
Browse files

Merge pull request #181 from borazslo/master

Fix
  • Loading branch information
briff committed Nov 18, 2019
2 parents fef3262 + ad8989e commit b80a58c88a2723589f25ed272726380615e578ce
@@ -9,6 +9,9 @@ interface VerseRepository {
public function getTranslatedChapterVerses($bookId, $chapters);
/**
* @return Verse
*/
public function getLeadVerses($bookId);
/**
@@ -132,10 +132,16 @@ private function bookView($translationAbbrev, CanonicalReference $canonicalRef)
$groupedVerses = [];
foreach ($firstVerses as $verse) {
$type = $verse->getType();
if ($type == 'text') {
if ($type == 'text' || $type == 'poemLine') {
$verseContainer = new VerseContainer($book);
$verseContainer->addVerse($verse);
$groupedVerses[$verse['chapter']][$verse['numv']] = $this->textService->getTeaser([$verseContainer]);
$oldText = "";
if (array_has($groupedVerses, $verse['chapter'])) {
if (array_has($groupedVerses[$verse['chapter']], $verse['numv'])) {
$oldText = $groupedVerses[$verse['chapter']][$verse['numv']];
}
}
$groupedVerses[$verse['chapter']][$verse['numv']] = $oldText . $this->textService->getTeaser([$verseContainer]);
}
}
$allTranslations = $this->translationRepository->getAllOrderedByDenom();
@@ -1,6 +1,5 @@
<?php
/**
*/
namespace SzentirasHu\Service\Text;
@@ -12,7 +11,8 @@
use SzentirasHu\Data\Repository\BookRepository;
use SzentirasHu\Data\Repository\VerseRepository;
class TextService {
class TextService
{
/**
* @var \SzentirasHu\Service\Reference\ReferenceService
*/
@@ -87,9 +87,9 @@ public function getPureText($canonicalRef, $translationId)
foreach ($verseContainers as $verseContainer) {
$verses = $verseContainer->getParsedVerses();
foreach ($verses as $verse) {
$verseText = $verse -> getText();
$verseText = $verse->getText();
$verseText = preg_replace('/<[^>]*>/', ' ', $verseText);
$text .= $verseText.' ';
$text .= $verseText . ' ';
}
}
return $text;
@@ -105,7 +105,7 @@ public function getTeaser($verseContainers)
foreach ($verseContainers as $verseContainer) {
$parsedVerses = $verseContainer->getParsedVerses();
$teaser .= preg_replace('/<\/?[^>]+>/', ' ', $parsedVerses[0]->getText());
if ($verseContainer != last($verseContainers) || count($parsedVerses)>1) {
if ($verseContainer != last($verseContainers) || count($parsedVerses) > 1) {
$teaser .= ' ... ';
}
}
@@ -54,9 +54,9 @@
'KG' => [
'verseTypes' =>
[
'text' => [6],
'text' => [901],
'heading' => [1=>1, 2=>2, 3=>3],
'xref' => [13]
'xref' => [2017]
],
'textSource' => env('TEXT_SOURCE_KG'),
'id' => 4
@@ -10,7 +10,7 @@ class VerseTest extends TestCase {
public function testType()
{
$verse = new Verse();
$verse->tip=6;
$verse->tip=901;
$verse->trans = 4;
$this->assertEquals('text', $verse->getType());

0 comments on commit b80a58c

Please sign in to comment.
You can’t perform that action at this time.