Changeset 163
- Timestamp:
- 05/14/06 11:12:42 (7 years ago)
- File:
-
- 1 edited
-
pyyaml/trunk/examples/yaml-hl/yaml_hl.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pyyaml/trunk/examples/yaml-hl/yaml_hl.py
r159 r163 1 1 #!/usr/bin/python 2 2 3 import yaml, codecs, sys, o ptparse3 import yaml, codecs, sys, os.path, optparse 4 4 5 5 class Style: … … 50 50 51 51 def highlight(self): 52 if self.style.header:53 self.output.write(self.style.header)54 52 input = self.input.read() 55 53 if input.startswith(codecs.BOM_UTF16_LE): … … 94 92 chunks.reverse() 95 93 result = u''.join(chunks) 94 if self.style.header: 95 self.output.write(self.style.header) 96 96 self.output.write(result.encode('utf-8')) 97 97 if self.style.footer: … … 102 102 parser.add_option('-s', '--style', dest='style', default='ascii', 103 103 help="specify the highlighting style", metavar='STYLE') 104 parser.add_option('-c', '--config', dest='config', default='yaml_hl.cfg', 104 parser.add_option('-c', '--config', dest='config', 105 default=os.path.join(os.path.dirname(sys.argv[0]), 'yaml_hl.cfg'), 105 106 help="set an alternative configuration file", metavar='CONFIG') 106 107 parser.add_option('-i', '--input', dest='input', default=None,
Note: See TracChangeset
for help on using the changeset viewer.
