summaryrefslogtreecommitdiffstats
path: root/examples/FTMLnorm.py
blob: 638b2db97c160d6e89bd1ac9865c54dc6e38ca1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python
'Normalize an FTML file'
__url__ = 'http://github.com/silnrsi/pysilfont'
__copyright__ = 'Copyright (c) 2016 SIL International (http://www.sil.org)'
__license__ = 'Released under the MIT License (http://opensource.org/licenses/MIT)'
__author__ = 'David Raymond'

from silfont.core import execute
import silfont.ftml as ftml
from xml.etree import cElementTree as ET

argspec = [
    ('infile',{'help': 'Input ftml file'}, {'type': 'infile'}),
    ('outfile',{'help': 'Output ftml file', 'nargs': '?'}, {'type': 'outfile', 'def': '_new.xml'}),
    ('-l','--log',{'help': 'Log file'}, {'type': 'outfile', 'def': '_ftmltest.log'})
    ]

def doit(args) :
    f = ftml.Fxml(args.infile)
    f.save(args.outfile)

def cmd() : execute("",doit,argspec) 
if __name__ == "__main__": cmd()execute("", doit, argspec)