[sword-devel] usfm2osis.py issue
Cyrille
lafricain79 at gmail.com
Sun Nov 13 05:26:42 MST 2016
Hi,
When I use usfm2osis.py I have an issue with the \r marker the script
convert :
\r (Mc 1, 7-8; Lc 3, 15-18; Jn 1, 24-28)
like that :
<title type="parallel"><reference type="parallel">(Mc 1, 7-8; Lc 3,
15-18; Jn 1, 24-28)</reference></title>
And when I want to read the reference link on xiphos, it doesn’t. Then
I did some "odd jobs" to make it working, I run first this command :
find . -name "*osis.xml" -exec sed -i 's/type="parallel"><reference
type="parallel">/type="parallel"><reference osisRef="">/g' {} \;
And after that I execute this script:
#$ cat corrig.py
import sys, re
fo=sys.stdout
rec=re.compile('(.*osisRef=")[^"]*(">\()([^)]+)(.*)')
def modiref(ref):
ref=re.sub(', *','.',ref)
ref=re.sub(' +','.',ref)
ref=ref.replace('c','k')
return ref
for lig in sys.stdin.readlines():
k=rec.match(lig)
if k:
refs=re.split('; *',k.group(3))
fo.write("%s%s%s%s"%(k.group(1),modiref(refs[0]),k.group(2),refs[0]))
for ref in refs[1:]: fo.write('; </reference><reference
osisRef="%s">%s'%(modiref(ref),ref))
fo.write('%s\n'%(k.group(4)))
else: fo.write(lig)
I thought it can be usefull for all to report the bug. Maybe we can
improve directly the usfm2osis.py
Best regard, Br Cyrille
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20161113/1bedfc31/attachment.html>
More information about the sword-devel
mailing list