u2o icon indicating copy to clipboard operation
u2o copied to clipboard

Problem with image management

Open LAfricain opened this issue 6 months ago • 3 comments

Since the latest modifications, it seems that u2o no longer handles images correctly. I get this error when a file points to an image:

u2o.py -e utf-8 -l fr -o freaug.osis.xml -v -d FreAug usfm/prob/19-PSA.usfm 
Reading files... 
Processing files...
... Processing Ps ...
Traceback (most recent call last):
  File "/home/cyrille/.bin/u2o.py", line 3136, in <module>
    processfiles(
  File "/home/cyrille/.bin/u2o.py", line 2962, in processfiles
    else [doconvert(_) for _ in filelist]
          ^^^^^^^^^^^^
  File "/home/cyrille/.bin/u2o.py", line 2820, in doconvert
    c2o_specialfeatures(
  File "/home/cyrille/.bin/u2o.py", line 2289, in c2o_specialfeatures
    return milestonequotes(figtags(SPECIALFEATURESRE.sub(simplerepl, specialtext, 0)))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cyrille/.bin/u2o.py", line 2165, in figtags
    True: figparts[_].format(figattr[2][_]),
                             ~~~~~~~~~~^^^
KeyError: 'alt'

Ex of file:

\id GEN
\c 1
\p
\v 1-5
\fig Saint Augustin dans son cabinet de travail (Botticelli, Ognissanti)|Images/augustin.jpg|span||||\fig*

If you delete the \fig tag it works.

LAfricain avatar Jun 03 '25 14:06 LAfricain

The syntax for \fig tags in usfm 3 specifies using word level attributes. The use of the vertical bar was the older usfm 2 syntax and should no longer be used. https://ubsicap.github.io/usfm/characters/index.html#fig-fig

adyeths avatar Jun 03 '25 14:06 adyeths

Ok I tried, not working:

\id GEN
\c 1
\p
\v 1-5
\fig Saint Augustin dans son cabinet de travail (Botticelli, Ognissanti)|src="Images/augustin.jpg" size="span"\fig*

The only way it to add all the options:

\fig Saint Augustin dans son cabinet de travail (Botticelli, Ognissanti)|src="Images/augustin.jpg" size="span" alt="Saint Augustin" loc="" copy=""\fig*

LAfricain avatar Jun 03 '25 18:06 LAfricain

should be fixed now.

adyeths avatar Jun 03 '25 22:06 adyeths