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

USFM Figure configurations should produce consistent results #36

Open davidmoore1 opened 6 months ago

davidmoore1 commented 6 months ago

Enhancement request:

\fig format is configured differently for USFM 1.0 and USFM 2.0. The fields are the same, but in 1.0, the fields are defined as | separated with a specific order assigned to the fields whereas in 2.0, the fields are specified by the name of the field and =. Screenshot 2024-01-03 at 10 10 36 AM

In this example, the 2.0 version of the figure is \fig Jesus Birth|src="JesusBirth.jpg" size="span"\fig and the 1.0 format of the same figure with a different caption is \fig Mary Joseph and Jesus|JesusBirth.jpg|span|||||\fig

Parsing these using json tools gives different results for the wrapper atts properties. Console log was used to dump the wrapper element that was created processing these two features

Screenshot 2024-01-03 at 10 07 40 AM

The one on the top was generated from the 2.0 version and the bottom from the 1.0 version. Currently, to display both, my code has to check and see if there is an src element and if not is there a unknownDefault_fig element and process the fields that way. It would seem to be preferable for the proskomma tools to detect the 1.0 version and create a result that would look like the 2.0 version so that users don't have to worry about the internal usfm formatting.