bibledit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [be] OSIS format paragraph question


From: johnduffy
Subject: RE: [be] OSIS format paragraph question
Date: Mon, 26 Oct 2009 14:15:00 -0000

Daniel,

I've managed to use regex.  I switched from Notepad++ to jEdit.

The sample in the previous email below now looks like:

     <verse sID="Gen.1.19" osisID="Gen.1.19"/>
 Ba shin an ceathrú lá, an nóin agus an mhaidin.      <verse
eID="Gen.1.19"/>
</p>
    <p>
     <verse sID="Gen.1.20" osisID="Gen.1.20"/>

I did it in a number of replace operations, firstly swapping the <p> and the
<verse eID...>, then by swapping any preceding </p> with <verse eID...>.  In
case it is useful to anyone else, here are the expressions:

To replace bible books beginning with A-Z, e.g. Gen
Find
(( +<p>\n)( +<verse eID="[A-Z][a-z]+.[0-9]+.[0-9]+"/>\n))
Replace
$3$2

Then

To replace bible books beginning with 0-9, e.g. 1Sam
Find
(( +<p>\n)( +<verse eID="[0-9][A-Z][a-z]+.[0-9]+.[0-9]+"/>\n))
Replace
$3$2

Then, after changing ( +<p>\n) to (</p>\n) in both cases, repeat the above
two


This sorted out most of the wrong <p> locations, but there were others that
needed to be looked at as well.
Then, to change the /p and /div which appear at the start of the next
chapter, use 
(( +<chapter eID="[A-Z][a-z]+.[0-9]+"/>\n +<chapter sID="[A-Z][a-z]+.[0-9]+"
osisID="[A-Z][a-z]+.[0-9]+" n="[0-9]+"/>\n)( +</p>\n +</div>\n))
And repeat with adding the [0-9] before each [A-Z] as before.

Then, to change the /p that was at the start of the next chapter without a
/div, use
(( +<chapter eID="[A-Z][a-z]+.[0-9]+"/>\n +<chapter sID="[A-Z][a-z]+.[0-9]+"
osisID="[A-Z][a-z]+.[0-9]+" n="[0-9]+"/>\n)( +</p>\n))
And repeat with adding the [0-9] before each [A-Z] as before.
Note that they must be in that order that order: /p /div swapped before the
/p on its own.

This now produces better code with chapter endings/beginnings looking like
this:

...adh áirc Dé.”      <verse eID="1Sam.4.22"/>
    </p>
   </div>
     <chapter eID="1Sam.4"/>
     <chapter sID="1Sam.5" osisID="1Sam.5" n="5"/>
   <div type="section" canonical="true">
    <title level="1">Leanann Tubaiste an Áirc</title>
    <p>
     <verse sID="1Sam.5.1" osisID="1Sam.5.1"/>
 Nuair a ghabh na Filistínigh...

But there are still some issues with the verse eID at the end of div
sections that are not at the end of chapters.  These appear after the title
of the next section.  I must still do a bit on that, and possibly more like
it, but that'll have to wait until later on in the week.

 
John Duffy

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
address@hidden
Sent: 23 October 2009 23:58
To: 'Daniel Owens'; address@hidden
Subject: RE: [be] OSIS format paragraph question

Daniel,

It's a bit more difficult to resolve the <p> issue that I thought.  Regular
expressions do not allow crossing a new line.  Also, it appears that it is
not just a case of swapping two groups, but sometimes three as in the
example below where <verse eID="Gen.1.19"/> should not just go before <p>
but before the </p> in front of that.  

     <verse sID="Gen.1.19" osisID="Gen.1.19"/>
 Ba shin an ceathrú lá, an nóin agus an mhaidin. </p>
    <p>
     <verse eID="Gen.1.19"/>
     <verse sID="Gen.1.20" osisID="Gen.1.20"/> 
...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]