コード例 #1
0
ファイル: MySwordBible.py プロジェクト: DanTrevor/BibleOrgSys
def testMySwB(indexString, MySwBfolder, MySwBfilename):
    """
    Crudely demonstrate the MySword Bible class.
    """
    #print( "tMSB", MySwBfolder )
    import VerseReferences
    #testFolder = "../../../../../Data/Work/Bibles/MySword modules/" # Must be the same as below

    #TUBfolder = os.path.join( MySwBfolder, MySwBfilename )
    if BibleOrgSysGlobals.verbosityLevel > 1:
        print(
            _("Demonstrating the MySword Bible class {}…").format(indexString))
    if BibleOrgSysGlobals.verbosityLevel > 0:
        print("  Test folder is {!r} {!r}".format(MySwBfolder, MySwBfilename))
    MySwB = MySwordBible(MySwBfolder, MySwBfilename)
    MySwB.preload()
    #MySwB.load() # Load and process the file
    if BibleOrgSysGlobals.verbosityLevel > 1:
        print(MySwB)  # Just print a summary
    #print( MySwB.suppliedMetadata['MySword'] )
    if MySwB is not None:
        if BibleOrgSysGlobals.strictCheckingFlag: MySwB.check()
        for reference in ( ('OT','GEN','1','1'), ('OT','GEN','1','3'), ('OT','PSA','3','0'), ('OT','PSA','3','1'), \
                            ('OT','DAN','1','21'),
                            ('NT','MAT','3','5'), ('NT','JDE','1','4'), ('NT','REV','22','21'), \
                            ('DC','BAR','1','1'), ('DC','MA1','1','1'), ('DC','MA2','1','1',), ):
            (t, b, c, v) = reference
            if t == 'OT' and len(MySwB) == 27:
                continue  # Don't bother with OT references if it's only a NT
            if t == 'NT' and len(MySwB) == 39:
                continue  # Don't bother with NT references if it's only a OT
            if t == 'DC' and len(MySwB) <= 66:
                continue  # Don't bother with DC references if it's too small
            svk = VerseReferences.SimpleVerseKey(b, c, v)
            #print( svk, ob.getVerseDataList( reference ) )
            try:
                shortText, verseText = svk.getShortText(), MySwB.getVerseText(
                    svk)
                if BibleOrgSysGlobals.verbosityLevel > 1:
                    print(reference, shortText, verseText)
            except KeyError:
                if BibleOrgSysGlobals.verbosityLevel > 1:
                    print(reference, "not found!!!")

        if 0:  # Now export the Bible and compare the round trip
            MySwB.createMySwordModule()
            #doaResults = MySwB.doAllExports( wantPhotoBible=False, wantODFs=False, wantPDFs=False )
            if BibleOrgSysGlobals.strictCheckingFlag:  # Now compare the original and the derived USX XML files
                outputFolder = "OutputFiles/BOS_MySword_Reexport/"
                if BibleOrgSysGlobals.verbosityLevel > 1:
                    print(
                        "\nComparing original and re-exported MySword files…")
                result = BibleOrgSysGlobals.fileCompare(
                    MySwBfilename, MySwBfilename, MySwBfolder, outputFolder)
                if BibleOrgSysGlobals.debugFlag:
                    if not result: halt
コード例 #2
0
def testeSwB(eSwBfolder, eSwBfilename):
    # Crudely demonstrate the e-Sword Bible class
    import VerseReferences
    #testFolder = "../../../../../Data/Work/Bibles/e-Sword modules/" # Must be the same as below

    #TUBfolder = os.path.join( eSwBfolder, eSwBfilename )
    if BibleOrgSysGlobals.verbosityLevel > 1:
        print(_("Demonstrating the e-Sword Bible class..."))
    if BibleOrgSysGlobals.verbosityLevel > 0:
        print("  Test folder is {} {}".format(repr(eSwBfolder),
                                              repr(eSwBfilename)))
    eSwB = ESwordBible(eSwBfolder, eSwBfilename)
    eSwB.load()  # Load and process the file
    if BibleOrgSysGlobals.verbosityLevel > 1:
        print(eSwB)  # Just print a summary
    #print( eSwB.settingsDict )
    if 0 and eSwB:
        if BibleOrgSysGlobals.strictCheckingFlag: eSwB.check()
        for reference in ( ('OT','GEN','1','1'), ('OT','GEN','1','3'), ('OT','PSA','3','0'), ('OT','PSA','3','1'), \
                            ('OT','DAN','1','21'),
                            ('NT','MAT','3','5'), ('NT','JDE','1','4'), ('NT','REV','22','21'), \
                            ('DC','BAR','1','1'), ('DC','MA1','1','1'), ('DC','MA2','1','1',), ):
            (t, b, c, v) = reference
            if t == 'OT' and len(eSwB) == 27:
                continue  # Don't bother with OT references if it's only a NT
            if t == 'NT' and len(eSwB) == 39:
                continue  # Don't bother with NT references if it's only a OT
            if t == 'DC' and len(eSwB) <= 66:
                continue  # Don't bother with DC references if it's too small
            svk = VerseReferences.SimpleVerseKey(b, c, v)
            #print( svk, ob.getVerseDataList( reference ) )
            shortText, verseText = svk.getShortText(), eSwB.getVerseText(svk)
            if BibleOrgSysGlobals.verbosityLevel > 1:
                print(reference, shortText, verseText)

        # Now export the Bible and compare the round trip
        eSwB.toESword()
        doaResults = eSwB.doAllExports(wantPhotoBible=False,
                                       wantODFs=False,
                                       wantPDFs=False)
        if BibleOrgSysGlobals.strictCheckingFlag:  # Now compare the original and the derived USX XML files
            outputFolder = "OutputFiles/BOS_e-Sword_Reexport/"
            if BibleOrgSysGlobals.verbosityLevel > 1:
                print("\nComparing original and re-exported e-Sword files...")
            result = BibleOrgSysGlobals.fileCompare(eSwBfilename, eSwBfilename,
                                                    eSwBfolder, outputFolder)
            if BibleOrgSysGlobals.debugFlag:
                if not result: halt
コード例 #3
0
def testMySwB( indexString, MySwBfolder, MySwBfilename ):
    """
    Crudely demonstrate the MySword Bible class.
    """
    #print( "tMSB", MySwBfolder )
    import VerseReferences
    #testFolder = "../../../../../Data/Work/Bibles/MySword modules/" # Must be the same as below

    #TUBfolder = os.path.join( MySwBfolder, MySwBfilename )
    if BibleOrgSysGlobals.verbosityLevel > 1: print( _("Demonstrating the MySword Bible class {}…").format( indexString) )
    if BibleOrgSysGlobals.verbosityLevel > 0: print( "  Test folder is {!r} {!r}".format( MySwBfolder, MySwBfilename ) )
    MySwB = MySwordBible( MySwBfolder, MySwBfilename )
    MySwB.preload()
    #MySwB.load() # Load and process the file
    if BibleOrgSysGlobals.verbosityLevel > 1: print( MySwB ) # Just print a summary
    #print( MySwB.suppliedMetadata['MySword'] )
    if MySwB is not None:
        if BibleOrgSysGlobals.strictCheckingFlag: MySwB.check()
        for reference in ( ('OT','GEN','1','1'), ('OT','GEN','1','3'), ('OT','PSA','3','0'), ('OT','PSA','3','1'), \
                            ('OT','DAN','1','21'),
                            ('NT','MAT','3','5'), ('NT','JDE','1','4'), ('NT','REV','22','21'), \
                            ('DC','BAR','1','1'), ('DC','MA1','1','1'), ('DC','MA2','1','1',), ):
            (t, b, c, v) = reference
            if t=='OT' and len(MySwB)==27: continue # Don't bother with OT references if it's only a NT
            if t=='NT' and len(MySwB)==39: continue # Don't bother with NT references if it's only a OT
            if t=='DC' and len(MySwB)<=66: continue # Don't bother with DC references if it's too small
            svk = VerseReferences.SimpleVerseKey( b, c, v )
            #print( svk, ob.getVerseDataList( reference ) )
            try:
                shortText, verseText = svk.getShortText(), MySwB.getVerseText( svk )
                if BibleOrgSysGlobals.verbosityLevel > 1: print( reference, shortText, verseText )
            except KeyError:
                if BibleOrgSysGlobals.verbosityLevel > 1: print( reference, "not found!!!" )

        if 0: # Now export the Bible and compare the round trip
            MySwB.toMySword()
            #doaResults = MySwB.doAllExports( wantPhotoBible=False, wantODFs=False, wantPDFs=False )
            if BibleOrgSysGlobals.strictCheckingFlag: # Now compare the original and the derived USX XML files
                outputFolder = "OutputFiles/BOS_MySword_Reexport/"
                if BibleOrgSysGlobals.verbosityLevel > 1: print( "\nComparing original and re-exported MySword files…" )
                result = BibleOrgSysGlobals.fileCompare( MySwBfilename, MySwBfilename, MySwBfolder, outputFolder )
                if BibleOrgSysGlobals.debugFlag:
                    if not result: halt
コード例 #4
0
ファイル: ESwordBible.py プロジェクト: alerque/BibleOrgSys
def testeSwB( eSwBfolder, eSwBfilename ):
    # Crudely demonstrate the e-Sword Bible class
    import VerseReferences
    #testFolder = "../../../../../Data/Work/Bibles/e-Sword modules/" # Must be the same as below

    #TUBfolder = os.path.join( eSwBfolder, eSwBfilename )
    if BibleOrgSysGlobals.verbosityLevel > 1: print( _("Demonstrating the e-Sword Bible class...") )
    if BibleOrgSysGlobals.verbosityLevel > 0: print( "  Test folder is {} {}".format( repr(eSwBfolder), repr(eSwBfilename) ) )
    eSwB = ESwordBible( eSwBfolder, eSwBfilename )
    eSwB.load() # Load and process the file
    if BibleOrgSysGlobals.verbosityLevel > 1: print( eSwB ) # Just print a summary
    #print( eSwB.settingsDict )
    if 0 and eSwB:
        if BibleOrgSysGlobals.strictCheckingFlag: eSwB.check()
        for reference in ( ('OT','GEN','1','1'), ('OT','GEN','1','3'), ('OT','PSA','3','0'), ('OT','PSA','3','1'), \
                            ('OT','DAN','1','21'),
                            ('NT','MAT','3','5'), ('NT','JDE','1','4'), ('NT','REV','22','21'), \
                            ('DC','BAR','1','1'), ('DC','MA1','1','1'), ('DC','MA2','1','1',), ):
            (t, b, c, v) = reference
            if t=='OT' and len(eSwB)==27: continue # Don't bother with OT references if it's only a NT
            if t=='NT' and len(eSwB)==39: continue # Don't bother with NT references if it's only a OT
            if t=='DC' and len(eSwB)<=66: continue # Don't bother with DC references if it's too small
            svk = VerseReferences.SimpleVerseKey( b, c, v )
            #print( svk, ob.getVerseDataList( reference ) )
            shortText, verseText = svk.getShortText(), eSwB.getVerseText( svk )
            if BibleOrgSysGlobals.verbosityLevel > 1: print( reference, shortText, verseText )

        # Now export the Bible and compare the round trip
        eSwB.toESword()
        doaResults = eSwB.doAllExports( wantPhotoBible=False, wantODFs=False, wantPDFs=False )
        if BibleOrgSysGlobals.strictCheckingFlag: # Now compare the original and the derived USX XML files
            outputFolder = "OutputFiles/BOS_e-Sword_Reexport/"
            if BibleOrgSysGlobals.verbosityLevel > 1: print( "\nComparing original and re-exported e-Sword files..." )
            result = BibleOrgSysGlobals.fileCompare( eSwBfilename, eSwBfilename, eSwBfolder, outputFolder )
            if BibleOrgSysGlobals.debugFlag:
                if not result: halt