Proskomma / proskomma-json-tools

Tools for working with Proskomma-derived JSON formats such as PERF and SOFRIA
MIT License
1 stars 2 forks source link

Figures within a verse are not handled properly #37

Open davidmoore1 opened 6 months ago

davidmoore1 commented 6 months ago

Most of the /fig entries I have seen are at the end of a verse, before a /p or something of that nature. In this case, the figure is in the middle of the the verse. Screenshot 2024-01-03 at 11 43 32 AM

The source for the figure for verses 11 - 13 is: \v 11 They came into the house \fig Jesus Birth|JesusBirth.jpg|span|||||\fig* and saw the young child with Mary, his mother, and they fell down and worshiped him. Opening their treasures, they offered to him gifts: gold, frankincense, and myrrh. \v 12 Being warned in a dream not to return to Herod, they went back to their own country another way. \p \v 13 Now when they had departed, behold, an angel of the Lord appeared to Joseph in a dream, saying, “Arise and take the young child and his mother, and flee into Egypt, and stay there until I tell you, for Herod will seek the young child to destroy him.”

The problems relate to what happens with the text following the end of the verse, following the figure. The end sequence for the figure does not come until the end of the verse 12 text, well after the end of the figure. The text appears with a subtype of usfm:f when it should probably be usfm:p. The text for verse 12 does not appear between the start verses 12 and the end verses 12. It appears within the figure sequence. The /p seems to reset everything to process correctly from there on.

I think what I would expect to see would be for the figure sequence and the inline graft for the figure to end at the end of the figure (\fig*) and then the remaining text in verse 11 to appear as a usfm:p text element. Here is the same type console output for the case where the figure is defined at the end of the verse and followed by the paragraph: \v 7 Then Herod secretly called the wise men, and learned from them exactly what time the star appeared. \v 8 He sent them to Bethlehem, and said, “Go and sea...

davidmoore1 commented 6 months ago

It dropped the end of the last comment: This is the case where everything looks good \v 7 Then Herod secretly called the wise men, and learned from them exactly what time the star appeared. \v 8 He sent them to Bethlehem, and said, “Go and search diligently for the young child. When you have found him, bring me word, so that I also may come and worship him.” \fig Jesus Birth|src="JesusBirth.jpg" size="span"\fig* \p \v 9 They, having heard the king, went their way; and behold, the star, which they saw in the east, went before them, until it came and stood over where the young child was. Screenshot 2024-01-03 at 11 36 20 AM

davidmoore1 commented 6 months ago

Final comment: If there is something about the original source with the text in verse that violates the USFM standard, let me know. As far as I can see, this looks valid, but I've missed some things before so feel free to educate me if I got it wrong.