@@ -1408,6 +1408,91 @@ public void GetUsfm_PreferExisting_AddRemark()
14081408 AssertUsfmEquals ( target , result ) ;
14091409 }
14101410
1411+ [ Test ]
1412+ public void UpdateBlock_FootnoteInPublishedChapterNumber ( )
1413+ {
1414+ List < UpdateUsfmRow > rows = [ new UpdateUsfmRow ( ScrRef ( "ESG 1:0/2:s" ) , "Update 1" ) ] ;
1415+ string usfm =
1416+ @"\id ESG - Test
1417+ \c 1
1418+ \cp A \f + \fr A.1-3: \ft Some note.\f*
1419+ \s Heading 1
1420+ " ;
1421+ var usfmUpdateBlockHandler = new TestUsfmUpdateBlockHandler ( ) ;
1422+ string target = UpdateUsfm (
1423+ rows ,
1424+ usfm ,
1425+ usfmUpdateBlockHandlers : [ usfmUpdateBlockHandler ] ,
1426+ textBehavior : UpdateUsfmTextBehavior . StripExisting ,
1427+ paragraphBehavior : UpdateUsfmMarkerBehavior . Preserve ,
1428+ embedBehavior : UpdateUsfmMarkerBehavior . Preserve ,
1429+ styleBehavior : UpdateUsfmMarkerBehavior . Preserve
1430+ ) ;
1431+
1432+ string result =
1433+ @"\id ESG
1434+ \c 1
1435+ \cp A \f + \fr A.1-3: \ft Some note.\f*
1436+ \s Update 1
1437+ " ;
1438+ AssertUsfmEquals ( target , result ) ;
1439+
1440+ Assert . That ( usfmUpdateBlockHandler . Blocks . Count , Is . EqualTo ( 2 ) ) ;
1441+ AssertUpdateBlockEquals (
1442+ usfmUpdateBlockHandler . Blocks [ 0 ] ,
1443+ [ "ESG 1:0/1:f" ] ,
1444+ ( UsfmUpdateBlockElementType . Embed , @"\f + \fr A.1-3: \ft Some note.\f*" , false )
1445+ ) ;
1446+ AssertUpdateBlockEquals (
1447+ usfmUpdateBlockHandler . Blocks [ 1 ] ,
1448+ [ "ESG 1:0/2:s" ] ,
1449+ ( UsfmUpdateBlockElementType . Text , "Update 1 " , false ) ,
1450+ ( UsfmUpdateBlockElementType . Text , "Heading 1 " , true )
1451+ ) ;
1452+ }
1453+
1454+ [ Test ]
1455+ public void UpdateBlock_FootnoteAtStartOfChapterWithPrecedingText ( )
1456+ {
1457+ List < UpdateUsfmRow > rows = [ new UpdateUsfmRow ( ScrRef ( "ESG 1:0/2:s" ) , "Update 1" ) ] ;
1458+ string usfm =
1459+ @"\id ESG - Test
1460+ \c 1
1461+ Text 1\f + \fr A.1-3: \ft Some note.\f*
1462+ \s Heading 1
1463+ " ;
1464+ var usfmUpdateBlockHandler = new TestUsfmUpdateBlockHandler ( ) ;
1465+ string target = UpdateUsfm (
1466+ rows ,
1467+ usfm ,
1468+ usfmUpdateBlockHandlers : [ usfmUpdateBlockHandler ] ,
1469+ textBehavior : UpdateUsfmTextBehavior . PreferNew ,
1470+ paragraphBehavior : UpdateUsfmMarkerBehavior . Preserve ,
1471+ embedBehavior : UpdateUsfmMarkerBehavior . Preserve ,
1472+ styleBehavior : UpdateUsfmMarkerBehavior . Preserve
1473+ ) ;
1474+
1475+ string result =
1476+ @"\id ESG - Test
1477+ \c 1 Text 1\f + \fr A.1-3: \ft Some note.\f*
1478+ \s Update 1
1479+ " ;
1480+ AssertUsfmEquals ( target , result ) ;
1481+
1482+ Assert . That ( usfmUpdateBlockHandler . Blocks . Count , Is . EqualTo ( 2 ) ) ;
1483+ AssertUpdateBlockEquals (
1484+ usfmUpdateBlockHandler . Blocks [ 0 ] ,
1485+ [ "ESG 1:0/1:f" ] ,
1486+ ( UsfmUpdateBlockElementType . Embed , @"\f + \fr A.1-3: \ft Some note.\f*" , false )
1487+ ) ;
1488+ AssertUpdateBlockEquals (
1489+ usfmUpdateBlockHandler . Blocks [ 1 ] ,
1490+ [ "ESG 1:0/2:s" ] ,
1491+ ( UsfmUpdateBlockElementType . Text , "Update 1 " , false ) ,
1492+ ( UsfmUpdateBlockElementType . Text , "Heading 1 " , true )
1493+ ) ;
1494+ }
1495+
14111496 private static ScriptureRef [ ] ScrRef ( params string [ ] refs )
14121497 {
14131498 return refs . Select ( r => ScriptureRef . Parse ( r ) ) . ToArray ( ) ;
0 commit comments