20
20
import biblemulticonverter .format .paratext .ParatextBook .ParatextID ;
21
21
import biblemulticonverter .format .paratext .ParatextCharacterContent .AutoClosingFormatting ;
22
22
import biblemulticonverter .format .paratext .ParatextCharacterContent .AutoClosingFormattingKind ;
23
+ import biblemulticonverter .format .paratext .ParatextCharacterContent .FootnoteXref ;
23
24
import biblemulticonverter .format .paratext .ParatextCharacterContent .Milestone ;
24
25
import biblemulticonverter .format .paratext .ParatextCharacterContent .ParatextCharacterContentPart ;
25
26
import biblemulticonverter .format .paratext .ParatextCharacterContent .Reference ;
@@ -74,7 +75,7 @@ public void doExportBooks(List<ParatextBook> books, String... exportArgs) throws
74
75
if (exportArgs [0 ].equals ("createsrcloc" ) && exportArgs [2 ].equals ("--" )) {
75
76
final String prefix = exportArgs [1 ];
76
77
for (ParatextBook book : books ) {
77
- book .accept (new UBXFBookVisitor (book .getId (), new UBXFGrammarHandlerVisitor () {
78
+ book .accept (new UBXFBookVisitor (book .getId (), false , new UBXFGrammarHandlerVisitor () {
78
79
int index ;
79
80
80
81
@ Override
@@ -96,7 +97,7 @@ protected void handleWordlist(AutoClosingFormatting acf, Reference where) {
96
97
Map <String , Integer > occurrences = new HashMap <>();
97
98
Map <String , String > words = new HashMap <>();
98
99
for (ParatextBook book : books ) {
99
- book .accept (new UBXFBookVisitor (book .getId (), new UBXFGrammarHandlerVisitor () {
100
+ book .accept (new UBXFBookVisitor (book .getId (), false , new UBXFGrammarHandlerVisitor () {
100
101
private void extractContent (StringBuilder sb , ParatextCharacterContentContainer pccc ) {
101
102
for (ParatextCharacterContentPart part : pccc .getContent ()) {
102
103
if (part instanceof ParatextCharacterContentContainer ) {
@@ -156,7 +157,7 @@ protected void handleWordlist(AutoClosingFormatting acf, Reference where) {
156
157
props .load (fis );
157
158
}
158
159
for (ParatextBook book : books ) {
159
- book .accept (new UBXFBookVisitor (book .getId (), new UBXFGrammarHandlerVisitor () {
160
+ book .accept (new UBXFBookVisitor (book .getId (), true , new UBXFGrammarHandlerVisitor () {
160
161
@ Override
161
162
protected void handleAlignMilestone (boolean start , Milestone milestone , Reference where ) {
162
163
if (!start )
@@ -187,7 +188,7 @@ protected void handleWordlist(AutoClosingFormatting acf, Reference where) {
187
188
} else if ((exportArgs [0 ].equals ("fillwordattr" ) || exportArgs [0 ].equals ("createwordattr" )) && exportArgs [1 ].equals ("--" )) {
188
189
final boolean restructure = exportArgs [0 ].equals ("createwordattr" );
189
190
for (ParatextBook book : books ) {
190
- book .accept (new UBXFBookVisitor (book .getId (), new UBXFGrammarHandlerVisitor () {
191
+ book .accept (new UBXFBookVisitor (book .getId (), true , new UBXFGrammarHandlerVisitor () {
191
192
private void restructure (ParatextCharacterContentContainer pccc , boolean inWordlist , boolean inNewWordlist ) {
192
193
for (int i = 0 ; i < pccc .getContent ().size (); i ++) {
193
194
ParatextCharacterContentPart part = pccc .getContent ().get (i );
@@ -243,11 +244,11 @@ private void restructure(ParatextCharacterContentContainer pccc, boolean inWordl
243
244
}
244
245
245
246
@ Override
246
- protected void handleContent (ParatextCharacterContentContainer pccc ) {
247
+ protected void handleContent (ParatextCharacterContentContainer pccc , boolean enterFootnotes ) {
247
248
if (restructure ) {
248
249
restructure (pccc , false , false );
249
250
}
250
- super .handleContent (pccc );
251
+ super .handleContent (pccc , enterFootnotes );
251
252
}
252
253
253
254
List <Milestone > openMilestones = new ArrayList <>();
@@ -289,7 +290,7 @@ protected void handleWordlist(AutoClosingFormatting acf, Reference where) {
289
290
formatArg = 2 ;
290
291
} else if (exportArgs [0 ].equals ("convertgrammar" ) && exportArgs [1 ].equals ("--" )) {
291
292
for (ParatextBook book : books ) {
292
- book .accept (new UBXFBookVisitor (book .getId (), new UBXFGrammarHandlerVisitor () {
293
+ book .accept (new UBXFBookVisitor (book .getId (), true , new UBXFGrammarHandlerVisitor () {
293
294
294
295
private String getHebPrefixStrong (char ch ) {
295
296
switch (ch ) {
@@ -435,10 +436,12 @@ private static class UBXFBookVisitor implements ParatextBookContentVisitor<Runti
435
436
436
437
private final ParatextID bookID ;
437
438
private final UBXFGrammarHandlerVisitor ghv ;
439
+ private final boolean enterFootnotes ;
438
440
private int chapterNumber = -1 ;
439
441
440
- public UBXFBookVisitor (ParatextID bookID , UBXFGrammarHandlerVisitor ghv ) {
442
+ public UBXFBookVisitor (ParatextID bookID , boolean enterFootnotes , UBXFGrammarHandlerVisitor ghv ) {
441
443
this .bookID = bookID ;
444
+ this .enterFootnotes = enterFootnotes ;
442
445
this .ghv = ghv ;
443
446
}
444
447
@@ -490,7 +493,7 @@ public void visitFigure(String caption, Map<String, String> attributes) throws R
490
493
491
494
@ Override
492
495
public void visitParatextCharacterContent (ParatextCharacterContent content ) throws RuntimeException {
493
- ghv .handleContent (content );
496
+ ghv .handleContent (content , enterFootnotes );
494
497
}
495
498
}
496
499
@@ -507,7 +510,7 @@ public void setWhere(Reference newWhere) {
507
510
protected void handleAlignMilestone (boolean start , Milestone milestone , Reference where ) {
508
511
}
509
512
510
- protected void handleContent (ParatextCharacterContentContainer pccc ) {
513
+ protected void handleContent (ParatextCharacterContentContainer pccc , boolean enterFootnotes ) {
511
514
for (ParatextCharacterContentPart part : pccc .getContent ()) {
512
515
if (part instanceof AutoClosingFormatting && ((AutoClosingFormatting ) part ).getKind () == AutoClosingFormattingKind .WORDLIST ) {
513
516
handleWordlist ((AutoClosingFormatting ) part , where );
@@ -519,8 +522,8 @@ protected void handleContent(ParatextCharacterContentContainer pccc) {
519
522
handleAlignMilestone (false , milestone , where );
520
523
}
521
524
}
522
- if (part instanceof ParatextCharacterContentContainer ) {
523
- handleContent ((ParatextCharacterContentContainer ) part );
525
+ if (part instanceof ParatextCharacterContentContainer && ( enterFootnotes || !( part instanceof FootnoteXref )) ) {
526
+ handleContent ((ParatextCharacterContentContainer ) part , enterFootnotes );
524
527
}
525
528
}
526
529
}
0 commit comments