11import '../../common/enums.dart' ;
22import '../json_to_bible.dart' ;
33
4- /// OET Literal version implementation
4+ /// The OET Literal Version (OET-LV) implementation.
5+ ///
6+ /// The OET-LV is displayed in sections verse-by-verse and does not contain section boxes.
57class OETLiteralBibleImpl extends JsonToBible {
68 OETLiteralBibleImpl (Map <String , dynamic > json) : super (json: json);
79
@@ -12,7 +14,6 @@ class OETLiteralBibleImpl extends JsonToBible {
1214 String chapterNumberHtml = '' ;
1315
1416 String chapterNumber = '' ;
15- String sectionVerseReference = '' ;
1617 List <dynamic > chapterContents = [];
1718
1819 List <dynamic > chaptersData = json['chapters' ];
@@ -24,12 +25,9 @@ class OETLiteralBibleImpl extends JsonToBible {
2425
2526 chapterContents = chapter['contents' ];
2627
27- String sectionText = '' ;
28-
2928 // In the current json, the section heading is placed in the verse
3029 // before the actual section, so we delay splitting the section with isNext
3130 // It means that this is the next verse after the 's1'.
32- bool isNewParagraph = false ;
3331 bool isNext = false ;
3432 bool isSection = false ;
3533 for (Map <String , dynamic > item in chapterContents) {
@@ -39,25 +37,7 @@ class OETLiteralBibleImpl extends JsonToBible {
3937
4038 for (String key in item.keys) {
4139 if (key == 's1' ) {
42- sectionText = item['s1' ];
4340 isSection = true ;
44- } else if (key == 'contents' ) {
45- // Handle new paragraphs
46- // We're looking for the indication of a new paragraph: "p" representing /p in the ESFM
47- for (var innerMap in item[key]) {
48- if (innerMap is Map ) {
49- if (innerMap.containsKey ('s1' )) {
50- if (innerMap['s1' ] is String ) {
51- sectionText = innerMap['s1' ];
52- isSection = true ;
53- }
54- }
55-
56- if (innerMap.containsKey ('p' )) {
57- isNewParagraph = true ;
58- }
59- }
60- }
6141 }
6242
6343 // Handle verse numbers
@@ -68,29 +48,12 @@ class OETLiteralBibleImpl extends JsonToBible {
6848 chapterNumberHtml = '' ;
6949 }
7050
71- if (isNewParagraph == true ) {
72- // Add a new break between paragraphs
73- isNewParagraph = false ;
74- if (verseNumberText == '1' ) {
75- htmlText += '<p class="c" id="${readerArea .name }-$bookCode -$chapterNumber ">' ;
76- } else {
77- // The end of a paragraph
78- htmlText += '<p/>' ;
79- }
80- }
81- sectionVerseReference = verseNumberText;
82-
8351 if (isSection == false ) {
8452 String verseId = '${readerArea .name }-$bookCode -$chapterNumber -$verseNumberText ' ;
8553 String bookmarkIcon = bookmarkIconHTML (verseId, bookmarks);
8654
87- if (isNewParagraph == false ) {
88- htmlText +=
89- '<span ondblclick=onCreateBookmark("$verseId ") class="p">$bookmarkIcon <sup id="$verseId "> $verseNumberText </sup>' ;
90- } else {
91- htmlText +=
92- '<p ondblclick=onCreateBookmark("$verseId ") class="p">$chapterNumberHtml $bookmarkIcon <sup id="$verseId "> $verseNumberText </sup>' ;
93- }
55+ htmlText +=
56+ '<p ondblclick=onCreateBookmark("$verseId ") class="p">$chapterNumberHtml $bookmarkIcon <sup id="$verseId "> $verseNumberText </sup>' ;
9457 }
9558 } else if (key == 'verseText' ) {
9659 // Note: we remove numbers and markings related to links for now
@@ -102,29 +65,12 @@ class OETLiteralBibleImpl extends JsonToBible {
10265 .replaceAll ('>' , ' ' )
10366 .replaceAll ('=' , ' ' );
10467
105- if (isSection == true && isNext == true ) {
106- String verseId = '${readerArea .name }-$bookCode -$chapterNumber -$sectionVerseReference ' ;
107- String bookmarkIcon = bookmarkIconHTML (verseId, bookmarks);
108- htmlText += """<p>
109- <div class="section-box">
110- <p><sup id="$verseId ">$chapterNumber :$sectionVerseReference </sup> ${sectionText .replaceAll ("'" , "’" )}</p>
111- </div>
112- <span ondblclick=onCreateBookmark("$verseId ") class="p">
113- $chapterNumberHtml $bookmarkIcon <sup>$sectionVerseReference </sup> ${verseText .replaceAll ("'" , "’" )}
114- </span>
115- """ ;
116-
117- isSection = false ;
118- isNext = false ;
119- } else {
120- htmlText += " ${verseText .replaceAll ("'" , "’" )}</span>" ;
121- }
68+ htmlText += " ${verseText .replaceAll ("'" , "’" )}</span>" ;
12269 }
12370 }
12471 }
12572 }
12673
127- //log(htmlText);
12874 return htmlText;
12975 }
13076}
0 commit comments