summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter von Kaehne <refdoc@gmx.net>2014-12-29 17:19:47 +0000
committerPeter von Kaehne <refdoc@gmx.net>2014-12-29 17:19:47 +0000
commitf76e224af60fd7ed39b6afde7fdcd31de0138f94 (patch)
tree6fb2627a6a925824c5b27ef0d4e4f440fdc49ec9
parent8202163d6fc9d8447d524ad7769cb57add32a263 (diff)
downloadsword-tools-f76e224af60fd7ed39b6afde7fdcd31de0138f94.tar.gz
added -l LANGUAGE commandline option
git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@490 07627401-56e2-0310-80f4-f8cd0041bdcd
-rwxr-xr-xmodules/python/usfm2osis.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/modules/python/usfm2osis.py b/modules/python/usfm2osis.py
index f8dcc9e..a6bbb00 100755
--- a/modules/python/usfm2osis.py
+++ b/modules/python/usfm2osis.py
@@ -1411,6 +1411,7 @@ def printUsage():
print(' -e ENCODING input encoding override (default is to read the USFM file\'s')
print(' \\ide value or assume UTF-8 encoding in its absence)')
print(' -h, --help print this usage information')
+ print(' -l LANGUAGE input language code - (default "und")')
print(' -o FILENAME output filename (default is: <osisWork>.osis.xml)')
print(' -r enable relaxed markup processing (for non-standard USFM)')
print(' -s mode set book sorting mode: natural (default), alpha, canonical,')
@@ -1511,7 +1512,16 @@ if __name__ == "__main__":
relaxedConformance = True
bookDict = dict(list(bookDict.items()) + list(addBookDict.items()))
inputFilesIdx += 1
-
+
+ if '-l' in sys.argv:
+ i = sys.argv.index('-l')+1
+ if len(sys.argv) < i+1:
+ printUsage()
+
+ language = sys.argv[i]
+ inputFilesIdx += 2 #increment 2, reflecting 2 args for -l
+ else: language = 'und'
+
if '-s' in sys.argv:
i = sys.argv.index('-s')+1
if len(sys.argv) < i+1:
@@ -1567,7 +1577,7 @@ if __name__ == "__main__":
osisSegment[k]=v
print('Assembling OSIS document')
- osisDoc = '<osis xmlns="http://www.bibletechnologies.net/2003/OSIS/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bibletechnologies.net/2003/OSIS/namespace http://www.bibletechnologies.net/osisCore.'+osisVersion+'.xsd">\n<osisText osisRefWork="Bible" xml:lang="und" osisIDWork="' + osisWork + '">\n<header>\n<work osisWork="' + osisWork + '"/>\n</header>\n'
+ osisDoc = '<osis xmlns="http://www.bibletechnologies.net/2003/OSIS/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bibletechnologies.net/2003/OSIS/namespace http://www.bibletechnologies.net/osisCore.'+osisVersion+'.xsd">\n<osisText osisRefWork="Bible" xml:lang="' + language + '" osisIDWork="' + osisWork + '">\n<header>\n<work osisWork="' + osisWork + '"/>\n</header>\n'
unhandledTags = set()
for doc in usfmDocList: