1 #!/usr/bin/env python 2 3 from moinformat import parse 4 from moinformat.serialisers import serialise, HTMLSerialiser 5 from glob import glob 6 from os.path import join, split 7 import sys 8 9 dirname = split(sys.argv[0])[0] 10 11 def test_input(s): 12 d = parse(s) 13 o = serialise(d) 14 15 print o == s 16 print "-" * 60 17 print o 18 if o != s: 19 print "-" * 60 20 print s 21 print "-" * 60 22 print serialise(d, HTMLSerialiser) 23 print "-" * 60 24 print d.prettyprint() 25 print 26 27 if __name__ == "__main__": 28 filenames = sys.argv[1:] or glob(join(dirname, "test*.txt")) 29 filenames.sort() 30 31 for filename in filenames: 32 f = open(filename) 33 try: 34 print filename 35 test_input(f.read()) 36 finally: 37 f.close() 38 39 # vim: tabstop=4 expandtab shiftwidth=4