Пример #1
0
def stage():
    print '#### Staging JPS...'

    for fn in os.listdir('sources/jps/'):
        if fn[-8:] == '.usfm.db':

            f = open('sources/jps/' + fn)
            b = unicode(f.read(), 'utf-8')
            f.close()

            s = b
            s = versions.render(s, ['oeb', 'neut', 'cth', 'nrsv', 'son'])

            #So Crosswire doesn't barf
            s = s.replace(u'\\v ', u'\n\\v ')

            f = open('staging/cth/' + fn[:-3], 'w')
            f.write(s.encode('utf-8'))
            f.close()

            s = b
            s = versions.render(s, ['oeb', 'neut', 'us', 'nrsv', 'son'])

            #So Crosswire doesn't barf
            s = s.replace(u'\\v ', u'\n\\v ')

            f = open('staging/us/' + fn[:-3], 'w')
            f.write(s.encode('utf-8'))
            f.close()
Пример #2
0
def stage():
    print '#### Staging JPS...'
    
    for fn in os.listdir('sources/jps/'):
        if fn[-8:] == '.usfm.db':
            
            f = open('sources/jps/' + fn)
            b  = unicode(f.read(), 'utf-8')
            f.close()
            
            s = b
            s = versions.render(s, ['oeb','neut','cth','nrsv', 'son'])
            
            #So Crosswire doesn't barf
            s = s.replace(u'\\v ', u'\n\\v ')
    
            f = open('staging/cth/' + fn[:-3], 'w')
            f.write(s.encode('utf-8'))
            f.close()
    
            s = b
            s = versions.render(s, ['oeb','neut','us','nrsv', 'son'])
            
            #So Crosswire doesn't barf
            s = s.replace(u'\\v ', u'\n\\v ')
    
            f = open('staging/us/' + fn[:-3], 'w')
            f.write(s.encode('utf-8'))
            f.close()
Пример #3
0
def stage(src, to, tags):
    print '     ' + str(tags)
    for fn in os.listdir(src + '/'):
        if fn[-8:] == '.usfm.db':
            
            f = open(src + '/' + fn)
            b  = unicode(f.read(), 'utf-8')
            f.close()
            
            s = versions.render(b, tags)
            
            #To get quotes right to Cth versions, swap “”‘’ to get US and Cth OK
            if 'cth' in tags:
                s = s.replace(u'“', u'@leftdoublequote@')
                s = s.replace(u'”', u'@rightdoublequote@')
                s = s.replace(u'‘', u'@leftsinglequote@')
                s = s.replace(u'’', u'@rightsinglequote@')
                s = s.replace(u'@leftdoublequote@', u'‘')
                s = s.replace(u'@rightdoublequote@', u'’')
                s = s.replace(u'@leftsinglequote@', u'“')
                s = s.replace(u'@rightsinglequote@', u'”')
                
            # Clean up line endings so Crosswire's sofware doesn't barf
            # strip leading & trailing whitespace, terminate with newline
            s = s.replace(u'\\v ', u'\n\\v ')
            s = re.sub(r'\s*\n\s*', r'\n', s)
    
            saveIfDifferent(to, fn[:-3], s)
Пример #4
0
def stage(src, to, tags, booklist):
    print '     ' + str(tags)
    for fn in os.listdir(src + '/'):
        if fn[-8:] == '.usfm.db':
            
            f = open(src + '/' + fn)
            b  = unicode(f.read(), 'utf-8')
            f.close()
            
            s = versions.render(b, tags)
            
            #To get quotes right to Cth versions, swap “”‘’ to get US and Cth OK
            if 'cth' in tags:
                s = s.replace(u'“', u'@leftdoublequote@')
                s = s.replace(u'”', u'@rightdoublequote@')
                s = s.replace(u'‘', u'@leftsinglequote@')
                s = s.replace(u'’', u'@rightsinglequote@')
                s = s.replace(u'@leftdoublequote@', u'‘')
                s = s.replace(u'@rightdoublequote@', u'’')
                s = s.replace(u'@leftsinglequote@', u'“')
                s = s.replace(u'@rightsinglequote@', u'”')
                
            # Now deal with contractions and possessives
            s = s.replace(u'\'', u'’')
                
            if booklist == [] or fn[:-3] in booklist:
                saveIfDifferent(to, fn[:-3], s)
Пример #5
0
def stage(src, to, tags, booklist):
    print '     ' + str(tags)
    for fn in os.listdir(src + '/'):
        if fn[-8:] == '.usfm.db':

            f = open(src + '/' + fn)
            b = unicode(f.read(), 'utf-8')
            f.close()

            s = versions.render(b, tags)

            #To get quotes right to Cth versions, swap “”‘’ to get US and Cth OK
            if 'cth' in tags:
                s = s.replace(u'“', u'@leftdoublequote@')
                s = s.replace(u'”', u'@rightdoublequote@')
                s = s.replace(u'‘', u'@leftsinglequote@')
                s = s.replace(u'’', u'@rightsinglequote@')
                s = s.replace(u'@leftdoublequote@', u'‘')
                s = s.replace(u'@rightdoublequote@', u'’')
                s = s.replace(u'@leftsinglequote@', u'“')
                s = s.replace(u'@rightsinglequote@', u'”')

            # Now deal with contractions and possessives
            s = s.replace(u'\'', u'’')

            if booklist == [] or fn[:-3] in booklist:
                saveIfDifferent(to, fn[:-3], s)
Пример #6
0
def stage():
    print '#### Staging McFadyen...'

    for fn in os.listdir('sources/mcfadyen/'):
        if fn[-8:] == '.usfm.db':

            f = open('sources/mcfadyen/' + fn)
            b = unicode(f.read(), 'utf-8')
            f.close()

            s = b
            s = versions.render(s, ['neut', 'cth', 'oeb'])

            #So Crosswire doesn't barf
            s = s.replace(u'\\v ', u'\n\\v ')

            #To get quotes right to Cth versions, swap “”‘’ to get US and Cth OK
            s = s.replace(u'“', u'@leftdoublequote@')
            s = s.replace(u'”', u'@rightdoublequote@')
            s = s.replace(u'‘', u'@leftsinglequote@')
            s = s.replace(u'’', u'@rightsinglequote@')
            s = s.replace(u'@leftdoublequote@', u'‘')
            s = s.replace(u'@rightdoublequote@', u'’')
            s = s.replace(u'@leftsinglequote@', u'“')
            s = s.replace(u'@rightsinglequote@', u'”')

            f = open('staging/cth/' + fn[:-3], 'w')
            f.write(s.encode('utf-8'))
            f.close()

            s = b
            s = versions.render(s, ['neut', 'us', 'oeb'])

            #So Crosswire doesn't barf
            s = s.replace(u'\\v ', u'\n\\v ')

            f = open('staging/us/' + fn[:-3], 'w')
            f.write(s.encode('utf-8'))
            f.close()
Пример #7
0
def stage():
    print '#### Staging McFadyen...'
    
    for fn in os.listdir('sources/mcfadyen/'):
        if fn[-8:] == '.usfm.db':
            
            f = open('sources/mcfadyen/' + fn)
            b  = unicode(f.read(), 'utf-8')
            f.close()
            
            s = b
            s = versions.render(s, ['neut','cth','oeb'])
            
            #So Crosswire doesn't barf
            s = s.replace(u'\\v ', u'\n\\v ')
            
            #To get quotes right to Cth versions, swap “”‘’ to get US and Cth OK
            s = s.replace(u'“', u'@leftdoublequote@')
            s = s.replace(u'”', u'@rightdoublequote@')
            s = s.replace(u'‘', u'@leftsinglequote@')
            s = s.replace(u'’', u'@rightsinglequote@')
            s = s.replace(u'@leftdoublequote@', u'‘')
            s = s.replace(u'@rightdoublequote@', u'’')
            s = s.replace(u'@leftsinglequote@', u'“')
            s = s.replace(u'@rightsinglequote@', u'”')
    
            f = open('staging/cth/' + fn[:-3], 'w')
            f.write(s.encode('utf-8'))
            f.close()
    
            s = b
            s = versions.render(s, ['neut','us','oeb'])
            
            #So Crosswire doesn't barf
            s = s.replace(u'\\v ', u'\n\\v ')
    
            f = open('staging/us/' + fn[:-3], 'w')
            f.write(s.encode('utf-8'))
            f.close()
Пример #8
0
def stage():
    print '#### Staging Kent...'
    
    for fn in os.listdir('sources/kent/'):
        if fn[-8:] == '.usfm.db':
            
            f = open('sources/kent/' + fn)
            b  = unicode(f.read(), 'utf-8')
            f.close()
            
            s = b
            s = versions.render(s, ['oeb','neut','cth','nrsv', 'lord'])
            
            #Nicer puncutation
            s = s.replace(u'‘', u'⟨')
            s = s.replace(u'’', u'⟩')
            s = s.replace(u'“', u'‘')
            s = s.replace(u'”', u'’')
            s = s.replace(u'⟨', u'“')
            s = s.replace(u'⟩', u'”')
            
            #So Crosswire doesn't barf
            s = s.replace(u'\\v ', u'\n\\v ')
    
            f = open('staging/cth/' + fn[:-3], 'w')
            f.write(s.encode('utf-8'))
            f.close()
    
            s = b
            s = versions.render(s, ['oeb','neut','us','nrsv', 'lord'])
            
            #So Crosswire doesn't barf
            s = s.replace(u'\\v ', u'\n\\v ')
    
            f = open('staging/us/' + fn[:-3], 'w')
            f.write(s.encode('utf-8'))
            f.close()