Changeset 299
- Timestamp:
- 11/30/08 05:20:49 (4 years ago)
- File:
-
- 1 edited
-
pyyaml/trunk/lib/yaml/emitter.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pyyaml/trunk/lib/yaml/emitter.py
r222 r299 775 775 allow_block = True 776 776 777 # Leading and trailing whitespace are bad for plain scalars. We also 778 # do not want to mess with leading whitespaces for block scalars. 779 if leading_spaces or leading_breaks or trailing_spaces: 780 allow_flow_plain = allow_block_plain = allow_block = False 781 782 # Trailing breaks are fine for block scalars, but unacceptable for 783 # plain scalars. 784 if trailing_breaks: 777 # Leading and trailing whitespaces are bad for plain scalars. 778 if (leading_spaces or leading_breaks 779 or trailing_spaces or trailing_breaks): 785 780 allow_flow_plain = allow_block_plain = False 786 781 787 # The combination of (space+ break+) is only acceptable for block 782 # We do not permit trailing spaces for block scalars. 783 if trailing_spaces: 784 allow_block = False 785 786 # Spaces at the beginning of a new line are only acceptable for block 788 787 # scalars. 789 788 if inline_breaks_spaces: … … 1010 1009 1011 1010 def determine_chomp(self, text): 1011 hints = u'' 1012 if text and text[0] in u' \n\x85\u2028\u2029': 1013 hints += unicode(self.best_indent) 1012 1014 tail = text[-2:] 1013 1015 while len(tail) < 2: … … 1015 1017 if tail[-1] in u'\n\x85\u2028\u2029': 1016 1018 if tail[-2] in u'\n\x85\u2028\u2029': 1017 return u'+' 1018 else: 1019 return u'' 1020 else: 1021 return u'-' 1019 hints += u'+' 1020 else: 1021 hints += u'-' 1022 return hints 1022 1023 1023 1024 def write_folded(self, text): 1024 chomp = self.determine_chomp(text)1025 self.write_indicator(u'>'+ chomp, True)1025 hints = self.determine_block_hints(text) 1026 self.write_indicator(u'>'+hints, True) 1026 1027 self.write_indent() 1027 1028 leading_space = False
Note: See TracChangeset
for help on using the changeset viewer.
