Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RobH123 committed Nov 19, 2017
1 parent b560602 commit 0e813bf
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 79 deletions.
4 changes: 3 additions & 1 deletion BibleOrganizationalSystems.py
Expand Up @@ -57,7 +57,7 @@

from gettext import gettext as _

LastModifiedDate = '2017-05-11' # by RJH
LastModifiedDate = '2017-11-17' # by RJH
ShortProgName = "BibleOrganizationalSystems"
ProgName = "Bible Organization Systems handler"
ProgVersion = '0.32'
Expand Down Expand Up @@ -490,6 +490,8 @@ def getAlternativeBBBIfNecessary( self, BBB ):
def getNumVersesList( self, BBB, allowAlternatives=False ):
"""
Returns a list containing an integer for each chapter indicating the number of verses.
The length of the list is the number of chapters in the book.
"""
if BibleOrgSysGlobals.debugFlag and debuggingThisModule:
print( exp("getNumVersesList( {} )").format( BBB ) )
Expand Down
4 changes: 3 additions & 1 deletion BibleVersificationSystems.py
Expand Up @@ -65,7 +65,7 @@

from gettext import gettext as _

LastModifiedDate = '2017-05-11' # by RJH
LastModifiedDate = '2017-11-17' # by RJH
ShortProgName = "BibleVersificationSystems"
ProgName = "Bible Versification Systems handler"
ProgVersion = '0.58'
Expand Down Expand Up @@ -686,6 +686,8 @@ def getNumVerses( self, BBB, C ):
def getNumVersesList( self, BBB ):
"""
Returns a list containing an integer for each chapter indicating the number of verses.
The length of the list is the number of chapters in the book.
"""
assert len(BBB) == 3
myList = []
Expand Down
8 changes: 4 additions & 4 deletions BibleWriter.py
Expand Up @@ -70,7 +70,7 @@

from gettext import gettext as _

LastModifiedDate = '2017-10-05' # by RJH
LastModifiedDate = '2017-11-17' # by RJH
ShortProgName = "BibleWriter"
ProgName = "Bible writer"
ProgVersion = '0.94'
Expand Down Expand Up @@ -6789,7 +6789,7 @@ def toESword( self, outputFolder=None, controlDict=None ):

This format is roughly documented at xxx
"""
from ESwordBible import createESwordModule
from ESwordBible import createESwordBibleModule
if BibleOrgSysGlobals.verbosityLevel > 1: print( "Running BibleWriter:toESword…" )
if BibleOrgSysGlobals.debugFlag: assert self.books

Expand All @@ -6805,7 +6805,7 @@ def toESword( self, outputFolder=None, controlDict=None ):
#logging.critical( "Unable to read control dict {} from {}".format( defaultControlFilename, defaultControlFolder ) )
#self.__adjustControlDict( controlDict )

return createESwordModule( self, outputFolder, controlDict )
return createESwordBibleModule( self, outputFolder, controlDict )
# end of BibleWriter.toESword


Expand Down Expand Up @@ -9328,7 +9328,7 @@ def doAllExports( self, givenOutputFolderName=None, wantPhotoBible=None, wantODF
swOutputFolder = os.path.join( givenOutputFolderName, 'BOS_Sword_' + ('Reexport/' if self.objectTypeString=='Sword' else 'Export/' ) )
tWOutputFolder = os.path.join( givenOutputFolderName, 'BOS_theWord_' + ('Reexport/' if self.objectTypeString=='theWord' else 'Export/' ) )
MySwOutputFolder = os.path.join( givenOutputFolderName, 'BOS_MySword_' + ('Reexport/' if self.objectTypeString=='MySword' else 'Export/' ) )
ESwOutputFolder = os.path.join( givenOutputFolderName, 'BOS_e-Sword_' + ('Reexport/' if self.objectTypeString=='e-Sword' else 'Export/' ) )
ESwOutputFolder = os.path.join( givenOutputFolderName, 'BOS_e-Sword_' + ('Reexport/' if self.objectTypeString=='e-Sword-Bible' else 'Export/' ) )
MyBOutputFolder = os.path.join( givenOutputFolderName, 'BOS_MyBible_' + ('Reexport/' if self.objectTypeString=='MyBible' else 'Export/' ) )
SwSOutputFolder = os.path.join( givenOutputFolderName, 'BOS_SwordSearcher_Export/' )
DrOutputFolder = os.path.join( givenOutputFolderName, 'BOS_DrupalBible_' + ('Reexport/' if self.objectTypeString=='DrupalBible' else 'Export/' ) )
Expand Down
18 changes: 10 additions & 8 deletions ESFMBible.py
Expand Up @@ -35,7 +35,7 @@

from gettext import gettext as _

LastModifiedDate = '2017-11-08' # by RJH
LastModifiedDate = '2017-11-19' # by RJH
ShortProgName = "ESFMBible"
ProgName = "ESFM Bible handler"
ProgVersion = '0.60'
Expand Down Expand Up @@ -538,9 +538,10 @@ def loadBooks( self ):
if 'Tag errors' in self.semanticDict: print( "\nESFMBible.load tag errors:", self.semanticDict['Tag errors'] )
if 'Missing' in self.semanticDict: print( "\nESFMBible.load missing:", self.semanticDict['Missing'] )
#print( "\nSemantic dict: {}".format( self.semanticDict ) )
print( "\n\nSemantic dict:" )
for someKey,someEntry in self.semanticDict.items():
print( "\n{}: {}".format( someKey, someEntry ) )
if debuggingThisModule:
print( "\n\nSemantic dict:" )
for someKey,someEntry in self.semanticDict.items():
print( "\n{}: {}".format( someKey, someEntry ) )
self.doPostLoadProcessing()
# end of ESFMBible.load

Expand Down Expand Up @@ -573,10 +574,11 @@ def demo():
if BibleOrgSysGlobals.verbosityLevel > 0: print( "\nESFM A{}/".format( count ) )
EsfmB = ESFMBible( testFolder, name, abbreviation )
EsfmB.load()
print( "Gen assumed book name:", repr( EsfmB.getAssumedBookName( 'GEN' ) ) )
print( "Gen long TOC book name:", repr( EsfmB.getLongTOCName( 'GEN' ) ) )
print( "Gen short TOC book name:", repr( EsfmB.getShortTOCName( 'GEN' ) ) )
print( "Gen book abbreviation:", repr( EsfmB.getBooknameAbbreviation( 'GEN' ) ) )
if debuggingThisModule or BibleOrgSysGlobals.verbosityLevel > 1:
print( "Gen assumed book name:", repr( EsfmB.getAssumedBookName( 'GEN' ) ) )
print( "Gen long TOC book name:", repr( EsfmB.getLongTOCName( 'GEN' ) ) )
print( "Gen short TOC book name:", repr( EsfmB.getShortTOCName( 'GEN' ) ) )
print( "Gen book abbreviation:", repr( EsfmB.getBooknameAbbreviation( 'GEN' ) ) )
if BibleOrgSysGlobals.verbosityLevel > 0: print( EsfmB )
if BibleOrgSysGlobals.strictCheckingFlag:
EsfmB.check()
Expand Down
16 changes: 8 additions & 8 deletions ESFMBibleBook.py
Expand Up @@ -28,14 +28,14 @@

from gettext import gettext as _

LastModifiedDate = '2017-11-08' # by RJH
LastModifiedDate = '2017-11-19' # by RJH
ShortProgName = "USFMBibleBook"
ProgName = "ESFM Bible book handler"
ProgVersion = '0.46'
ProgNameVersion = '{} v{}'.format( ShortProgName, ProgVersion )
ProgNameVersionDate = '{} {} {}'.format( ProgNameVersion, _("last modified"), LastModifiedDate )

debuggingThisModule = True
debuggingThisModule = False


import os, logging
Expand Down Expand Up @@ -82,7 +82,7 @@ def load( self, filename, folder=None ):
Note: the base class later on will try to break apart lines with a paragraph marker in the middle --
we don't need to worry about that here.
"""
if debuggingThisModule or BibleOrgSysGlobals.verbosityLevel > 1:
if debuggingThisModule or BibleOrgSysGlobals.debugFlag:
print( "ESFM.load( {}, {} )".format( filename, folder ) )


Expand All @@ -106,15 +106,15 @@ def ESFMPreprocessing( BBB, C, V, marker, originalText ):
Note: This DOESN'T remove the underline/underscore characters used to join translated words
which were one word in the original, e.g., went_down
"""
if (debuggingThisModule or BibleOrgSysGlobals.verbosityLevel > 1) \
if (debuggingThisModule or BibleOrgSysGlobals.debugFlag) \
and len(originalText)>5: # Don't display for "blank" lines (like '\v 10 ')
print( "\n\nESFMPreprocessing( {} {}:{}, {}, {!r} )".format( BBB, C, V, marker, originalText ) )


def saveWord( BBB, C, V, word ):
"""
"""
if debuggingThisModule or BibleOrgSysGlobals.verbosityLevel > 1:
if debuggingThisModule or BibleOrgSysGlobals.debugFlag:
print( "ESFM saveWord( {}, {}:{}, {!r} )".format( BBB, C, V, word ) )
assert word and ' ' not in word
# end of saveWord
Expand All @@ -132,7 +132,7 @@ def saveSemanticTag( BBB, C, V, word, tag ):
(for better compatibility with the software chain).
"""
#if C=='4' and V in ('11','12'):
if debuggingThisModule or BibleOrgSysGlobals.verbosityLevel > 1:
if debuggingThisModule or BibleOrgSysGlobals.debugFlag:
print( "ESFM saveSemanticTag( {}, {}:{}, {!r}, {!r} )".format( BBB, C, V, word, tag ) )
assert word and ' ' not in word
assert tag and tag[0]=='=' and len(tag)>=2
Expand Down Expand Up @@ -173,7 +173,7 @@ def saveStrongsTag( BBB, C, V, word, tag ):
(for better compatibility with the software chain).
"""
#if C=='4' and V in ('11','12'):
if debuggingThisModule or BibleOrgSysGlobals.verbosityLevel > 1:
if debuggingThisModule or BibleOrgSysGlobals.debugFlag:
print( "ESFM saveStrongsTag( {}, {}:{}, {!r}, {!r} )".format( BBB, C, V, word, tag ) )
assert word and ' ' not in word
assert tag and tag[0]=='=' and tag[1]=='S' and len(tag)>=3
Expand Down Expand Up @@ -352,7 +352,7 @@ def saveStrongsTag( BBB, C, V, word, tag ):
print( " got: {!r}".format( resultText ) )
#assert originalText.count('_') == resultText.count('_') Not necessarily true
elif BibleOrgSysGlobals.strictCheckingFlag or (BibleOrgSysGlobals.debugFlag and debuggingThisModule) \
and '{' in originalText or '}' in originalText or '=' in originalText:
and ('{' in originalText or '}' in originalText or '=' in originalText):
print( "original:", repr(originalText) )
print( "returned:", repr(resultText) )

Expand Down
22 changes: 12 additions & 10 deletions InternalBible.py
Expand Up @@ -56,7 +56,7 @@

from gettext import gettext as _

LastModifiedDate = '2017-11-02' # by RJH
LastModifiedDate = '2017-11-16' # by RJH
ShortProgName = "InternalBible"
ProgName = "Internal Bible handler"
ProgVersion = '0.80'
Expand Down Expand Up @@ -553,7 +553,9 @@ def applySuppliedMetadata( self, applyMetadataType ):
"""
if BibleOrgSysGlobals.debugFlag or BibleOrgSysGlobals.verbosityLevel>2:
print( exp("applySuppliedMetadata( {} )").format( applyMetadataType ) )
assert applyMetadataType in ( 'Project','File', 'SSF', 'PTX7','PTX8', 'OSIS', 'e-Sword','MySword','MyBible', 'BCV','Online','theWord','Unbound','VerseView','Forge4SS','VPL' )
assert applyMetadataType in ( 'Project','File', 'SSF', 'PTX7','PTX8', 'OSIS',
'e-Sword-Bible','e-Sword-Commentary', 'MySword','MyBible',
'BCV','Online','theWord','Unbound','VerseView','Forge4SS','VPL' )

if BibleOrgSysGlobals.debugFlag and debuggingThisModule and BibleOrgSysGlobals.verbosityLevel > 2:
print( "Supplied {} metadata ({}):".format( applyMetadataType, len(self.suppliedMetadata[applyMetadataType]) ) )
Expand All @@ -566,11 +568,11 @@ def applySuppliedMetadata( self, applyMetadataType ):
nameChangeDict = {}
nameChangeDict['File'] = {} # This is metadata submitted by the user in a separate text file
nameChangeDict['BCV'] = {}
nameChangeDict['Online'] = { 'LongName':'FullName', }
nameChangeDict['theWord'] = { 'description':'FullName', 'short.title':'ShortName', }
nameChangeDict['Unbound'] = { 'name':'FullName', 'filetype':'Filetype', 'copyright':'Copyright', 'abbreviation':'Abbreviation', 'language':'Language', 'note':'Note', 'columns':'Columns', }
nameChangeDict['VerseView'] = { 'Title':'FullName', }
nameChangeDict['Forge4SS'] = { 'TITLE':'FullName', 'ABBREVIATION':'Abbreviation', 'AUTHORDETAIL':'AuthorDetailHTML', }
nameChangeDict['Online'] = { 'LongName':'FullName' }
nameChangeDict['theWord'] = { 'description':'FullName', 'short.title':'ShortName' }
nameChangeDict['Unbound'] = { 'name':'FullName', 'filetype':'Filetype', 'copyright':'Copyright', 'abbreviation':'Abbreviation', 'language':'Language', 'note':'Note', 'columns':'Columns' }
nameChangeDict['VerseView'] = { 'Title':'FullName' }
nameChangeDict['Forge4SS'] = { 'TITLE':'FullName', 'ABBREVIATION':'Abbreviation', 'AUTHORDETAIL':'AuthorDetailHTML' }
nameChangeDict['VPL'] = { 'TITLE':'FullName', 'ABBREVIATION':'Abbreviation', } # Not sure if these two are needed here???
if BibleOrgSysGlobals.debugFlag or BibleOrgSysGlobals.verbosityLevel>3:
print( "applySuppliedMetadata is processing {} {!r} metadata items".format( len(self.suppliedMetadata[applyMetadataType]), applyMetadataType ) )
Expand Down Expand Up @@ -617,7 +619,7 @@ def applySuppliedMetadata( self, applyMetadataType ):
# Either that, or bring the DBL one into here
elif applyMetadataType == 'SSF':
# This is a special case (coz it's inside the PTX7 metadata)
wantedDict = { 'Copyright':'Copyright', 'FullName':'WorkName', 'LanguageIsoCode':'ISOLanguageCode', }
wantedDict = { 'Copyright':'Copyright', 'FullName':'WorkName', 'LanguageIsoCode':'ISOLanguageCode' }
if BibleOrgSysGlobals.debugFlag or BibleOrgSysGlobals.verbosityLevel>3:
print( "applySuppliedMetadata is processing {} {!r} metadata items".format( len(self.suppliedMetadata['PTX7']['SSF']), applyMetadataType ) )
for oldKey,value in self.suppliedMetadata['PTX7']['SSF'].items():
Expand Down Expand Up @@ -727,7 +729,7 @@ def applySuppliedMetadata( self, applyMetadataType ):
elif applyMetadataType == 'MyBible':
# Available fields include: Version, Creator, Contributor, Subject, Format, Type, Identifier, Source,
# Publisher, Scope, Coverage, RefSystem, Language, Rights
wantedDict = { 'language':'Language', 'description':'FullName', 'detailed_info':'Description', }
wantedDict = { 'language':'Language', 'description':'FullName', 'detailed_info':'Description' }
if BibleOrgSysGlobals.debugFlag or BibleOrgSysGlobals.verbosityLevel>3:
print( "applySuppliedMetadata is processing {} {!r} metadata items".format( len(self.suppliedMetadata[applyMetadataType]), applyMetadataType ) )
for oldKey,value in self.suppliedMetadata[applyMetadataType].items():
Expand All @@ -746,7 +748,7 @@ def applySuppliedMetadata( self, applyMetadataType ):
self.settingsDict[newKey] = value
#print( self.settingsDict ); halt

elif applyMetadataType in ( 'e-Sword','MySword', ):
elif applyMetadataType in ( 'e-Sword-Bible', 'e-Sword-Commentary', 'MySword' ):
# Available fields include: Abbreviation, Apocrypha, Comments, Description, Font, NT, OT,
# RightToLeft, Strong, Version
wantedDict = { 'Abbreviation':'Abbreviation', 'Description':'Description', }
Expand Down

0 comments on commit 0e813bf

Please sign in to comment.