Skip to content

Commit 1d0da1a

Browse files
Update Bible implementations
1 parent df21672 commit 1d0da1a

3 files changed

Lines changed: 12 additions & 62 deletions

File tree

lib/models/bibles/kjv_bible.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import 'dart:developer';
22
import '../../common/enums.dart';
33
import '../json_to_bible.dart';
44

5-
/// KJV version implementation
5+
/// King James Version (KJV) implementation.
6+
///
7+
/// The KJV is displayed in chapters verse-by-verse.
68
class KJVBibleImpl extends JsonToBible {
79
KJVBibleImpl(Map<String, dynamic> json) : super(json: json);
810

Lines changed: 6 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import '../../common/enums.dart';
22
import '../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.
57
class 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
}

lib/models/bibles/oet_rv_bible.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import 'dart:developer';
33
import '../../common/enums.dart';
44
import '../json_to_bible.dart';
55

6-
/// OET Reader's version implementation
6+
/// The OET Reader's Version (OET-RV) implementation
7+
///
8+
/// The OET-RV is displayed in sections paragraph-by-paragraph and contains section boxes.
79
class OETReadersBibleImpl extends JsonToBible {
810
OETReadersBibleImpl(Map<String, dynamic> json) : super(json: json);
911

0 commit comments

Comments
 (0)