[guest - Wed Jul 23 05:57:17 2003]:
Show quoted text> YAML.pm, line 557, currently has a folding value of 50 hard-coded.
> It would be great if this value became an option... for those who
> prefer not to fold, or fold less.
I wanted that too. The attached patch adds in the $YAML::FoldLimit
config variable to achieve this. I've also got a doc patch which
describes this, but 'RT' only has one file-upload field so that'll be in
the next comment ...
Smylers
--- /usr/local/lib/perl5/site_perl/5.8.2/YAML.pm Tue Jun 25 06:02:09 2002
+++ ./YAML.pm Wed May 25 12:00:20 2005
@@ -55,6 +55,7 @@
$ForceBlock = 0 unless defined $ForceBlock;
$UseBlock = 0 unless defined $UseBlock;
$UseFold = 0 unless defined $UseFold;
+ $FoldLimit = 50 unless defined $FoldLimit;
$CompressSeries = 1 unless defined $CompressSeries;
$InlineSeries = 0 unless defined $InlineSeries;
$UseAliases = 1 unless defined $UseAliases;
@@ -97,6 +98,7 @@
ForceBlock => $YAML::ForceBlock,
UseBlock => $YAML::UseBlock,
UseFold => $YAML::UseFold,
+ FoldLimit => $YAML::FoldLimit,
CompressSeries => $YAML::CompressSeries,
InlineSeries => $YAML::InlineSeries,
UseAliases => $YAML::UseAliases,
@@ -554,8 +556,8 @@
if (defined $_[0] and
$_[0] !~ /$ESCAPE_CHAR/ and
- (length($_[0]) > 50 or $_[0] =~ /\n\s/ or
- ($o->{ForceBlock} and $type != KEY)
+ (($o->{FoldLimit} and length($_[0]) > $o->{FoldLimit}) or
+ $_[0] =~ /\n\s/ or ($o->{ForceBlock} and $type != KEY)
)
) {
$o->{stream} .= ($type == KEY) ? '? ' : ' ';