allow_double_quoted = True
- # Leading and trailing whitespace are bad for plain scalars. We also
- # do not want to mess with leading whitespaces for block scalars.
- if leading_spaces or leading_breaks or trailing_spaces:
- allow_flow_plain = allow_block_plain = allow_block = False
- # Trailing breaks are fine for block scalars, but unacceptable for
+ # Leading and trailing whitespaces are bad for plain scalars.
+ if (leading_spaces or leading_breaks
+ or trailing_spaces or trailing_breaks):
allow_flow_plain = allow_block_plain = False
- # The combination of (space+ break+) is only acceptable for block
+ # We do not permit trailing spaces for block scalars.
+ # Spaces at the beginning of a new line are only acceptable for block
allow_flow_plain = allow_block_plain = allow_single_quoted = False
def determine_chomp(self, text):
+ if text and text in u' \n\x85\u2028\u2029':
+ hints += unicode(self.best_indent)
if tail[-1] in u'\n\x85\u2028\u2029':
if tail[-2] in u'\n\x85\u2028\u2029':
def write_folded(self, text):
- chomp = self.determine_chomp(text)
- self.write_indicator(u'>'+chomp, True)
+ hints = self.determine_block_hints(text)
+ self.write_indicator(u'>'+hints, True)