yml2proc
changeset 11 7026ccc7a60e
parent 7 f81a4471bc28
child 20 c936066cff62
equal deleted inserted replaced
10:519fb60037ce 11:7026ccc7a60e
   116 
   116 
   117     rtext = u""
   117     rtext = u""
   118 
   118 
   119     if not options.emptyinput:
   119     if not options.emptyinput:
   120         files = fileinput.input(args, mode="rU", openhook=fileinput.hook_encoded(options.encoding))
   120         files = fileinput.input(args, mode="rU", openhook=fileinput.hook_encoded(options.encoding))
   121         # fileinput suffer from two nasty bugs :
       
   122         # - ignoring open hook with stdin
       
   123         # - iterator requires ctrl-D to be pressed twice on siome platform
       
   124         if args in [[],['-']] :
       
   125             files._files=[]
       
   126             files._buffer=[unicode(line, options.encoding) for line in sys.stdin.readlines()]
       
   127 
   121 
   128         if options.xml:
   122         if options.xml:
   129             rtext = ""
   123             rtext = ""
   130             for line in files:
   124             for line in files:
   131                 rtext += line
   125                 rtext += line