node-sword-interface 0.246.0 → 0.247.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -43,7 +43,7 @@ TextProcessor::TextProcessor(ModuleStore& moduleStore, ModuleHelper& moduleHelpe
|
|
|
43
43
|
this->_rawMarkupEnabled = false;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
string TextProcessor::getFilteredText(const string& text, int chapter, bool hasStrongs, bool hasDuplicateClosingEndDivs)
|
|
46
|
+
string TextProcessor::getFilteredText(const string& text, int chapter, int verseNr, bool hasStrongs, bool hasDuplicateClosingEndDivs)
|
|
47
47
|
{
|
|
48
48
|
//static regex schlachterMarkupFilter = regex("<H.*> ");
|
|
49
49
|
static string chapterFilter = "<chapter";
|
|
@@ -126,7 +126,8 @@ string TextProcessor::getFilteredText(const string& text, int chapter, bool hasS
|
|
|
126
126
|
|
|
127
127
|
stringstream sectionTitleElement;
|
|
128
128
|
sectionTitleElement << "<div class=\"sword-markup sword-section-title\" ";
|
|
129
|
-
sectionTitleElement << "chapter=\"" << chapter << "\"";
|
|
129
|
+
sectionTitleElement << "chapter=\"" << chapter << "\" ";
|
|
130
|
+
sectionTitleElement << "verse=\"" << verseNr << "\"";
|
|
130
131
|
this->findAndReplaceAll(filteredText, titleStartElementFilter, sectionTitleElement.str());
|
|
131
132
|
this->findAndReplaceAll(filteredText, divTitleElementFilter, sectionTitleElement.str());
|
|
132
133
|
|
|
@@ -181,7 +182,7 @@ string TextProcessor::getCurrentChapterHeading(sword::SWModule* module)
|
|
|
181
182
|
string chapterHeading = "";
|
|
182
183
|
VerseKey currentVerseKey = module->getKey();
|
|
183
184
|
int currentChapter = currentVerseKey.getChapter();
|
|
184
|
-
int
|
|
185
|
+
int currentVerseNr = currentVerseKey.getVerse();
|
|
185
186
|
|
|
186
187
|
if (currentVerseKey.getVerse() == 1) { // X:1, set key to X:0
|
|
187
188
|
// Include chapter/book/testament/module intros
|
|
@@ -201,10 +202,10 @@ string TextProcessor::getCurrentChapterHeading(sword::SWModule* module)
|
|
|
201
202
|
if (this->_markupEnabled && !this->_rawMarkupEnabled) {
|
|
202
203
|
// The chapter headings in the ISV are screwed up somehow for 1:1
|
|
203
204
|
// Therefore we do not render chapter headings for the first verse of the book in this case.
|
|
204
|
-
if (currentChapter == 1 &&
|
|
205
|
+
if (currentChapter == 1 && currentVerseNr == 1 && currentModuleName == "ISV") {
|
|
205
206
|
chapterHeading = "";
|
|
206
207
|
} else {
|
|
207
|
-
chapterHeading = this->getFilteredText(chapterHeading, currentChapter);
|
|
208
|
+
chapterHeading = this->getFilteredText(chapterHeading, currentChapter, currentVerseNr);
|
|
208
209
|
}
|
|
209
210
|
}
|
|
210
211
|
|
|
@@ -219,12 +220,13 @@ string TextProcessor::getCurrentVerseText(sword::SWModule* module, bool hasStron
|
|
|
219
220
|
if (this->_markupEnabled && !forceNoMarkup) {
|
|
220
221
|
VerseKey currentVerseKey = module->getKey();
|
|
221
222
|
int currentChapter = currentVerseKey.getChapter();
|
|
223
|
+
int currentVerseNr = currentVerseKey.getVerse();
|
|
222
224
|
verseText = string(module->getRawEntry());
|
|
223
225
|
StringHelper::trim(verseText);
|
|
224
226
|
filteredText = verseText;
|
|
225
227
|
|
|
226
228
|
if (!this->_rawMarkupEnabled) {
|
|
227
|
-
filteredText = this->getFilteredText(verseText, currentChapter, hasStrongs, hasDuplicateClosingEndDivs);
|
|
229
|
+
filteredText = this->getFilteredText(verseText, currentChapter, currentVerseNr, hasStrongs, hasDuplicateClosingEndDivs);
|
|
228
230
|
}
|
|
229
231
|
} else {
|
|
230
232
|
verseText = string(module->stripText());
|
|
@@ -60,7 +60,7 @@ private:
|
|
|
60
60
|
int verseCount=-1);
|
|
61
61
|
|
|
62
62
|
std::string getCurrentChapterHeading(sword::SWModule* module);
|
|
63
|
-
std::string getFilteredText(const std::string& text, int chapter, bool hasStrongs=false, bool hasDuplicateClosingEndDivs=false);
|
|
63
|
+
std::string getFilteredText(const std::string& text, int chapter, int verseNr, bool hasStrongs=false, bool hasDuplicateClosingEndDivs=false);
|
|
64
64
|
std::string replaceSpacesInStrongs(const std::string& text);
|
|
65
65
|
unsigned int findAndReplaceAll(std::string & data, std::string toSearch, std::string replaceStr);
|
|
66
66
|
|