46
46
// This class filters USFM text, converting it into other formats.
49
Filter_Text::Filter_Text (string bible_in)
49
Filter_Text::Filter_Text (string bible)
52
currentBookIdentifier = 0;
53
currentChapterNumber = 0;
54
heading_started = false;
56
odf_text_standard = nullptr;
57
odf_text_text_only = nullptr;
58
odf_text_text_and_note_citations = nullptr;
59
odf_text_notes = nullptr;
60
html_text_standard = nullptr;
61
html_text_linked = nullptr;
62
onlinebible_text = nullptr;
63
esword_text = nullptr;
66
headings_text_per_verse_active = false;
67
space_type_after_verse = Database_Config_Bible::getOdtSpaceAfterVerse (bible);
68
is_within_figure_markup = false;
69
odt_left_align_verse_in_poetry_styles = Database_Config_Bible::getOdtPoetryVersesLeft (bible);
52
space_type_after_verse = Database_Config_Bible::getOdtSpaceAfterVerse (m_bible);
53
odt_left_align_verse_in_poetry_styles = Database_Config_Bible::getOdtPoetryVersesLeft (m_bible);
99
83
usfm = filter_string_trim (usfm);
101
85
// Sort the USFM code out and separate it into markers and text.
102
vector <string> markersAndText = filter::usfm::get_markers_and_text (usfm);
86
vector <string> markers_and_text = filter::usfm::get_markers_and_text (usfm);
103
87
// Add the USFM to the object.
104
usfmMarkersAndText.insert (usfmMarkersAndText.end(), markersAndText.begin(), markersAndText.end());
88
m_usfm_markers_and_text.insert (m_usfm_markers_and_text.end(), markers_and_text.begin(), markers_and_text.end());
136
120
// This function return true when there is still unprocessed USFM code available.
137
bool Filter_Text::unprocessedUsfmCodeAvailable ()
121
bool Filter_Text::unprocessed_usfm_code_available ()
139
return (usfmMarkersAndTextPointer < usfmMarkersAndText.size());
123
return (usfm_markers_and_text_ptr < m_usfm_markers_and_text.size());
144
128
// This function stores data in the class:
145
129
// The next chapter from the unprocessed USFM code.
146
void Filter_Text::getUsfmNextChapter ()
130
void Filter_Text::get_usfm_next_chapter ()
148
132
// Initialization.
149
133
chapter_usfm_markers_and_text.clear();
212
196
// extracting a variety of information, creating note citations, etc.
213
197
void Filter_Text::pre_process_usfm ()
215
usfmMarkersAndTextPointer = 0;
216
while (unprocessedUsfmCodeAvailable ()) {
217
getUsfmNextChapter ();
199
usfm_markers_and_text_ptr = 0;
200
while (unprocessed_usfm_code_available ()) {
201
get_usfm_next_chapter ();
218
202
for (chapter_usfm_markers_and_text_pointer = 0; chapter_usfm_markers_and_text_pointer < chapter_usfm_markers_and_text.size(); chapter_usfm_markers_and_text_pointer++) {
219
203
string currentItem = chapter_usfm_markers_and_text[chapter_usfm_markers_and_text_pointer];
220
204
if (filter::usfm::is_usfm_marker (currentItem)) {
233
217
string usfm_id = filter::usfm::get_book_identifier (chapter_usfm_markers_and_text, chapter_usfm_markers_and_text_pointer);
234
218
usfm_id = filter_string_str_replace (soft_hyphen_u00AD (), "", usfm_id); // Remove possible soft hyphen.
235
219
// Get Bibledit book number.
236
currentBookIdentifier = database::books::get_id_from_usfm (usfm_id);
220
m_current_book_identifier = database::books::get_id_from_usfm (usfm_id);
237
221
// Reset chapter and verse numbers.
238
currentChapterNumber = 0;
239
numberOfChaptersPerBook[currentBookIdentifier] = 0;
222
m_current_chapter_number = 0;
223
numberOfChaptersPerBook[m_current_book_identifier] = 0;
240
224
currentVerseNumber = "0";
244
228
case IdentifierSubtypeRunningHeader:
246
230
string runningHeader = filter::usfm::get_text_following_marker (chapter_usfm_markers_and_text, chapter_usfm_markers_and_text_pointer);
247
runningHeaders.push_back (filter::text::passage_marker_value (currentBookIdentifier, currentChapterNumber, currentVerseNumber, marker, runningHeader));
231
runningHeaders.push_back (filter::text::passage_marker_value (m_current_book_identifier, m_current_chapter_number, currentVerseNumber, marker, runningHeader));
250
234
case IdentifierSubtypeLongTOC:
252
236
string longTOC = filter::usfm::get_text_following_marker (chapter_usfm_markers_and_text, chapter_usfm_markers_and_text_pointer);
253
longTOCs.push_back (filter::text::passage_marker_value (currentBookIdentifier, currentChapterNumber, currentVerseNumber, marker, longTOC));
237
longTOCs.push_back (filter::text::passage_marker_value (m_current_book_identifier, m_current_chapter_number, currentVerseNumber, marker, longTOC));
256
240
case IdentifierSubtypeShortTOC:
258
242
string shortTOC = filter::usfm::get_text_following_marker (chapter_usfm_markers_and_text, chapter_usfm_markers_and_text_pointer);
259
shortTOCs.push_back (filter::text::passage_marker_value (currentBookIdentifier, currentChapterNumber, currentVerseNumber, marker, shortTOC));
243
shortTOCs.push_back (filter::text::passage_marker_value (m_current_book_identifier, m_current_chapter_number, currentVerseNumber, marker, shortTOC));
262
246
case IdentifierSubtypeBookAbbrev:
264
248
string bookAbbreviation = filter::usfm::get_text_following_marker (chapter_usfm_markers_and_text, chapter_usfm_markers_and_text_pointer);
265
bookAbbreviations.push_back (filter::text::passage_marker_value (currentBookIdentifier, currentChapterNumber, currentVerseNumber, marker, bookAbbreviation));
249
bookAbbreviations.push_back (filter::text::passage_marker_value (m_current_book_identifier, m_current_chapter_number, currentVerseNumber, marker, bookAbbreviation));
268
252
case IdentifierSubtypeChapterLabel:
270
254
// Store the chapter label for this book and chapter.
271
255
string chapterLabel = filter::usfm::get_text_following_marker (chapter_usfm_markers_and_text, chapter_usfm_markers_and_text_pointer);
272
chapterLabels.push_back (filter::text::passage_marker_value (currentBookIdentifier, currentChapterNumber, currentVerseNumber, marker, chapterLabel));
256
chapterLabels.push_back (filter::text::passage_marker_value (m_current_book_identifier, m_current_chapter_number, currentVerseNumber, marker, chapterLabel));
273
257
// If a chapter label is in the book, there's no drop caps output of the chapter number.
274
book_has_chapter_label [currentBookIdentifier] = true;
258
book_has_chapter_label [m_current_book_identifier] = true;
278
262
case IdentifierSubtypePublishedChapterMarker:
280
264
string publishedChapterMarker = filter::usfm::get_text_following_marker (chapter_usfm_markers_and_text, chapter_usfm_markers_and_text_pointer);
281
publishedChapterMarkers.push_back (filter::text::passage_marker_value (currentBookIdentifier, currentChapterNumber, currentVerseNumber, marker, publishedChapterMarker));
265
publishedChapterMarkers.push_back (filter::text::passage_marker_value (m_current_book_identifier, m_current_chapter_number, currentVerseNumber, marker, publishedChapterMarker));
284
268
case IdentifierSubtypePublishedVerseMarker:
287
271
// The marker looks like: ... \vp ၁။\vp* ...
288
272
// It stores this markup in the object for later reference.
289
273
string publishedVerseMarker = filter::usfm::get_text_following_marker (chapter_usfm_markers_and_text, chapter_usfm_markers_and_text_pointer);
290
publishedVerseMarkers.push_back (filter::text::passage_marker_value (currentBookIdentifier, currentChapterNumber, currentVerseNumber, marker, publishedVerseMarker));
274
publishedVerseMarkers.push_back (filter::text::passage_marker_value (m_current_book_identifier, m_current_chapter_number, currentVerseNumber, marker, publishedVerseMarker));
356
340
void Filter_Text::process_usfm ()
358
342
// Go through the USFM code.
359
int processedBooksCount = 0;
360
usfmMarkersAndTextPointer = 0;
361
while (unprocessedUsfmCodeAvailable ()) {
362
getUsfmNextChapter ();
343
int processed_books_count {0};
344
usfm_markers_and_text_ptr = 0;
345
while (unprocessed_usfm_code_available ()) {
346
get_usfm_next_chapter ();
363
347
for (chapter_usfm_markers_and_text_pointer = 0; chapter_usfm_markers_and_text_pointer < chapter_usfm_markers_and_text.size(); chapter_usfm_markers_and_text_pointer++) {
364
348
string currentItem = chapter_usfm_markers_and_text [chapter_usfm_markers_and_text_pointer];
365
349
if (filter::usfm::is_usfm_marker (currentItem))
367
351
// Indicator describing the marker.
368
bool isOpeningMarker = filter::usfm::is_opening_marker (currentItem);
369
bool isEmbeddedMarker = filter::usfm::is_embedded_marker (currentItem);
352
bool is_opening_marker = filter::usfm::is_opening_marker (currentItem);
353
bool is_embedded_marker = filter::usfm::is_embedded_marker (currentItem);
370
354
// Clean up the marker, so we remain with the basic version, e.g. 'id'.
371
355
string marker = filter::usfm::get_marker (currentItem);
372
356
// Strip word-level attributes.
373
if (isOpeningMarker) filter::usfm::remove_word_level_attributes (marker, chapter_usfm_markers_and_text, chapter_usfm_markers_and_text_pointer);
357
if (is_opening_marker) filter::usfm::remove_word_level_attributes (marker, chapter_usfm_markers_and_text, chapter_usfm_markers_and_text_pointer);
374
358
if (styles.find (marker) != styles.end())
376
360
// Deal with known style.
392
376
// Get book number.
393
377
string usfm_id = filter::usfm::get_book_identifier (chapter_usfm_markers_and_text, chapter_usfm_markers_and_text_pointer);
394
378
usfm_id = filter_string_str_replace (soft_hyphen_u00AD (), "", usfm_id); // Remove possible soft hyphen.
395
currentBookIdentifier = database::books::get_id_from_usfm (usfm_id);
379
m_current_book_identifier = database::books::get_id_from_usfm (usfm_id);
396
380
// Reset chapter and verse numbers.
397
currentChapterNumber = 0;
381
m_current_chapter_number = 0;
398
382
currentVerseNumber = "0";
399
383
// Throw away whatever follows the \id, e.g. 'GEN xxx xxx'.
400
384
filter::usfm::get_text_following_marker (chapter_usfm_markers_and_text, chapter_usfm_markers_and_text_pointer);
401
385
// Whether to insert a new page before the book. But never before the first book.
402
386
if (style.userbool1) {
403
if (processedBooksCount) {
387
if (processed_books_count) {
404
388
if (odf_text_standard) odf_text_standard->new_page_break ();
405
389
if (odf_text_text_only) odf_text_text_only->new_page_break ();
406
390
if (odf_text_text_and_note_citations) odf_text_text_and_note_citations->new_page_break ();
408
392
if (html_text_linked) html_text_linked->new_page_break ();
411
processedBooksCount++;
395
processed_books_count++;
413
397
note_citations.restart("book");
415
399
if (onlinebible_text) onlinebible_text->storeData ();
417
if (esword_text) esword_text->newBook (currentBookIdentifier);
401
if (esword_text) esword_text->newBook (m_current_book_identifier);
418
402
// The hidden header in the text normally displays in the running header.
419
403
// It does this only when it's the first header on the page.
420
404
// The book starts here.
421
405
// So create a correct hidden header for displaying in the running header.
422
string runningHeader = database::books::get_english_from_id (currentBookIdentifier);
406
string runningHeader = database::books::get_english_from_id (m_current_book_identifier);
423
407
for (auto item : runningHeaders) {
424
if (item.m_book == currentBookIdentifier) {
408
if (item.m_book == m_current_book_identifier) {
425
409
runningHeader = item.m_value;
575
559
case StyleTypeInlineText:
577
561
// Support for a normal and an embedded character style.
578
if (isOpeningMarker) {
579
if (odf_text_standard) odf_text_standard->open_text_style (style, false, isEmbeddedMarker);
580
if (odf_text_text_only) odf_text_text_only->open_text_style (style, false, isEmbeddedMarker);
581
if (odf_text_text_and_note_citations) odf_text_text_and_note_citations->open_text_style (style, false, isEmbeddedMarker);
582
if (html_text_standard) html_text_standard->open_text_style (style, false, isEmbeddedMarker);
583
if (html_text_linked) html_text_linked->open_text_style (style, false, isEmbeddedMarker);
562
if (is_opening_marker) {
563
if (odf_text_standard) odf_text_standard->open_text_style (style, false, is_embedded_marker);
564
if (odf_text_text_only) odf_text_text_only->open_text_style (style, false, is_embedded_marker);
565
if (odf_text_text_and_note_citations) odf_text_text_and_note_citations->open_text_style (style, false, is_embedded_marker);
566
if (html_text_standard) html_text_standard->open_text_style (style, false, is_embedded_marker);
567
if (html_text_linked) html_text_linked->open_text_style (style, false, is_embedded_marker);
585
if (odf_text_standard) odf_text_standard->close_text_style (false, isEmbeddedMarker);
586
if (odf_text_text_only) odf_text_text_only->close_text_style (false, isEmbeddedMarker);
587
if (odf_text_text_and_note_citations) odf_text_text_and_note_citations->close_text_style (false, isEmbeddedMarker);
588
if (html_text_standard) html_text_standard->close_text_style (false, isEmbeddedMarker);
589
if (html_text_linked) html_text_linked->close_text_style (false, isEmbeddedMarker);
569
if (odf_text_standard) odf_text_standard->close_text_style (false, is_embedded_marker);
570
if (odf_text_text_only) odf_text_text_only->close_text_style (false, is_embedded_marker);
571
if (odf_text_text_and_note_citations) odf_text_text_and_note_citations->close_text_style (false, is_embedded_marker);
572
if (html_text_standard) html_text_standard->close_text_style (false, is_embedded_marker);
573
if (html_text_linked) html_text_linked->close_text_style (false, is_embedded_marker);
606
590
int inumber = convert_to_int (number);
608
592
// Update this object.
609
currentChapterNumber = inumber;
593
m_current_chapter_number = inumber;
610
594
currentVerseNumber = "0";
612
596
// If there is a published chapter character, the chapter number takes that value.
613
597
for (auto publishedChapterMarker : publishedChapterMarkers) {
614
if (publishedChapterMarker.m_book == currentBookIdentifier) {
615
if (publishedChapterMarker.m_chapter == currentChapterNumber) {
598
if (publishedChapterMarker.m_book == m_current_book_identifier) {
599
if (publishedChapterMarker.m_chapter == m_current_chapter_number) {
616
600
number = publishedChapterMarker.m_value;
617
601
inumber = convert_to_int (number);
638
622
text_text->paragraph (number);
640
624
// The chapter number is only output when there is more than one chapter in a book.
641
if (numberOfChaptersPerBook [currentBookIdentifier] > 1) {
625
if (numberOfChaptersPerBook [m_current_book_identifier] > 1) {
642
626
// Putting the chapter number at the first verse is determined by the style of the \c marker.
643
627
// But if a chapter label (\cl) is found in the current book, that disables the above.
644
bool cl_found = book_has_chapter_label[currentBookIdentifier];
628
bool cl_found = book_has_chapter_label[m_current_book_identifier];
645
629
if (style.userbool1 && !cl_found) {
646
630
// Output the chapter number at the first verse, not here.
647
631
// Store it for later processing.
656
640
string labelEntireBook {};
657
641
string labelCurrentChapter {};
658
642
for (auto pchapterLabel : chapterLabels) {
659
if (pchapterLabel.m_book == currentBookIdentifier) {
643
if (pchapterLabel.m_book == m_current_book_identifier) {
660
644
if (pchapterLabel.m_chapter == 0) {
661
645
labelEntireBook = pchapterLabel.m_value;
663
if (pchapterLabel.m_chapter == currentChapterNumber) {
647
if (pchapterLabel.m_chapter == m_current_chapter_number) {
664
648
labelCurrentChapter = pchapterLabel.m_value;
712
696
// Handle a situation that a verse number starts a new paragraph.
713
697
if (style.userbool1) {
714
698
if (odf_text_standard) {
715
if (!odf_text_standard->current_paragraph_content.empty()) {
716
odf_text_standard->new_paragraph (odf_text_standard->current_paragraph_style);
699
if (!odf_text_standard->m_current_paragraph_content.empty()) {
700
odf_text_standard->new_paragraph (odf_text_standard->m_current_paragraph_style);
719
703
if (odf_text_text_only) {
720
if (!odf_text_text_only->current_paragraph_content.empty()) {
721
odf_text_text_only->new_paragraph (odf_text_text_only->current_paragraph_style);
704
if (!odf_text_text_only->m_current_paragraph_content.empty()) {
705
odf_text_text_only->new_paragraph (odf_text_text_only->m_current_paragraph_style);
724
708
if (odf_text_text_and_note_citations) {
725
if (!odf_text_text_and_note_citations->current_paragraph_content.empty()) {
726
odf_text_text_and_note_citations->new_paragraph (odf_text_text_and_note_citations->current_paragraph_style);
709
if (!odf_text_text_and_note_citations->m_current_paragraph_content.empty()) {
710
odf_text_text_and_note_citations->new_paragraph (odf_text_text_and_note_citations->m_current_paragraph_style);
729
713
if (html_text_standard) {
768
752
// In case there was a published verse marker, use that markup for publishing.
769
753
string v_vp_number = v_number;
770
754
for (auto publishedVerseMarker : publishedVerseMarkers) {
771
if (publishedVerseMarker.m_book == currentBookIdentifier) {
772
if (publishedVerseMarker.m_chapter == currentChapterNumber) {
755
if (publishedVerseMarker.m_book == m_current_book_identifier) {
756
if (publishedVerseMarker.m_chapter == m_current_chapter_number) {
773
757
if (publishedVerseMarker.m_verse == currentVerseNumber) {
774
758
v_vp_number = publishedVerseMarker.m_value;
780
764
if (output_chapter_text_at_first_verse.empty ()) {
781
765
// If the current paragraph has text already, then insert a space.
782
766
if (odf_text_standard) {
783
if (!odf_text_standard->current_paragraph_content.empty()) {
767
if (!odf_text_standard->m_current_paragraph_content.empty()) {
784
768
odf_text_standard->add_text (" ");
787
771
if (odf_text_text_only) {
788
if (!odf_text_text_only->current_paragraph_content.empty()) {
772
if (!odf_text_text_only->m_current_paragraph_content.empty()) {
789
773
odf_text_text_only->add_text (" ");
792
776
if (odf_text_text_and_note_citations) {
793
if (!odf_text_text_and_note_citations->current_paragraph_content.empty()) {
777
if (!odf_text_text_and_note_citations->m_current_paragraph_content.empty()) {
794
778
odf_text_text_and_note_citations->add_text (" ");
853
837
// If a chapter number was put, do not output any white space.
854
838
if (output_chapter_text_at_first_verse.empty()) {
855
839
if (odf_text_standard) {
856
bool tab = odt_left_align_verse_in_poetry_styles && filter::usfm::is_standard_q_poetry (odf_text_standard->current_paragraph_style);
840
bool tab = odt_left_align_verse_in_poetry_styles && filter::usfm::is_standard_q_poetry (odf_text_standard->m_current_paragraph_style);
857
841
if (tab) odf_text_standard->add_tab();
858
842
else odf_text_standard->add_text (space_type_after_verse);
860
844
if (odf_text_text_only) {
861
bool tab = odt_left_align_verse_in_poetry_styles && filter::usfm::is_standard_q_poetry (odf_text_text_only->current_paragraph_style);
845
bool tab = odt_left_align_verse_in_poetry_styles && filter::usfm::is_standard_q_poetry (odf_text_text_only->m_current_paragraph_style);
862
846
if (tab) odf_text_text_only->add_tab();
863
847
else odf_text_text_only->add_text (space_type_after_verse);
865
849
if (odf_text_text_and_note_citations) {
866
bool tab = odt_left_align_verse_in_poetry_styles && filter::usfm::is_standard_q_poetry (odf_text_text_and_note_citations->current_paragraph_style);
850
bool tab = odt_left_align_verse_in_poetry_styles && filter::usfm::is_standard_q_poetry (odf_text_text_and_note_citations->m_current_paragraph_style);
867
851
if (tab) odf_text_text_and_note_citations->add_tab();
868
852
else odf_text_text_and_note_citations->add_text (space_type_after_verse);
938
922
case StyleTypePicture:
940
if (isOpeningMarker) {
941
// Set a flag that the parser is going to be within figure markup.
924
if (is_opening_marker) {
925
// Set a flag that the parser is going to be within figure markup and save the style.
942
926
is_within_figure_markup = true;
927
figure_marker = marker;
928
// Create the style for the figure because it is used within the ODT generator.
929
create_paragraph_style (style, false);
943
930
// At the start of the \fig marker, close all text styles that might be open.
944
931
if (odf_text_standard) odf_text_standard->close_text_style (false, false);
945
932
if (odf_text_text_only) odf_text_text_only->close_text_style (false, false);
1006
993
case WorListElementSubtypeWordlistGlossaryDictionary:
1008
if (isOpeningMarker) {
995
if (is_opening_marker) {
1009
996
addToWordList (wordListGlossaryDictionary);
1013
1000
case WorListElementSubtypeHebrewWordlistEntry:
1015
if (isOpeningMarker) {
1002
if (is_opening_marker) {
1016
1003
addToWordList (hebrewWordList);
1020
1007
case WorListElementSubtypeGreekWordlistEntry:
1022
if (isOpeningMarker) {
1009
if (is_opening_marker) {
1023
1010
addToWordList (greekWordList);
1027
1014
case WorListElementSubtypeSubjectIndexEntry:
1029
if (isOpeningMarker) {
1016
if (is_opening_marker) {
1030
1017
addToWordList (subjectIndex);
1036
if (isOpeningMarker) {
1023
if (is_opening_marker) {
1037
1024
addToFallout (R"(Unknown word list marker \)" + marker, false);
1066
1053
// Store the name of this image in the object, ready to be copied into place if needed.
1067
1054
image_sources.push_back(src);
1068
1055
// Add the image to the various output formats.
1069
if (odf_text_standard) odf_text_standard->add_image(alt, src, caption);
1070
if (odf_text_text_only) odf_text_text_only->add_image(alt, src, caption);
1071
if (odf_text_text_and_note_citations) odf_text_text_and_note_citations->add_image(alt, src, caption);
1072
if (html_text_standard) html_text_standard->add_image(alt, src, caption);
1073
if (html_text_linked) html_text_linked->add_image(alt, src, caption);
1056
if (odf_text_standard) odf_text_standard->add_image(figure_marker, alt, src, caption);
1057
if (odf_text_text_only) odf_text_text_only->add_image(figure_marker, alt, src, caption);
1058
if (odf_text_text_and_note_citations) odf_text_text_and_note_citations->add_image(figure_marker, alt, src, caption);
1059
if (html_text_standard) html_text_standard->add_image(figure_marker, alt, src, caption);
1060
if (html_text_linked) html_text_linked->add_image(figure_marker, alt, src, caption);
1076
1063
// Treat this content as text.
1080
1067
// output a tab before any text.
1081
1068
if (odf_text_standard)
1082
1069
if (odt_left_align_verse_in_poetry_styles)
1083
if (filter::usfm::is_standard_q_poetry (odf_text_standard->current_paragraph_style))
1084
if (odf_text_standard->current_paragraph_content.empty())
1070
if (filter::usfm::is_standard_q_poetry (odf_text_standard->m_current_paragraph_style))
1071
if (odf_text_standard->m_current_paragraph_content.empty())
1085
1072
odf_text_standard->add_tab();
1086
1073
if (odf_text_text_only)
1087
1074
if (odt_left_align_verse_in_poetry_styles)
1088
if (filter::usfm::is_standard_q_poetry (odf_text_text_only->current_paragraph_style))
1089
if (odf_text_text_only->current_paragraph_content.empty())
1075
if (filter::usfm::is_standard_q_poetry (odf_text_text_only->m_current_paragraph_style))
1076
if (odf_text_text_only->m_current_paragraph_content.empty())
1090
1077
odf_text_text_only->add_tab();
1091
1078
if (odf_text_text_and_note_citations)
1092
1079
if (odt_left_align_verse_in_poetry_styles)
1093
if (filter::usfm::is_standard_q_poetry (odf_text_text_and_note_citations->current_paragraph_style))
1094
if (odf_text_text_and_note_citations->current_paragraph_content.empty())
1080
if (filter::usfm::is_standard_q_poetry (odf_text_text_and_note_citations->m_current_paragraph_style))
1081
if (odf_text_text_and_note_citations->m_current_paragraph_content.empty())
1095
1082
odf_text_text_and_note_citations->add_tab();
1096
1083
// Output text as normal.
1097
1084
if (odf_text_standard) odf_text_standard->add_text (currentItem);
1168
1155
if (odf_text_standard) odf_text_standard->add_note (citation, marker);
1169
1156
// Note citation in superscript in the document with text and note citations.
1170
1157
if (odf_text_text_and_note_citations) {
1171
vector <string> currentTextStyles = odf_text_text_and_note_citations->current_text_style;
1172
odf_text_text_and_note_citations->current_text_style = {"superscript"};
1158
vector <string> currentTextStyles = odf_text_text_and_note_citations->m_current_text_style;
1159
odf_text_text_and_note_citations->m_current_text_style = {"superscript"};
1173
1160
odf_text_text_and_note_citations->add_text (citation);
1174
odf_text_text_and_note_citations->current_text_style = currentTextStyles;
1161
odf_text_text_and_note_citations->m_current_text_style = currentTextStyles;
1176
1163
// Add space if the paragraph has text already.
1177
1164
if (odf_text_notes) {
1178
if (odf_text_notes->current_paragraph_content != "") {
1165
if (odf_text_notes->m_current_paragraph_content != "") {
1179
1166
odf_text_notes->add_text (" ");
1204
1191
if (odf_text_standard) odf_text_standard->add_note (citation, marker, true);
1205
1192
// Note citation in superscript in the document with text and note citations.
1206
1193
if (odf_text_text_and_note_citations) {
1207
vector <string> currentTextStyles = odf_text_text_and_note_citations->current_text_style;
1208
odf_text_text_and_note_citations->current_text_style = {"superscript"};
1194
vector <string> currentTextStyles = odf_text_text_and_note_citations->m_current_text_style;
1195
odf_text_text_and_note_citations->m_current_text_style = {"superscript"};
1209
1196
odf_text_text_and_note_citations->add_text (citation);
1210
odf_text_text_and_note_citations->current_text_style = currentTextStyles;
1197
odf_text_text_and_note_citations->m_current_text_style = currentTextStyles;
1212
1199
// Open note in the web page.
1213
1200
if (html_text_standard) html_text_standard->add_note (citation, standardContentMarkerFootEndNote, true);
1281
1268
if (odf_text_standard) odf_text_standard->add_note (citation, marker);
1282
1269
// Note citation in superscript in the document with text and note citations.
1283
1270
if (odf_text_text_and_note_citations) {
1284
vector <string> currentTextStyles = odf_text_text_and_note_citations->current_text_style;
1285
odf_text_text_and_note_citations->current_text_style = {"superscript"};
1271
vector <string> currentTextStyles = odf_text_text_and_note_citations->m_current_text_style;
1272
odf_text_text_and_note_citations->m_current_text_style = {"superscript"};
1286
1273
odf_text_text_and_note_citations->add_text (citation);
1287
odf_text_text_and_note_citations->current_text_style = currentTextStyles;
1274
odf_text_text_and_note_citations->m_current_text_style = currentTextStyles;
1289
1276
// Add a space if the paragraph has text already.
1290
1277
if (odf_text_notes) {
1291
if (odf_text_notes->current_paragraph_content != "") {
1278
if (odf_text_notes->m_current_paragraph_content != "") {
1292
1279
odf_text_notes->add_text (" ");
1536
// This function ensures that a certain paragraph style is in the OpenDocument.
1537
// $style: The style to use.
1538
// $keepWithNext: Whether to keep this paragraph with the next one.
1539
void Filter_Text::create_paragraph_style (const Database_Styles_Item & style, bool keepWithNext)
1541
string marker = style.marker;
1542
if (find (createdStyles.begin(), createdStyles.end(), marker) == createdStyles.end()) {
1543
string fontname = Database_Config_Bible::getExportFont (m_bible);
1544
float fontsize = style.fontsize;
1545
int italic = style.italic;
1546
int bold = style.bold;
1547
int underline = style.underline;
1548
int smallcaps = style.smallcaps;
1549
int alignment = style.justification;
1550
float spacebefore = style.spacebefore;
1551
float spaceafter = style.spaceafter;
1552
float leftmargin = style.leftmargin;
1553
float rightmargin = style.rightmargin;
1554
float firstlineindent = style.firstlineindent;
1555
// Columns are not implemented at present. Reason:
1556
// Copying and pasting sections with columns between documents in LibreOffice failed to work.
1557
// int spancolumns = style.spancolumns;
1559
if (odf_text_standard) odf_text_standard->create_paragraph_style (marker, fontname, fontsize, italic, bold, underline, smallcaps, alignment, spacebefore, spaceafter, leftmargin, rightmargin, firstlineindent, keepWithNext, dropcaps);
1560
if (odf_text_text_only) odf_text_text_only->create_paragraph_style (marker, fontname, fontsize, italic, bold, underline, smallcaps, alignment, spacebefore, spaceafter, leftmargin, rightmargin, firstlineindent, keepWithNext, dropcaps);
1561
if (odf_text_text_and_note_citations) odf_text_text_and_note_citations->create_paragraph_style (marker, fontname, fontsize, italic, bold, underline, smallcaps, alignment, spacebefore, spaceafter, leftmargin, rightmargin, firstlineindent, keepWithNext, dropcaps);
1562
createdStyles.push_back (marker);
1550
1567
// This function ensures that a certain paragraph style is in the OpenDocument,
1551
1568
// and then opens a paragraph with that style.
1553
1570
// $keepWithNext: Whether to keep this paragraph with the next one.
1554
1571
void Filter_Text::new_paragraph (const Database_Styles_Item & style, bool keepWithNext)
1573
create_paragraph_style(style, keepWithNext);
1556
1574
string marker = style.marker;
1557
if (find (createdStyles.begin(), createdStyles.end(), marker) == createdStyles.end()) {
1558
string fontname = Database_Config_Bible::getExportFont (bible);
1559
float fontsize = style.fontsize;
1560
int italic = style.italic;
1561
int bold = style.bold;
1562
int underline = style.underline;
1563
int smallcaps = style.smallcaps;
1564
int alignment = style.justification;
1565
float spacebefore = style.spacebefore;
1566
float spaceafter = style.spaceafter;
1567
float leftmargin = style.leftmargin;
1568
float rightmargin = style.rightmargin;
1569
float firstlineindent = style.firstlineindent;
1570
// Columns are not implemented at present. Reason:
1571
// Copying and pasting sections with columns between documents in LibreOffice failed to work.
1572
// int spancolumns = style.spancolumns;
1574
if (odf_text_standard) odf_text_standard->create_paragraph_style (marker, fontname, fontsize, italic, bold, underline, smallcaps, alignment, spacebefore, spaceafter, leftmargin, rightmargin, firstlineindent, keepWithNext, dropcaps);
1575
if (odf_text_text_only) odf_text_text_only->create_paragraph_style (marker, fontname, fontsize, italic, bold, underline, smallcaps, alignment, spacebefore, spaceafter, leftmargin, rightmargin, firstlineindent, keepWithNext, dropcaps);
1576
if (odf_text_text_and_note_citations) odf_text_text_and_note_citations->create_paragraph_style (marker, fontname, fontsize, italic, bold, underline, smallcaps, alignment, spacebefore, spaceafter, leftmargin, rightmargin, firstlineindent, keepWithNext, dropcaps);
1577
createdStyles.push_back (marker);
1579
1575
if (odf_text_standard) odf_text_standard->new_paragraph (marker);
1580
1576
if (odf_text_text_only) odf_text_text_only->new_paragraph (marker);
1581
1577
if (odf_text_text_and_note_citations) odf_text_text_and_note_citations->new_paragraph (marker);
1594
1590
// To name a style according to the number of characters to put in drop caps,
1595
1591
// e.g. a style name like p_c1 or p_c2 or p_c3.
1596
1592
if (odf_text_standard) {
1597
string combined_style = odf_text_standard->current_paragraph_style + "_" + chapterMarker + convert_to_string (dropCapsLength);
1593
string combined_style = odf_text_standard->m_current_paragraph_style + "_" + chapterMarker + convert_to_string (dropCapsLength);
1598
1594
if (find (createdStyles.begin(), createdStyles.end(), combined_style) == createdStyles.end()) {
1599
Database_Styles_Item style = styles[odf_text_standard->current_paragraph_style];
1600
string fontname = Database_Config_Bible::getExportFont (bible);
1595
Database_Styles_Item style = styles[odf_text_standard->m_current_paragraph_style];
1596
string fontname = Database_Config_Bible::getExportFont (m_bible);
1601
1597
float fontsize = style.fontsize;
1602
1598
int italic = style.italic;
1603
1599
int bold = style.bold;