adyeths / u2o

USFM to OSIS bible format converter.
The Unlicense
18 stars 6 forks source link

Adding osisRef attributes - a simple subset of the task - for annotateRef only #90

Closed DavidHaslam closed 5 years ago

DavidHaslam commented 5 years ago

A Bible that I just started working again on has no cross-references and no parallel passage headings.

However, it does have footnotes and these all have an origin reference in the USFM, e.g.

\v 20 Adam a anvas e wreg Eva\f + \fr 3:20 \ft = buhez\f*, o vezañ ma'z eo bet mamm an holl re vev.

The resulting OSIS can be easily fixed in regard to adding osisRef attributes for these references where the current output has (e.g.) <reference type="annotateRef">3:20 </reference>.

AFAICT, all that's needed is to insert osisRef="$1" where $1 is the value of the current verse sID attribute.

The main point is that one does not need to parse the raw reference text at all. Unless the translator made a mistake, it should be equivalent to the current verse reference.

The example thus becomes:

<verse sID="Gen.3.20" osisID="Gen.3.20" n="20" />Adam a anvas e wreg Eva<note placement="foot"><reference type="annotateRef" osisRef="Gen.3.20">3:20</reference> = buhez</note>, o vezañ ma'z eo bet mamm an holl re vev.

Notes:

  1. Verses having more than one note can be processed by repeating the search replace action, if that's how one might implement the suggested enhancement.
  2. I also tidied the raw reference text by moving the trailing space to after </reference>.
  3. For a Bible that has linked verses (aka verse ranges), some extra care may be required.

This may be suitable for including in u2o.py inasmuch as orefs.py is now in limbo.

It's not a huge leap forward, but it would be very nice to have.

adyeths commented 5 years ago

It's not as simple as you think. This is exactly the path I went down with orefs, which leads to a dead end. And it would be a duplication of efforts when I'm going to write a new script to try and process all reference tags.

DavidHaslam commented 5 years ago

Which cases would the method fail at?