← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/bug-744515 into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/bug-744515 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #744515 in OpenLP: "OSIS import fails to import certain words in ESV (at least)"
  https://bugs.launchpad.net/openlp/+bug/744515

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/bug-744515/+merge/59253

Fix bug #744515, OSIS import fails to import certain words in ESV (at least)
-- 
https://code.launchpad.net/~raoul-snyman/openlp/bug-744515/+merge/59253
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/bug-744515 into lp:openlp.
=== modified file 'openlp/plugins/bibles/lib/osis.py'
--- openlp/plugins/bibles/lib/osis.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/bibles/lib/osis.py	2011-04-27 16:38:23 +0000
@@ -37,6 +37,9 @@
 
 log = logging.getLogger(__name__)
 
+def replacement(match):
+    return match.group(2).upper()
+
 class OSISBible(BibleDB):
     """
     `OSIS <http://www.bibletechnologies.net/>`_ Bible format importer class.
@@ -60,6 +63,7 @@
         self.lg_regex = re.compile(r'<lg(.*?)>')
         self.l_regex = re.compile(r'<l (.*?)>')
         self.w_regex = re.compile(r'<w (.*?)>')
+        self.q_regex = re.compile(r'<q(.*?)>')
         self.q1_regex = re.compile(r'<q(.*?)level="1"(.*?)>')
         self.q2_regex = re.compile(r'<q(.*?)level="2"(.*?)>')
         self.trans_regex = re.compile(r'<transChange(.*?)>(.*?)</transChange>')
@@ -106,6 +110,7 @@
                 detect_file.close()
         try:
             osis = codecs.open(self.filename, u'r', details['encoding'])
+            repl = replacement
             for file_record in osis:
                 if self.stop_import_flag:
                     break
@@ -148,12 +153,13 @@
                     verse_text = self.rf_regex.sub(u'', verse_text)
                     verse_text = self.lb_regex.sub(u' ', verse_text)
                     verse_text = self.lg_regex.sub(u'', verse_text)
-                    verse_text = self.l_regex.sub(u'', verse_text)
+                    verse_text = self.l_regex.sub(u' ', verse_text)
                     verse_text = self.w_regex.sub(u'', verse_text)
                     verse_text = self.q1_regex.sub(u'"', verse_text)
                     verse_text = self.q2_regex.sub(u'\'', verse_text)
+                    verse_text = self.q_regex.sub(u'', verse_text)
+                    verse_text = self.divine_name_regex.sub(repl, verse_text)
                     verse_text = self.trans_regex.sub(u'', verse_text)
-                    verse_text = self.divine_name_regex.sub(u'', verse_text)
                     verse_text = verse_text.replace(u'</lb>', u'')\
                         .replace(u'</l>', u'').replace(u'<lg>', u'')\
                         .replace(u'</lg>', u'').replace(u'</q>', u'')\


Follow ups